Ejemplo n.º 1
0
 public function testCustomDocumentLayout()
 {
     $oPhpPresentation = new PhpPresentation();
     $oDocumentLayout = new DocumentLayout();
     $oDocumentLayout->setDocumentLayout(array('cx' => rand(1, 100), 'cy' => rand(1, 100)));
     $oPhpPresentation->setLayout($oDocumentLayout);
     $pres = TestHelperDOCX::getDocument($oPhpPresentation, 'ODPresentation');
     $element = "/office:document-styles/office:automatic-styles/style:page-layout";
     $this->assertTrue($pres->elementExists($element, 'styles.xml'));
     $this->assertEquals('sPL0', $pres->getElementAttribute($element, 'style:name', 'styles.xml'));
     $element = "/office:document-styles/office:master-styles/style:master-page";
     $this->assertTrue($pres->elementExists($element, 'styles.xml'));
     $this->assertEquals('sPL0', $pres->getElementAttribute($element, 'style:page-layout-name', 'styles.xml'));
 }
Ejemplo n.º 2
0
 public function testCY()
 {
     $value = rand(1, 100000);
     $object = new DocumentLayout();
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value));
     $this->assertEquals($value, $object->getCY());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_CENTIMETER));
     $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_CENTIMETER));
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_EMU));
     $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_EMU));
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_INCH));
     $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_INCH));
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_MILLIMETER));
     $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_MILLIMETER));
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_POINT));
     $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_POINT));
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCY($value, DocumentLayout::UNIT_PIXEL));
     $this->assertEquals($value, $object->getCY(DocumentLayout::UNIT_PIXEL));
 }