1
0
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:
Oliver Vogel
2022-08-12 17:50:08 +02:00
parent fe05a1e35d
commit de1eb734b6
2 changed files with 52 additions and 0 deletions

View 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());
}
}

View 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());
}
}