Skip to content

Commit

Permalink
Add auto encode tests
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Dec 17, 2023
1 parent c594ed1 commit f3e0708
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
11 changes: 7 additions & 4 deletions tests/Drivers/Gd/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

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;
Expand Down Expand Up @@ -119,6 +115,13 @@ public function testEncode(): void
$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());
Expand Down
12 changes: 7 additions & 5 deletions tests/Drivers/Imagick/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -119,6 +114,13 @@ public function testEncode(): void
$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());
Expand Down

0 comments on commit f3e0708

Please sign in to comment.