mirror of
https://github.com/Intervention/image.git
synced 2025-08-29 16:50:07 +02:00
Add test for DrawPolygonModifiers
This commit is contained in:
28
tests/Drivers/Gd/Modifiers/DrawPolygonModifierTest.php
Normal file
28
tests/Drivers/Gd/Modifiers/DrawPolygonModifierTest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Intervention\Image\Tests\Drivers\Gd\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\Gd\Modifiers\DrawPolygonModifier;
|
||||
use Intervention\Image\Geometry\Point;
|
||||
use Intervention\Image\Geometry\Polygon;
|
||||
use Intervention\Image\Tests\TestCase;
|
||||
use Intervention\Image\Tests\Traits\CanCreateGdTestImage;
|
||||
|
||||
/**
|
||||
* @requires extension gd
|
||||
* @covers \Intervention\Image\Drivers\Gd\Modifiers\DrawPixelModifier
|
||||
*/
|
||||
class DrawPolygonModifierTest extends TestCase
|
||||
{
|
||||
use CanCreateGdTestImage;
|
||||
|
||||
public function testApply(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
|
||||
$drawable = new Polygon([new Point(0, 0), new Point(15, 15), new Point(20, 20)]);
|
||||
$drawable->background('b53717');
|
||||
$image->modify(new DrawPolygonModifier($drawable));
|
||||
$this->assertEquals('b53717', $image->pickColor(14, 14)->toHex());
|
||||
}
|
||||
}
|
24
tests/Drivers/Imagick/Modifiers/DrawPolygonModifierTest.php
Normal file
24
tests/Drivers/Imagick/Modifiers/DrawPolygonModifierTest.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Intervention\Image\Tests\Drivers\Imagick\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\Imagick\Modifiers\DrawPolygonModifier;
|
||||
use Intervention\Image\Geometry\Point;
|
||||
use Intervention\Image\Geometry\Polygon;
|
||||
use Intervention\Image\Tests\TestCase;
|
||||
use Intervention\Image\Tests\Traits\CanCreateImagickTestImage;
|
||||
|
||||
class DrawPolygonModifierTest extends TestCase
|
||||
{
|
||||
use CanCreateImagickTestImage;
|
||||
|
||||
public function testApply(): void
|
||||
{
|
||||
$image = $this->createTestImage('trim.png');
|
||||
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
|
||||
$drawable = new Polygon([new Point(0, 0), new Point(15, 15), new Point(20, 20)]);
|
||||
$drawable->background('b53717');
|
||||
$image->modify(new DrawPolygonModifier($drawable));
|
||||
$this->assertEquals('b53717', $image->pickColor(14, 14)->toHex());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user