PptViewP 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace PhpPresentation\Tests\Writer\PowerPoint2007;
  3. use PhpOffice\PhpPresentation\PresentationProperties;
  4. use PhpOffice\PhpPresentation\Tests\PhpPresentationTestCase;
  5. class PptViewPropsTest extends PhpPresentationTestCase
  6. {
  7. protected $writerName = 'PowerPoint2007';
  8. public function testRender()
  9. {
  10. $expectedElement = '/p:viewPr';
  11. $this->assertZipFileExists('ppt/viewProps.xml');
  12. $this->assertZipXmlElementExists('ppt/viewProps.xml', $expectedElement);
  13. $this->assertZipXmlAttributeEquals('ppt/viewProps.xml', $expectedElement, 'showComments', 0);
  14. $this->assertZipXmlAttributeEquals('ppt/viewProps.xml', $expectedElement, 'lastView', PresentationProperties::VIEW_SLIDE);
  15. }
  16. public function testCommentVisible()
  17. {
  18. $expectedElement ='/p:viewPr';
  19. $this->oPresentation->getPresentationProperties()->setCommentVisible(true);
  20. $this->assertZipFileExists('ppt/viewProps.xml');
  21. $this->assertZipXmlElementExists('ppt/viewProps.xml', $expectedElement);
  22. $this->assertZipXmlAttributeEquals('ppt/viewProps.xml', $expectedElement, 'showComments', 1);
  23. }
  24. public function testLastView()
  25. {
  26. $expectedElement ='/p:viewPr';
  27. $expectedLastView = PresentationProperties::VIEW_OUTLINE;
  28. $this->oPresentation->getPresentationProperties()->setLastView($expectedLastView);
  29. $this->assertZipFileExists('ppt/viewProps.xml');
  30. $this->assertZipXmlElementExists('ppt/viewProps.xml', $expectedElement);
  31. $this->assertZipXmlAttributeEquals('ppt/viewProps.xml', $expectedElement, 'lastView', $expectedLastView);
  32. }
  33. }