add test to auto invert text color

This commit is contained in:
Maxim Bulygin 2019-03-01 16:31:47 +02:00
parent e40449e7c8
commit 57ae7008b2
1 changed files with 7 additions and 2 deletions

View File

@ -85,10 +85,10 @@ class ElementTest extends \PHPUnit\Framework\TestCase
$section = $phpWord->addSection(); $section = $phpWord->addSection();
$table = $section->addTable(); $table = $section->addTable();
$row1 = $table->addRow(); $row1 = $table->addRow();
$cell11 = $row1->addCell(1000, array('gridSpan' => 2)); $cell11 = $row1->addCell(1000, array('gridSpan' => 2, 'bgColor' => '6086B8'));
$cell11->addText('cell spanning 2 bellow'); $cell11->addText('cell spanning 2 bellow');
$row2 = $table->addRow(); $row2 = $table->addRow();
$cell21 = $row2->addCell(500); $cell21 = $row2->addCell(500, array('bgColor' => 'ffffff'));
$cell21->addText('first cell'); $cell21->addText('first cell');
$cell22 = $row2->addCell(500); $cell22 = $row2->addCell(500);
$cell22->addText('second cell'); $cell22->addText('second cell');
@ -99,6 +99,11 @@ class ElementTest extends \PHPUnit\Framework\TestCase
$this->assertTrue($xpath->query('/html/body/table/tr[1]/td')->length == 1); $this->assertTrue($xpath->query('/html/body/table/tr[1]/td')->length == 1);
$this->assertEquals('2', $xpath->query('/html/body/table/tr/td[1]')->item(0)->attributes->getNamedItem('colspan')->textContent); $this->assertEquals('2', $xpath->query('/html/body/table/tr/td[1]')->item(0)->attributes->getNamedItem('colspan')->textContent);
$this->assertTrue($xpath->query('/html/body/table/tr[2]/td')->length == 2); $this->assertTrue($xpath->query('/html/body/table/tr[2]/td')->length == 2);
$this->assertEquals('#6086B8', $xpath->query('/html/body/table/tr[1]/td')->item(0)->attributes->getNamedItem('bgcolor')->textContent);
$this->assertEquals('#ffffff', $xpath->query('/html/body/table/tr[1]/td')->item(0)->attributes->getNamedItem('color')->textContent);
$this->assertEquals('#ffffff', $xpath->query('/html/body/table/tr[2]/td')->item(0)->attributes->getNamedItem('bgcolor')->textContent);
$this->assertNull($xpath->query('/html/body/table/tr[2]/td')->item(0)->attributes->getNamedItem('color'));
} }
/** /**