1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-24 06:22:57 +02:00
Files
intervention_image/tests/Unit/Drivers/Gd/Modifiers/ContainModifierTest.php
2024-03-10 10:00:06 +01:00

30 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace Intervention\Image\Tests\Unit\Drivers\Gd\Modifiers;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use Intervention\Image\Modifiers\ContainModifier;
use Intervention\Image\Tests\GdTestCase;
#[RequiresPhpExtension('gd')]
#[CoversClass(\Intervention\Image\Modifiers\ContainModifier::class)]
#[CoversClass(\Intervention\Image\Drivers\Gd\Modifiers\ContainModifier::class)]
final class ContainModifierTest extends GdTestCase
{
public function testModify(): void
{
$image = $this->readTestImage('blocks.png');
$this->assertEquals(640, $image->width());
$this->assertEquals(480, $image->height());
$image->modify(new ContainModifier(200, 100, 'ff0'));
$this->assertEquals(200, $image->width());
$this->assertEquals(100, $image->height());
$this->assertColor(255, 255, 0, 255, $image->pickColor(0, 0));
$this->assertTransparency($image->pickColor(140, 10));
$this->assertColor(255, 255, 0, 255, $image->pickColor(175, 10));
}
}