コード例 #1
0
ファイル: ColorTest.php プロジェクト: presclark/PHPPowerPoint
 /**
  * Test get/set RGB
  */
 public function testSetGetRGB()
 {
     $object = new Color();
     $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Color', $object->setRGB());
     $this->assertEquals('000000', $object->getRGB());
     $this->assertEquals('FF000000', $object->getARGB());
     $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Color', $object->setRGB(''));
     $this->assertEquals('000000', $object->getRGB());
     $this->assertEquals('FF000000', $object->getARGB());
     $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Color', $object->setRGB('555'));
     $this->assertEquals('555', $object->getRGB());
     $this->assertEquals('FF555', $object->getARGB());
     $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Color', $object->setRGB('6666'));
     $this->assertEquals('FF6666', $object->getRGB());
     $this->assertEquals('FF6666', $object->getARGB());
 }
コード例 #2
0
 public function testTableCellFill()
 {
     $oColor = new Color();
     $oColor->setRGB(Color::COLOR_BLUE);
     $oFill = new Fill();
     $oFill->setFillType(Fill::FILL_SOLID)->setStartColor($oColor);
     $phpPowerPoint = new PhpPowerpoint();
     $oSlide = $phpPowerPoint->getActiveSlide();
     $oShape = $oSlide->createTableShape();
     $oRow = $oShape->createRow();
     $oCell = $oRow->getCell();
     $oCell->setFill($oFill);
     $pres = TestHelperDOCX::getDocument($phpPowerPoint, 'ODPresentation');
     $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'gr1r0c0\']';
     $this->assertTrue($pres->elementExists($element, 'content.xml'));
     $this->assertEquals('table-cell', $pres->getElementAttribute($element, 'style:family', 'content.xml'));
     $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'gr1r0c0\']/style:graphic-properties';
     $this->assertTrue($pres->elementExists($element, 'content.xml'));
     $this->assertEquals('solid', $pres->getElementAttribute($element, 'draw:fill', 'content.xml'));
     $this->assertStringStartsWith('#', $pres->getElementAttribute($element, 'draw:fill-color', 'content.xml'));
     $this->assertStringEndsWith($oColor->getRGB(), $pres->getElementAttribute($element, 'draw:fill-color', 'content.xml'));
 }