/** * Test get/set fill type */ public function testSetGetFillType() { $object = new Fill(); $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->setFillType()); $this->assertEquals(Fill::FILL_NONE, $object->getFillType()); $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Style\\Fill', $object->setFillType(Fill::FILL_GRADIENT_LINEAR)); $this->assertEquals(Fill::FILL_GRADIENT_LINEAR, $object->getFillType()); }
/** * Write Fill * * @param \PhpOffice\PhpPowerpoint\Shared\XMLWriter $objWriter XML Writer * @param \PhpOffice\PhpPowerpoint\Style\Fill $pFill Fill style * @throws \Exception */ protected function writeFill(XMLWriter $objWriter, Fill $pFill) { // Is it a fill? if ($pFill->getFillType() == Fill::FILL_NONE) { return; } // Is it a solid fill? if ($pFill->getFillType() == Fill::FILL_SOLID) { $this->writeSolidFill($objWriter, $pFill); return; } // Check if this is a pattern type or gradient type if ($pFill->getFillType() == Fill::FILL_GRADIENT_LINEAR || $pFill->getFillType() == Fill::FILL_GRADIENT_PATH) { // Gradient fill $this->writeGradientFill($objWriter, $pFill); } else { // Pattern fill $this->writePatternFill($objWriter, $pFill); } }