From f3e0708bd146089c172dab1770a46af754c68ba8 Mon Sep 17 00:00:00 2001 From: Oliver Vogel Date: Sun, 17 Dec 2023 17:03:42 +0100 Subject: [PATCH] Add auto encode tests --- tests/Drivers/Gd/ImageTest.php | 11 +++++++---- tests/Drivers/Imagick/ImageTest.php | 12 +++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/tests/Drivers/Gd/ImageTest.php b/tests/Drivers/Gd/ImageTest.php index 94c87b0d..d911a7ad 100644 --- a/tests/Drivers/Gd/ImageTest.php +++ b/tests/Drivers/Gd/ImageTest.php @@ -4,10 +4,6 @@ namespace Intervention\Image\Tests\Drivers\Gd; use Intervention\Image\Analyzers\WidthAnalyzer; use Intervention\Image\Collection; -use Intervention\Image\Colors\Rgb\Channels\Alpha; -use Intervention\Image\Colors\Rgb\Channels\Blue; -use Intervention\Image\Colors\Rgb\Channels\Green; -use Intervention\Image\Colors\Rgb\Channels\Red; use Intervention\Image\Drivers\Gd\Core; use Intervention\Image\Drivers\Gd\Driver; use Intervention\Image\Drivers\Gd\Frame; @@ -119,6 +115,13 @@ class ImageTest extends TestCase $this->assertInstanceOf(EncodedImage::class, $result); } + public function testAutoEncode(): void + { + $result = $this->readTestImage('blue.gif')->encode(); + $this->assertInstanceOf(EncodedImage::class, $result); + $this->assertMediaType('image/gif', (string) $result); + } + public function testWidthHeightSize(): void { $this->assertEquals(3, $this->image->width()); diff --git a/tests/Drivers/Imagick/ImageTest.php b/tests/Drivers/Imagick/ImageTest.php index 52247780..1845f085 100644 --- a/tests/Drivers/Imagick/ImageTest.php +++ b/tests/Drivers/Imagick/ImageTest.php @@ -3,11 +3,6 @@ namespace Intervention\Image\Tests\Drivers\Imagick; use Imagick; -use ImagickPixel; -use Intervention\Image\Colors\Rgb\Channels\Alpha; -use Intervention\Image\Colors\Rgb\Channels\Blue; -use Intervention\Image\Colors\Rgb\Channels\Green; -use Intervention\Image\Colors\Rgb\Channels\Red; use Intervention\Image\Analyzers\WidthAnalyzer; use Intervention\Image\Collection; use Intervention\Image\Drivers\Imagick\Core; @@ -119,6 +114,13 @@ class ImageTest extends TestCase $this->assertInstanceOf(EncodedImage::class, $result); } + public function testAutoEncode(): void + { + $result = $this->readTestImage('blue.gif')->encode(); + $this->assertInstanceOf(EncodedImage::class, $result); + $this->assertMediaType('image/gif', (string) $result); + } + public function testWidthHeightSize(): void { $this->assertEquals(20, $this->image->width());