diff --git a/tests/Drivers/Gd/Decoders/BinaryImageDecoderTest.php b/tests/Drivers/Gd/Decoders/BinaryImageDecoderTest.php index 632f03634..f59f04961 100644 --- a/tests/Drivers/Gd/Decoders/BinaryImageDecoderTest.php +++ b/tests/Drivers/Gd/Decoders/BinaryImageDecoderTest.php @@ -15,7 +15,7 @@ class BinaryImageDecoderTest extends TestCase public function testDecodePng(): void { $decoder = new BinaryImageDecoder(); - $image = $decoder->decode(file_get_contents(__DIR__ . '/../../../images/tile.png')); + $image = $decoder->decode(file_get_contents($this->getTestImagePath('tile.png'))); $this->assertInstanceOf(Image::class, $image); $this->assertEquals(16, $image->getWidth()); $this->assertEquals(16, $image->getHeight()); @@ -25,7 +25,7 @@ public function testDecodePng(): void public function testDecodeGif(): void { $decoder = new BinaryImageDecoder(); - $image = $decoder->decode(file_get_contents(__DIR__ . '/../../../images/red.gif')); + $image = $decoder->decode(file_get_contents($this->getTestImagePath('red.gif'))); $this->assertInstanceOf(Image::class, $image); $this->assertEquals(16, $image->getWidth()); $this->assertEquals(16, $image->getHeight()); @@ -35,10 +35,21 @@ public function testDecodeGif(): void public function testDecodeAnimatedGif(): void { $decoder = new BinaryImageDecoder(); - $image = $decoder->decode(file_get_contents(__DIR__ . '/../../../images/cats.gif')); + $image = $decoder->decode(file_get_contents($this->getTestImagePath('cats.gif'))); $this->assertInstanceOf(Image::class, $image); $this->assertEquals(75, $image->getWidth()); $this->assertEquals(50, $image->getHeight()); $this->assertCount(4, $image); } + + public function testDecodeJpegWithExif(): void + { + $decoder = new BinaryImageDecoder(); + $image = $decoder->decode(file_get_contents($this->getTestImagePath('exif.jpg'))); + $this->assertInstanceOf(Image::class, $image); + $this->assertEquals(16, $image->getWidth()); + $this->assertEquals(16, $image->getHeight()); + $this->assertCount(1, $image); + $this->assertEquals('Oliver Vogel', $image->getExif('IFD0.Artist')); + } } diff --git a/tests/Drivers/Imagick/Decoders/BinaryImageDecoderTest.php b/tests/Drivers/Imagick/Decoders/BinaryImageDecoderTest.php index 455bdcc7b..b3d20b4a5 100644 --- a/tests/Drivers/Imagick/Decoders/BinaryImageDecoderTest.php +++ b/tests/Drivers/Imagick/Decoders/BinaryImageDecoderTest.php @@ -11,7 +11,7 @@ class BinaryImageDecoderTest extends TestCase public function testDecodePng(): void { $decoder = new BinaryImageDecoder(); - $image = $decoder->decode(file_get_contents(__DIR__ . '/../../../images/tile.png')); + $image = $decoder->decode(file_get_contents($this->getTestImagePath('tile.png'))); $this->assertInstanceOf(Image::class, $image); $this->assertEquals(16, $image->getWidth()); $this->assertEquals(16, $image->getHeight()); @@ -21,7 +21,7 @@ public function testDecodePng(): void public function testDecodeGif(): void { $decoder = new BinaryImageDecoder(); - $image = $decoder->decode(file_get_contents(__DIR__ . '/../../../images/red.gif')); + $image = $decoder->decode(file_get_contents($this->getTestImagePath('red.gif'))); $this->assertInstanceOf(Image::class, $image); $this->assertEquals(16, $image->getWidth()); $this->assertEquals(16, $image->getHeight()); @@ -31,10 +31,21 @@ public function testDecodeGif(): void public function testDecodeAnimatedGif(): void { $decoder = new BinaryImageDecoder(); - $image = $decoder->decode(file_get_contents(__DIR__ . '/../../../images/cats.gif')); + $image = $decoder->decode(file_get_contents($this->getTestImagePath('cats.gif'))); $this->assertInstanceOf(Image::class, $image); $this->assertEquals(75, $image->getWidth()); $this->assertEquals(50, $image->getHeight()); $this->assertCount(4, $image); } + + public function testDecodeJpegWithExif(): void + { + $decoder = new BinaryImageDecoder(); + $image = $decoder->decode(file_get_contents($this->getTestImagePath('exif.jpg'))); + $this->assertInstanceOf(Image::class, $image); + $this->assertEquals(16, $image->getWidth()); + $this->assertEquals(16, $image->getHeight()); + $this->assertCount(1, $image); + $this->assertEquals('Oliver Vogel', $image->getExif('IFD0.Artist')); + } } diff --git a/tests/images/exif.jpg b/tests/images/exif.jpg new file mode 100644 index 000000000..ab98706c2 Binary files /dev/null and b/tests/images/exif.jpg differ