1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-16 10:54:02 +02:00

Add BinaryImageDecoderTest for Imagick driver

This commit is contained in:
Oliver Vogel
2022-06-15 10:00:33 +02:00
parent 7433c123d5
commit a8fa90cde9

View 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);
}
}