Skip to content

Commit dd27f66

Browse files
committed
add line height test
[ci skip]
1 parent 9bc8534 commit dd27f66

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

tests/PhpWord/Shared/HtmlTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ public function testParseLineHeight()
125125
$section = $phpWord->addSection();
126126
Html::addHtml($section, '<p style="line-height: 1.5;">test</p>');
127127
Html::addHtml($section, '<p style="line-height: 15pt;">test</p>');
128+
Html::addHtml($section, '<p style="line-height: 120%;">test</p>');
128129

129130
$doc = TestHelperDOCX::getDocument($phpWord, 'Word2007');
130131
$this->assertTrue($doc->elementExists('/w:document/w:body/w:p[1]/w:pPr/w:spacing'));
@@ -134,6 +135,10 @@ public function testParseLineHeight()
134135
$this->assertTrue($doc->elementExists('/w:document/w:body/w:p[2]/w:pPr/w:spacing'));
135136
$this->assertEquals(300, $doc->getElementAttribute('/w:document/w:body/w:p[2]/w:pPr/w:spacing', 'w:line'));
136137
$this->assertEquals(LineSpacingRule::EXACT, $doc->getElementAttribute('/w:document/w:body/w:p[2]/w:pPr/w:spacing', 'w:lineRule'));
138+
139+
$this->assertTrue($doc->elementExists('/w:document/w:body/w:p[3]/w:pPr/w:spacing'));
140+
$this->assertEquals(Paragraph::LINE_HEIGHT * 1.2, $doc->getElementAttribute('/w:document/w:body/w:p[3]/w:pPr/w:spacing', 'w:line'));
141+
$this->assertEquals(LineSpacingRule::AUTO, $doc->getElementAttribute('/w:document/w:body/w:p[3]/w:pPr/w:spacing', 'w:lineRule'));
137142
}
138143

139144
/**

tests/PhpWord/Writer/Word2007/ElementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public function testChartElements()
256256
{
257257
$phpWord = new PhpWord();
258258
$section = $phpWord->addSection();
259-
$style = array('width' => 1000000, 'height' => 1000000);
259+
$style = array('width' => 1000000, 'height' => 1000000, 'showAxisLabels' => true, 'showGridX' => true, 'showGridY' => true);
260260

261261
$chartTypes = array('pie', 'doughnut', 'bar', 'line', 'area', 'scatter', 'radar');
262262
$categories = array('A', 'B', 'C', 'D', 'E');

tests/PhpWord/Writer/Word2007/Style/FontTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function testFontRTL()
4343
$phpWord = new \PhpOffice\PhpWord\PhpWord();
4444
$section = $phpWord->addSection();
4545
$textrun = $section->addTextRun();
46-
$textrun->addText('سلام این یک پاراگراف راست به چپ است', array('rtl' => true));
46+
$textrun->addText('سلام این یک پاراگراف راست به چپ است', array('rtl' => true, 'lang' => 'ar-DZ'));
4747
$doc = TestHelperDOCX::getDocument($phpWord, 'Word2007');
4848

4949
$file = 'word/document.xml';

0 commit comments

Comments
 (0)