add line height test

[ci skip]
This commit is contained in:
troosan 2018-04-14 22:42:58 +02:00
parent 9bc85347ef
commit dd27f668e0
3 changed files with 7 additions and 2 deletions

View File

@ -125,6 +125,7 @@ class HtmlTest extends \PHPUnit\Framework\TestCase
$section = $phpWord->addSection();
Html::addHtml($section, '<p style="line-height: 1.5;">test</p>');
Html::addHtml($section, '<p style="line-height: 15pt;">test</p>');
Html::addHtml($section, '<p style="line-height: 120%;">test</p>');
$doc = TestHelperDOCX::getDocument($phpWord, 'Word2007');
$this->assertTrue($doc->elementExists('/w:document/w:body/w:p[1]/w:pPr/w:spacing'));
@ -134,6 +135,10 @@ class HtmlTest extends \PHPUnit\Framework\TestCase
$this->assertTrue($doc->elementExists('/w:document/w:body/w:p[2]/w:pPr/w:spacing'));
$this->assertEquals(300, $doc->getElementAttribute('/w:document/w:body/w:p[2]/w:pPr/w:spacing', 'w:line'));
$this->assertEquals(LineSpacingRule::EXACT, $doc->getElementAttribute('/w:document/w:body/w:p[2]/w:pPr/w:spacing', 'w:lineRule'));
$this->assertTrue($doc->elementExists('/w:document/w:body/w:p[3]/w:pPr/w:spacing'));
$this->assertEquals(Paragraph::LINE_HEIGHT * 1.2, $doc->getElementAttribute('/w:document/w:body/w:p[3]/w:pPr/w:spacing', 'w:line'));
$this->assertEquals(LineSpacingRule::AUTO, $doc->getElementAttribute('/w:document/w:body/w:p[3]/w:pPr/w:spacing', 'w:lineRule'));
}
/**

View File

@ -256,7 +256,7 @@ class ElementTest extends \PHPUnit\Framework\TestCase
{
$phpWord = new PhpWord();
$section = $phpWord->addSection();
$style = array('width' => 1000000, 'height' => 1000000);
$style = array('width' => 1000000, 'height' => 1000000, 'showAxisLabels' => true, 'showGridX' => true, 'showGridY' => true);
$chartTypes = array('pie', 'doughnut', 'bar', 'line', 'area', 'scatter', 'radar');
$categories = array('A', 'B', 'C', 'D', 'E');

View File

@ -43,7 +43,7 @@ class FontTest extends \PHPUnit\Framework\TestCase
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$textrun = $section->addTextRun();
$textrun->addText('سلام این یک پاراگراف راست به چپ است', array('rtl' => true));
$textrun->addText('سلام این یک پاراگراف راست به چپ است', array('rtl' => true, 'lang' => 'ar-DZ'));
$doc = TestHelperDOCX::getDocument($phpWord, 'Word2007');
$file = 'word/document.xml';