From d38a7cef79b44418c2fbebae92e224331a08ae64 Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Sun, 24 Mar 2024 11:37:11 +0100 Subject: [PATCH] Add tests for trimming animated images --- tests/Unit/Drivers/Gd/Modifiers/TrimModifierTest.php | 8 ++++++++ tests/Unit/Drivers/Imagick/Modifiers/TrimModifierTest.php | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/tests/Unit/Drivers/Gd/Modifiers/TrimModifierTest.php b/tests/Unit/Drivers/Gd/Modifiers/TrimModifierTest.php index d8c5efdf..c85c8c88 100644 --- a/tests/Unit/Drivers/Gd/Modifiers/TrimModifierTest.php +++ b/tests/Unit/Drivers/Gd/Modifiers/TrimModifierTest.php @@ -4,6 +4,7 @@ namespace Intervention\Image\Tests\Unit\Drivers\Gd\Modifiers; +use Intervention\Image\Exceptions\NotSupportedException; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use Intervention\Image\Modifiers\TrimModifier; @@ -44,4 +45,11 @@ public function testTrimHighTolerance(): void $this->assertEquals(1, $image->height()); $this->assertColor(255, 255, 255, 0, $image->pickColor(0, 0)); } + + public function testTrimAnimated(): void + { + $image = $this->readTestImage('animation.gif'); + $this->expectException(NotSupportedException::class); + $image->modify(new TrimModifier()); + } } diff --git a/tests/Unit/Drivers/Imagick/Modifiers/TrimModifierTest.php b/tests/Unit/Drivers/Imagick/Modifiers/TrimModifierTest.php index b881a7d0..cd2bafdd 100644 --- a/tests/Unit/Drivers/Imagick/Modifiers/TrimModifierTest.php +++ b/tests/Unit/Drivers/Imagick/Modifiers/TrimModifierTest.php @@ -4,6 +4,7 @@ namespace Intervention\Image\Tests\Unit\Drivers\Imagick\Modifiers; +use Intervention\Image\Exceptions\NotSupportedException; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use Intervention\Image\Modifiers\TrimModifier; @@ -44,4 +45,11 @@ public function testTrimHighTolerance(): void $this->assertEquals(1, $image->height()); $this->assertColor(255, 255, 255, 0, $image->pickColor(0, 0)); } + + public function testTrimAnimated(): void + { + $image = $this->readTestImage('animation.gif'); + $this->expectException(NotSupportedException::class); + $image->modify(new TrimModifier()); + } }