Skip to content

Commit b2a160d

Browse files
committed
Merge pull request #17 from cainmi/getCropPosition_test
Add test for getCropPosition added in 1c8af3 / #12
2 parents d972116 + d5bdc0b commit b2a160d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/Test.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,19 @@ public function testCrop() {
145145
$this->assertEquals(50, $resize->getDestHeight());
146146
}
147147

148+
public function testCropPosition() {
149+
$image = $this->createImage(200, 100, 'png');
150+
$resize = new ImageResize($image);
151+
152+
$resize->crop(50, 50, false, $resize::cropRIGHT);
153+
154+
$reflection_class = new ReflectionClass('\Eventviva\ImageResize');
155+
$source_x = $reflection_class->getProperty('source_x');
156+
$source_x->setAccessible(true);
157+
158+
$this->assertEquals(100, $source_x->getValue($resize));
159+
}
160+
148161
public function testCropLargerNotAllowed() {
149162
$image = $this->createImage(200, 100, 'png');
150163
$resize = new ImageResize($image);

0 commit comments

Comments
 (0)