1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-23 22:12:51 +02:00
Files
intervention_image/tests/Unit/Drivers/Gd/Modifiers/RemoveAnimationModifierTest.php
Oliver Vogel ca067a8fbb Add tests
2024-12-28 10:15:24 +01:00

52 lines
1.8 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\Exceptions\InputException;
use Intervention\Image\Modifiers\RemoveAnimationModifier;
use Intervention\Image\Tests\GdTestCase;
#[RequiresPhpExtension('gd')]
#[CoversClass(\Intervention\Image\Modifiers\RemoveAnimationModifier::class)]
#[CoversClass(\Intervention\Image\Drivers\Gd\Modifiers\RemoveAnimationModifier::class)]
final class RemoveAnimationModifierTest extends GdTestCase
{
public function testApply(): void
{
$image = $this->readTestImage('animation.gif');
$this->assertEquals(8, count($image));
$result = $image->modify(new RemoveAnimationModifier(2));
$this->assertEquals(1, count($image));
$this->assertEquals(1, count($result));
}
public function testApplyPercent(): void
{
$image = $this->readTestImage('animation.gif');
$this->assertEquals(8, count($image));
$result = $image->modify(new RemoveAnimationModifier('20%'));
$this->assertEquals(1, count($image));
$this->assertEquals(1, count($result));
}
public function testApplyNonAnimated(): void
{
$image = $this->readTestImage('test.jpg');
$this->assertEquals(1, count($image));
$result = $image->modify(new RemoveAnimationModifier());
$this->assertEquals(1, count($image));
$this->assertEquals(1, count($result));
}
public function testApplyInvalid(): void
{
$image = $this->readTestImage('animation.gif');
$this->expectException(InputException::class);
$image->modify(new RemoveAnimationModifier('test'));
}
}