public function testShape() { $oStub = $this->getMockForAbstractClass('PhpOffice\\PhpPresentation\\AbstractShape'); $object = new Animation(); $this->assertInternalType('array', $object->getShapeCollection()); $this->assertCount(0, $object->getShapeCollection()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Animation', $object->addShape($oStub)); $this->assertInternalType('array', $object->getShapeCollection()); $this->assertCount(1, $object->getShapeCollection()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Animation', $object->setShapeCollection()); $this->assertInternalType('array', $object->getShapeCollection()); $this->assertCount(0, $object->getShapeCollection()); $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Slide\\Animation', $object->setShapeCollection(array($oStub))); $this->assertInternalType('array', $object->getShapeCollection()); $this->assertCount(1, $object->getShapeCollection()); }
public function testAnimation() { $oPhpPresentation = new PhpPresentation(); $oSlide = $oPhpPresentation->getActiveSlide(); $oShape1 = $oSlide->createRichTextShape(); $oShape2 = $oSlide->createRichTextShape(); $oAnimation = new Animation(); $oAnimation->addShape($oShape1); $oAnimation->addShape($oShape2); $oSlide->addAnimation($oAnimation); $oXMLDoc = TestHelperDOCX::getDocument($oPhpPresentation, 'PowerPoint2007'); $element = '/p:sld/p:timing'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/slides/slide1.xml')); $element = '/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/slides/slide1.xml')); $element = '/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par'; $this->assertTrue($oXMLDoc->elementExists($element, 'ppt/slides/slide1.xml')); }
$oAnimation1 = new Animation(); $oAnimation1->addShape($oDrawing1); $oSlide1->addAnimation($oAnimation1); $oAnimation2 = new Animation(); $oAnimation2->addShape($oRichText1); $oSlide1->addAnimation($oAnimation2); $oDrawing2 = clone $oShapeDrawing; $oRichText2 = clone $oShapeRichText; $oSlide2 = $objPHPPresentation->createSlide(); $oSlide2->addShape($oDrawing2); $oSlide2->addShape($oRichText2); $oAnimation4 = new Animation(); $oAnimation4->addShape($oRichText2); $oSlide2->addAnimation($oAnimation4); $oAnimation3 = new Animation(); $oAnimation3->addShape($oDrawing2); $oSlide2->addAnimation($oAnimation3); $oDrawing3 = clone $oShapeDrawing; $oRichText3 = clone $oShapeRichText; $oSlide3 = $objPHPPresentation->createSlide(); $oSlide3->addShape($oDrawing3); $oSlide3->addShape($oRichText3); $oAnimation5 = new Animation(); $oAnimation5->addShape($oRichText3); $oAnimation5->addShape($oDrawing3); $oSlide3->addAnimation($oAnimation5); // Save file echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers); if (!CLI) { include_once 'Sample_Footer.php'; }