Skip to content

Commit

Permalink
Add GD AVIF test
Browse files Browse the repository at this point in the history
  • Loading branch information
gijsdev committed Sep 15, 2021
1 parent 9a82306 commit a823bdc
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions tests/EncoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testProcessWebpGd()
$this->assertEquals('image/webp; charset=binary', $this->getMime($encoder->result));
}
}

public function testProcessWebpGdWithUnSupportedPalette()
{
if (function_exists('imagewebp')) {
Expand All @@ -75,17 +75,18 @@ public function testProcessWebpGdWithUnSupportedPalette()
}
}


/**
* @expectedException \Intervention\Image\Exception\NotSupportedException
*/
public function testProcessAvifGd()
{
$core = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
$encoder = new GdEncoder;
$image = Mockery::mock('\Intervention\Image\Image');
$img = $encoder->process($image, 'avif', 90);
$this->assertInstanceOf('Intervention\Image\Image', $img);
if (function_exists('imageavif')) {
$core = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
$encoder = new GdEncoder;
$image = Mockery::mock('\Intervention\Image\Image');
$image->shouldReceive('getCore')->once()->andReturn($core);
$image->shouldReceive('setEncoded')->once()->andReturn($image);
$img = $encoder->process($image, 'avif', 90);
$this->assertInstanceOf('Intervention\Image\Image', $img);
$this->assertEquals('image/avif; charset=binary', $this->getMime($encoder->result));
}
}

/**
Expand Down

0 comments on commit a823bdc

Please sign in to comment.