Ingen beskrivning

FontTest.php 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * This file is part of PHPWord - A pure PHP library for reading and writing
  4. * word processing documents.
  5. *
  6. * PHPWord is free software distributed under the terms of the GNU Lesser
  7. * General Public License version 3 as published by the Free Software Foundation.
  8. *
  9. * For the full copyright and license information, please read the LICENSE
  10. * file that was distributed with this source code. For the full list of
  11. * contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
  12. *
  13. * @link https://github.com/PHPOffice/PHPWord
  14. * @copyright 2010-2014 PHPWord contributors
  15. * @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
  16. */
  17. namespace PhpOffice\PhpWord\Tests\Writer\Word2007\Part;
  18. use PhpOffice\PhpWord\Tests\TestHelperDOCX;
  19. use PhpOffice\PhpWord\Writer\Word2007;
  20. use PhpOffice\PhpWord\Writer\Word2007\Style\Font;
  21. /**
  22. * Test class for PhpOffice\PhpWord\Writer\Word2007\Style\Font
  23. *
  24. * @coversDefaultClass \PhpOffice\PhpWord\Writer\Word2007\Style\Font
  25. * @runTestsInSeparateProcesses
  26. */
  27. class FontTest extends \PHPUnit_Framework_TestCase
  28. {
  29. /**
  30. * Executed before each method of the class
  31. */
  32. public function tearDown()
  33. {
  34. TestHelperDOCX::clear();
  35. }
  36. /**
  37. * Test write styles
  38. */
  39. public function testFontRTL()
  40. {
  41. $phpWord = new \PhpOffice\PhpWord\PhpWord();
  42. $section = $phpWord->addSection();
  43. $textrun = $section->addTextRun();
  44. $textrun->addText('سلام این یک پاراگراف راست به چپ است', array('rtl' => true));
  45. $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007');
  46. $file = 'word/document.xml';
  47. $path = '/w:document/w:body/w:p/w:r/w:rPr/w:rtl';
  48. $this->assertTrue($doc->elementExists($path, $file));
  49. }
  50. }