Esempio n. 1
0
 /**
  * Test get/set fill type
  */
 public function testSetGetFillType()
 {
     $object = new Fill();
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->setFillType());
     $this->assertEquals(Fill::FILL_NONE, $object->getFillType());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Style\\Fill', $object->setFillType(Fill::FILL_GRADIENT_LINEAR));
     $this->assertEquals(Fill::FILL_GRADIENT_LINEAR, $object->getFillType());
 }
 /**
  * Write Fill
  *
  * @param  \PhpOffice\Common\XMLWriter $objWriter XML Writer
  * @param  \PhpOffice\PhpPresentation\Style\Fill       $pFill     Fill style
  * @throws \Exception
  */
 protected function writeFill(XMLWriter $objWriter, $pFill)
 {
     if (!$pFill instanceof Fill) {
         return;
     }
     // 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);
     }
 }