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:
28
tests/Drivers/Gd/Modifiers/DrawLineModiferTest.php
Normal file
28
tests/Drivers/Gd/Modifiers/DrawLineModiferTest.php
Normal 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());
|
||||
}
|
||||
}
|
24
tests/Drivers/Imagick/Modifiers/DrawLineModifierTest.php
Normal file
24
tests/Drivers/Imagick/Modifiers/DrawLineModifierTest.php
Normal 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());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user