Skip to content

Commit

Permalink
Fix return value of Imagick\Drawer::rectangle()
Browse files Browse the repository at this point in the history
  • Loading branch information
mlocati committed Sep 4, 2018
1 parent 4c14cf3 commit 836ec2b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/Imagick/Drawer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
10 changes: 6 additions & 4 deletions tests/Imagine/Test/Draw/AbstractDrawerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 836ec2b

Please sign in to comment.