1
0
mirror of https://github.com/Intervention/image.git synced 2025-01-17 20:28:21 +01:00

Add PadModifier tests

This commit is contained in:
Oliver Vogel 2023-12-02 16:07:27 +01:00
parent 714f514250
commit 84d2aaad76
2 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,29 @@
<?php
namespace Intervention\Image\Tests\Drivers\Gd\Modifiers;
use Intervention\Image\Modifiers\PadModifier;
use Intervention\Image\Tests\TestCase;
use Intervention\Image\Tests\Traits\CanCreateGdTestImage;
/**
* @requires extension imagick
* @covers \Intervention\Image\Modifiers\PadModifier
*/
class PadModifierTest extends TestCase
{
use CanCreateGdTestImage;
public function testModify(): void
{
$image = $this->createTestImage('blocks.png');
$this->assertEquals(640, $image->width());
$this->assertEquals(480, $image->height());
$image->modify(new PadModifier(200, 100, 'ff0'));
$this->assertEquals(200, $image->width());
$this->assertEquals(100, $image->height());
$this->assertColor(255, 255, 0, 255, $image->pickColor(0, 0));
$this->assertColor(255, 0, 255, 0, $image->pickColor(140, 10));
$this->assertColor(255, 255, 0, 255, $image->pickColor(175, 10));
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace Intervention\Image\Tests\Drivers\Imagick\Modifiers;
use Intervention\Image\Modifiers\PadModifier;
use Intervention\Image\Tests\TestCase;
use Intervention\Image\Tests\Traits\CanCreateImagickTestImage;
/**
* @requires extension imagick
* @covers \Intervention\Image\Modifiers\PadModifier
*/
class PadModifierTest extends TestCase
{
use CanCreateImagickTestImage;
public function testModify(): void
{
$image = $this->createTestImage('blocks.png');
$this->assertEquals(640, $image->width());
$this->assertEquals(480, $image->height());
$image->modify(new PadModifier(200, 100, 'ff0'));
$this->assertEquals(200, $image->width());
$this->assertEquals(100, $image->height());
$this->assertColor(255, 255, 0, 255, $image->pickColor(0, 0));
$this->assertColor(255, 0, 255, 0, $image->pickColor(140, 10));
$this->assertColor(255, 255, 0, 255, $image->pickColor(175, 10));
}
}