diff --git a/src/Imagick/Drawer.php b/src/Imagick/Drawer.php index 7ef9c5446..327928c5b 100644 --- a/src/Imagick/Drawer.php +++ b/src/Imagick/Drawer.php @@ -322,6 +322,8 @@ public function rectangle(PointInterface $leftTop, PointInterface $rightBottom, } catch (\ImagickException $e) { throw new RuntimeException('Draw rectangle operation failed', $e->getCode(), $e); } + + return $this; } /** diff --git a/tests/Imagine/Test/Draw/AbstractDrawerTest.php b/tests/Imagine/Test/Draw/AbstractDrawerTest.php index 5f2825042..da4384272 100644 --- a/tests/Imagine/Test/Draw/AbstractDrawerTest.php +++ b/tests/Imagine/Test/Draw/AbstractDrawerTest.php @@ -58,13 +58,14 @@ public function testDrawACircle($fill, $thickness) { $imagine = $this->getImagine(); $image = $imagine->create(new Box(15, 15), $this->getColor('fff')); - $image->draw()->circle( + $drawer = $image->draw(); + $this->assertSame($drawer, $drawer->circle( new Point(7, 7), 6, $this->getColor('f00'), $fill, $thickness - ); + )); $expected = $imagine->open('tests/Imagine/Fixtures/drawer/circle/thinkness' . $thickness . '-filled' . ($fill ? '1' : '0') . '.png'); $this->assertImageEquals($expected, $image, '', 0.107); } @@ -154,13 +155,14 @@ public function testDrawARectangle($fill, $thickness) { $imagine = $this->getImagine(); $image = $imagine->create(new Box(15, 15), $this->getColor('fff')); - $image->draw()->rectangle( + $drawer = $image->draw(); + $this->assertSame($drawer, $drawer->rectangle( new Point(2, 2), new Point(12, 12), $this->getColor('f00'), $fill, $thickness - ); + )); $expected = $imagine->open('tests/Imagine/Fixtures/drawer/rectangle/thinkness' . $thickness . '-filled' . ($fill ? '1' : '0') . '.png'); $this->assertImageEquals($expected, $image); }