|
20 | 20 | use PhpOffice\PhpWord\Element\Section;
|
21 | 21 | use PhpOffice\PhpWord\SimpleType\Jc;
|
22 | 22 | use PhpOffice\PhpWord\TestHelperDOCX;
|
| 23 | +use PhpOffice\PhpWord\Style\Paragraph; |
| 24 | +use PhpOffice\PhpWord\SimpleType\LineSpacingRule; |
23 | 25 |
|
24 | 26 | /**
|
25 | 27 | * Test class for PhpOffice\PhpWord\Shared\Html
|
@@ -122,10 +124,16 @@ public function testParseLineHeight()
|
122 | 124 | $phpWord = new \PhpOffice\PhpWord\PhpWord();
|
123 | 125 | $section = $phpWord->addSection();
|
124 | 126 | Html::addHtml($section, '<p style="line-height: 1.5;">test</p>');
|
| 127 | + Html::addHtml($section, '<p style="line-height: 15pt;">test</p>'); |
125 | 128 |
|
126 | 129 | $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007');
|
127 |
| - $this->assertTrue($doc->elementExists('/w:document/w:body/w:p/w:pPr/w:spacing')); |
128 |
| - $this->assertEquals(240 * 1.5, $doc->getElementAttribute('/w:document/w:body/w:p/w:pPr/w:spacing', 'w:line')); |
| 130 | + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p[1]/w:pPr/w:spacing')); |
| 131 | + $this->assertEquals(Paragraph::LINE_HEIGHT * 1.5, $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:pPr/w:spacing', 'w:line')); |
| 132 | + $this->assertEquals(LineSpacingRule::AUTO, $doc->getElementAttribute('/w:document/w:body/w:p[1]/w:pPr/w:spacing', 'w:lineRule')); |
| 133 | + |
| 134 | + $this->assertTrue($doc->elementExists('/w:document/w:body/w:p[2]/w:pPr/w:spacing')); |
| 135 | + $this->assertEquals(300, $doc->getElementAttribute('/w:document/w:body/w:p[2]/w:pPr/w:spacing', 'w:line')); |
| 136 | + $this->assertEquals(LineSpacingRule::EXACT, $doc->getElementAttribute('/w:document/w:body/w:p[2]/w:pPr/w:spacing', 'w:lineRule')); |
129 | 137 | }
|
130 | 138 |
|
131 | 139 | /**
|
|
0 commit comments