1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-19 04:01:30 +02:00

Add tests for DrawLineModifier

This commit is contained in:
Oliver Vogel
2022-08-12 17:38:47 +02:00
parent b5ae8a2723
commit 71e94564a1
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\DrawLineModifier;
use Intervention\Image\Geometry\Line;
use Intervention\Image\Geometry\Point;
use Intervention\Image\Tests\TestCase;
use Intervention\Image\Tests\Traits\CanCreateGdTestImage;
/**
* @requires extension gd
* @covers \Intervention\Image\Drivers\Gd\Modifiers\DrawRectangleModifier
*/
class DrawLineModifierTest extends TestCase
{
use CanCreateGdTestImage;
public function testApply(): void
{
$image = $this->createTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
$line = new Line(new Point(0, 0), new Point(10, 0), 4);
$line->background('b53517');
$image->modify(new DrawLineModifier(new Point(0, 0), $line));
$this->assertEquals('b53517', $image->pickColor(0, 0)->toHex());
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace Intervention\Image\Tests\Drivers\Imagick\Modifiers;
use Intervention\Image\Drivers\Imagick\Modifiers\DrawLineModifier;
use Intervention\Image\Geometry\Line;
use Intervention\Image\Geometry\Point;
use Intervention\Image\Tests\TestCase;
use Intervention\Image\Tests\Traits\CanCreateImagickTestImage;
class DrawLineModifierTest extends TestCase
{
use CanCreateImagickTestImage;
public function testApply(): void
{
$image = $this->createTestImage('trim.png');
$this->assertEquals('00aef0', $image->pickColor(14, 14)->toHex());
$line = new Line(new Point(0, 0), new Point(10, 0), 4);
$line->background('b53517');
$image->modify(new DrawLineModifier(new Point(0, 0), $line));
$this->assertEquals('b53517', $image->pickColor(0, 0)->toHex());
}
}