diff --git a/Tests/PHPWord/Writer/Word2007/BaseTest.php b/Tests/PHPWord/Writer/Word2007/BaseTest.php index 3627bdd5..8788af8b 100644 --- a/Tests/PHPWord/Writer/Word2007/BaseTest.php +++ b/Tests/PHPWord/Writer/Word2007/BaseTest.php @@ -41,5 +41,42 @@ class PHPWord_Writer_Word2007_BaseTest extends \PHPUnit_Framework_TestCase { $this->assertRegExp('/z\-index:\-[0-9]*/', $style); $this->assertRegExp('/position:absolute;/', $style); } + + public function testWriteParagraphStyle_Align() + { + $PHPWord = new PHPWord(); + $section = $PHPWord->createSection(); + + $section->addText('This is my text', null, array('align' => 'right')); + + $doc = TestHelperDOCX::getDocument($PHPWord); + $element = $doc->getElement('/w:document/w:body/w:p/w:pPr/w:jc'); + + $this->assertEquals('right', $element->getAttribute('w:val')); + } + + public function testWriteCellStyle_CellGridSpan() + { + $PHPWord = new PHPWord(); + $section = $PHPWord->createSection(); + + $table = $section->addTable(); + + $table->addRow(); + $cell = $table->addCell(200); + $cell->getStyle()->setGridSpan(5); + + $table->addRow(); + $table->addCell(40); + $table->addCell(40); + $table->addCell(40); + $table->addCell(40); + $table->addCell(40); + + $doc = TestHelperDOCX::getDocument($PHPWord); + $element = $doc->getElement('/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:gridSpan'); + + $this->assertEquals(5, $element->getAttribute('w:val')); + } } \ No newline at end of file diff --git a/Tests/PHPWord/Writer/Word2007/DocumentTest.php b/Tests/PHPWord/Writer/Word2007/DocumentTest.php index 8788af8b..13d233cc 100644 --- a/Tests/PHPWord/Writer/Word2007/DocumentTest.php +++ b/Tests/PHPWord/Writer/Word2007/DocumentTest.php @@ -4,14 +4,14 @@ namespace PHPWord\Tests; use PHPUnit_Framework_TestCase; use PHPWord; use PHPWord_Writer_Word2007; -use PHPWord_Writer_Word2007_Base; +use PHPWord_Writer_Word2007_Document; /** - * Class PHPWord_Writer_Word2007_BaseTest + * Class PHPWord_Writer_Word2007_DocumentTest * @package PHPWord\Tests * @runTestsInSeparateProcesses */ -class PHPWord_Writer_Word2007_BaseTest extends \PHPUnit_Framework_TestCase { +class PHPWord_Writer_Word2007_DocumentTest extends \PHPUnit_Framework_TestCase { /** * Executed before each method of the class */ @@ -20,63 +20,16 @@ class PHPWord_Writer_Word2007_BaseTest extends \PHPUnit_Framework_TestCase { TestHelperDOCX::clear(); } - public function testWriteImage_Position() + public function testWriteEndSection_PageNumbering() { $PHPWord = new PHPWord(); $section = $PHPWord->createSection(); - $section->addImage( - PHPWORD_TESTS_DIR_ROOT . '/_files/images/earth.jpg', - array( - 'marginTop' => -1, - 'marginLeft' => -1, - 'wrappingStyle' => 'behind' - ) - ); + $section->getSettings()->setPageNumberingStart(2); $doc = TestHelperDOCX::getDocument($PHPWord); - $element = $doc->getElement('/w:document/w:body/w:p/w:r/w:pict/v:shape'); + $element = $doc->getElement('/w:document/w:body/w:sectPr/w:pgNumType'); - $style = $element->getAttribute('style'); - - $this->assertRegExp('/z\-index:\-[0-9]*/', $style); - $this->assertRegExp('/position:absolute;/', $style); + $this->assertEquals(2, $element->getAttribute('w:start')); } - - public function testWriteParagraphStyle_Align() - { - $PHPWord = new PHPWord(); - $section = $PHPWord->createSection(); - - $section->addText('This is my text', null, array('align' => 'right')); - - $doc = TestHelperDOCX::getDocument($PHPWord); - $element = $doc->getElement('/w:document/w:body/w:p/w:pPr/w:jc'); - - $this->assertEquals('right', $element->getAttribute('w:val')); - } - - public function testWriteCellStyle_CellGridSpan() - { - $PHPWord = new PHPWord(); - $section = $PHPWord->createSection(); - - $table = $section->addTable(); - - $table->addRow(); - $cell = $table->addCell(200); - $cell->getStyle()->setGridSpan(5); - - $table->addRow(); - $table->addCell(40); - $table->addCell(40); - $table->addCell(40); - $table->addCell(40); - $table->addCell(40); - - $doc = TestHelperDOCX::getDocument($PHPWord); - $element = $doc->getElement('/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:gridSpan'); - - $this->assertEquals(5, $element->getAttribute('w:val')); - } } \ No newline at end of file diff --git a/changelog.txt b/changelog.txt index 90599cd2..baa696ce 100755 --- a/changelog.txt +++ b/changelog.txt @@ -23,6 +23,7 @@ ************************************************************************************** Changes in branch for release 0.7.1 : +- QA: (Progi1984) - UnitTests - Feature: (gabrielbull) - Word2007 : Support sections page numbering - Bugfix: (gabrielbull) - Fixed bug with cell styling - Bugfix: (gabrielbull) - Fixed bug list items inside of cells