mirror of
https://github.com/Intervention/image.git
synced 2025-01-17 12:18:14 +01:00
Add PadModifier tests
This commit is contained in:
parent
714f514250
commit
84d2aaad76
29
tests/Drivers/Gd/Modifiers/PadModifierTest.php
Normal file
29
tests/Drivers/Gd/Modifiers/PadModifierTest.php
Normal 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));
|
||||
}
|
||||
}
|
29
tests/Drivers/Imagick/Modifiers/PadModifierTest.php
Normal file
29
tests/Drivers/Imagick/Modifiers/PadModifierTest.php
Normal 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));
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user