mirror of
https://github.com/Intervention/image.git
synced 2025-08-17 11:20:44 +02:00
Add BinaryImageDecoderTest for Imagick driver
This commit is contained in:
40
tests/Drivers/Imagick/Decoders/BinaryImageDecoderTest.php
Normal file
40
tests/Drivers/Imagick/Decoders/BinaryImageDecoderTest.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Intervention\Image\Tests\Drivers\Imagick\Decoders;
|
||||||
|
|
||||||
|
use Intervention\Image\Drivers\Imagick\Decoders\BinaryImageDecoder;
|
||||||
|
use Intervention\Image\Drivers\Imagick\Image;
|
||||||
|
use Intervention\Image\Tests\TestCase;
|
||||||
|
|
||||||
|
class BinaryImageDecoderTest extends TestCase
|
||||||
|
{
|
||||||
|
public function testDecodePng(): void
|
||||||
|
{
|
||||||
|
$decoder = new BinaryImageDecoder();
|
||||||
|
$image = $decoder->decode(file_get_contents(__DIR__ . '/../../../images/tile.png'));
|
||||||
|
$this->assertInstanceOf(Image::class, $image);
|
||||||
|
$this->assertEquals(16, $image->getWidth());
|
||||||
|
$this->assertEquals(16, $image->getHeight());
|
||||||
|
$this->assertCount(1, $image);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testDecodeGif(): void
|
||||||
|
{
|
||||||
|
$decoder = new BinaryImageDecoder();
|
||||||
|
$image = $decoder->decode(file_get_contents(__DIR__ . '/../../../images/red.gif'));
|
||||||
|
$this->assertInstanceOf(Image::class, $image);
|
||||||
|
$this->assertEquals(16, $image->getWidth());
|
||||||
|
$this->assertEquals(16, $image->getHeight());
|
||||||
|
$this->assertCount(1, $image);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testDecodeAnimatedGif(): void
|
||||||
|
{
|
||||||
|
$decoder = new BinaryImageDecoder();
|
||||||
|
$image = $decoder->decode(file_get_contents(__DIR__ . '/../../../images/cats.gif'));
|
||||||
|
$this->assertInstanceOf(Image::class, $image);
|
||||||
|
$this->assertEquals(75, $image->getWidth());
|
||||||
|
$this->assertEquals(50, $image->getHeight());
|
||||||
|
$this->assertCount(4, $image);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user