Skip to content

Commit 020a389

Browse files
authored
Core : DocumentLayout : Fixed error when using DocumentLayout::LAYOUT_CUSTOM (#811)
1 parent 3cae28b commit 020a389

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

docs/changes/1.1.0.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
- PowerPoint2007 Writer : Fixed broken animation for first shape - [@shannan1989](https://github.com/shannan1989) in [#783](https://github.com/PHPOffice/PHPPresentation/pull/783)
5252
- Samples : Allow to run without composer - [@pal-software](https://github.com/pal-software) in [#784](https://github.com/PHPOffice/PHPPresentation/pull/784)
5353
- PowerPoint2007 Writer: Extract relations from nested ShapeContainerInterface objects - [@DennisBirkholz](https://github.com/DennisBirkholz) in [#785](https://github.com/PHPOffice/PHPPresentation/pull/785)
54-
- General : Fixed copying bug when presentation had multiple slides [@dees040](https://github.com/dees040) in [#786](https://github.com/PHPOffice/PHPPresentation/pull/786)
54+
- Core : Fixed copying bug when presentation had multiple slides [@dees040](https://github.com/dees040) in [#786](https://github.com/PHPOffice/PHPPresentation/pull/786)
55+
- 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)
5556

5657
## Miscellaneous
5758

src/PhpPresentation/DocumentLayout.php

+3
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ public function setDocumentLayout($pValue = self::LAYOUT_SCREEN_4X3, $isLandscap
133133

134134
break;
135135
case self::LAYOUT_CUSTOM:
136+
$this->layout = self::LAYOUT_CUSTOM;
137+
138+
break;
136139
default:
137140
$this->layout = self::LAYOUT_CUSTOM;
138141
$this->dimensionX = $pValue['cx'];

tests/PhpPresentation/Tests/DocumentLayoutTest.php

+18
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,24 @@ public function testSetCustomLayout(): void
5757
self::assertEquals(9144000, $object->getCY());
5858
}
5959

60+
/**
61+
* Test set custom layout.
62+
*/
63+
public function testSetCustomLayoutWithString(): void
64+
{
65+
$object = new DocumentLayout();
66+
$object->setDocumentLayout(DocumentLayout::LAYOUT_CUSTOM);
67+
self::assertEquals(DocumentLayout::LAYOUT_CUSTOM, $object->getDocumentLayout());
68+
// Default value
69+
self::assertEquals(9144000, $object->getCX());
70+
self::assertEquals(6858000, $object->getCY());
71+
72+
$object->setCX(13.333, DocumentLayout::UNIT_CENTIMETER);
73+
$object->setCY(7.5, DocumentLayout::UNIT_CENTIMETER);
74+
self::assertEquals(4799880, $object->getCX());
75+
self::assertEquals(2700000, $object->getCY());
76+
}
77+
6078
public function testCX(): void
6179
{
6280
$value = mt_rand(1, 100000);

0 commit comments

Comments
 (0)