diff --git a/docs/changes/1.1.0.md b/docs/changes/1.1.0.md index a1f87c9f7..d9ee1da48 100644 --- a/docs/changes/1.1.0.md +++ b/docs/changes/1.1.0.md @@ -51,7 +51,8 @@ - PowerPoint2007 Writer : Fixed broken animation for first shape - [@shannan1989](https://github.com/shannan1989) in [#783](https://github.com/PHPOffice/PHPPresentation/pull/783) - Samples : Allow to run without composer - [@pal-software](https://github.com/pal-software) in [#784](https://github.com/PHPOffice/PHPPresentation/pull/784) - PowerPoint2007 Writer: Extract relations from nested ShapeContainerInterface objects - [@DennisBirkholz](https://github.com/DennisBirkholz) in [#785](https://github.com/PHPOffice/PHPPresentation/pull/785) -- General : Fixed copying bug when presentation had multiple slides [@dees040](https://github.com/dees040) in [#786](https://github.com/PHPOffice/PHPPresentation/pull/786) +- Core : Fixed copying bug when presentation had multiple slides [@dees040](https://github.com/dees040) in [#786](https://github.com/PHPOffice/PHPPresentation/pull/786) +- Core : DocumentLayout : Fixed error when using DocumentLayout::LAYOUT_CUSTOM by [@jiangzhangchan](https://github.com/dees040) fixing [#722](https://github.com/PHPOffice/PHPPresentation/pull/722) in [#811](https://github.com/PHPOffice/PHPPresentation/pull/811) ## Miscellaneous diff --git a/src/PhpPresentation/DocumentLayout.php b/src/PhpPresentation/DocumentLayout.php index 12f0348b7..cc1deb510 100644 --- a/src/PhpPresentation/DocumentLayout.php +++ b/src/PhpPresentation/DocumentLayout.php @@ -133,6 +133,9 @@ public function setDocumentLayout($pValue = self::LAYOUT_SCREEN_4X3, $isLandscap break; case self::LAYOUT_CUSTOM: + $this->layout = self::LAYOUT_CUSTOM; + + break; default: $this->layout = self::LAYOUT_CUSTOM; $this->dimensionX = $pValue['cx']; diff --git a/tests/PhpPresentation/Tests/DocumentLayoutTest.php b/tests/PhpPresentation/Tests/DocumentLayoutTest.php index 58351938d..e5961edb5 100644 --- a/tests/PhpPresentation/Tests/DocumentLayoutTest.php +++ b/tests/PhpPresentation/Tests/DocumentLayoutTest.php @@ -57,6 +57,24 @@ public function testSetCustomLayout(): void self::assertEquals(9144000, $object->getCY()); } + /** + * Test set custom layout. + */ + public function testSetCustomLayoutWithString(): void + { + $object = new DocumentLayout(); + $object->setDocumentLayout(DocumentLayout::LAYOUT_CUSTOM); + self::assertEquals(DocumentLayout::LAYOUT_CUSTOM, $object->getDocumentLayout()); + // Default value + self::assertEquals(9144000, $object->getCX()); + self::assertEquals(6858000, $object->getCY()); + + $object->setCX(13.333, DocumentLayout::UNIT_CENTIMETER); + $object->setCY(7.5, DocumentLayout::UNIT_CENTIMETER); + self::assertEquals(4799880, $object->getCX()); + self::assertEquals(2700000, $object->getCY()); + } + public function testCX(): void { $value = mt_rand(1, 100000);