1
0
mirror of https://github.com/Intervention/image.git synced 2025-09-03 10:53:01 +02:00

added ico and psd write support for imagick driver

This commit is contained in:
Oliver Vogel
2014-11-05 17:45:28 +01:00
parent e626de028b
commit 8d0d2da878
4 changed files with 152 additions and 0 deletions

View File

@@ -58,6 +58,42 @@ class EncoderTest extends PHPUnit_Framework_TestCase
$this->assertInstanceOf('Intervention\Image\Image', $img);
}
/**
* @expectedException \Intervention\Image\Exception\NotSupportedException
*/
public function testProcessBmpGd()
{
$core = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
$encoder = new GdEncoder;
$image = Mockery::mock('\Intervention\Image\Image');
$img = $encoder->process($image, 'bmp', 90);
$this->assertInstanceOf('Intervention\Image\Image', $img);
}
/**
* @expectedException \Intervention\Image\Exception\NotSupportedException
*/
public function testProcessIcoGd()
{
$core = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
$encoder = new GdEncoder;
$image = Mockery::mock('\Intervention\Image\Image');
$img = $encoder->process($image, 'ico', 90);
$this->assertInstanceOf('Intervention\Image\Image', $img);
}
/**
* @expectedException \Intervention\Image\Exception\NotSupportedException
*/
public function testProcessPsdGd()
{
$core = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
$encoder = new GdEncoder;
$image = Mockery::mock('\Intervention\Image\Image');
$img = $encoder->process($image, 'psd', 90);
$this->assertInstanceOf('Intervention\Image\Image', $img);
}
public function testProcessUnknownWithMimeGd()
{
$core = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
@@ -131,6 +167,42 @@ class EncoderTest extends PHPUnit_Framework_TestCase
$this->assertEquals('mock-tiff', $encoder->result);
}
public function testProcessBmpImagick()
{
$core = $this->getImagickMock('bmp');
$encoder = new ImagickEncoder;
$image = Mockery::mock('\Intervention\Image\Image');
$image->shouldReceive('getCore')->once()->andReturn($core);
$image->shouldReceive('setEncoded')->once()->andReturn($image);
$img = $encoder->process($image, 'bmp', 90);
$this->assertInstanceOf('Intervention\Image\Image', $img);
$this->assertEquals('mock-bmp', $encoder->result);
}
public function testProcessIcoImagick()
{
$core = $this->getImagickMock('ico');
$encoder = new ImagickEncoder;
$image = Mockery::mock('\Intervention\Image\Image');
$image->shouldReceive('getCore')->once()->andReturn($core);
$image->shouldReceive('setEncoded')->once()->andReturn($image);
$img = $encoder->process($image, 'ico', 90);
$this->assertInstanceOf('Intervention\Image\Image', $img);
$this->assertEquals('mock-ico', $encoder->result);
}
public function testProcessPsdImagick()
{
$core = $this->getImagickMock('psd');
$encoder = new ImagickEncoder;
$image = Mockery::mock('\Intervention\Image\Image');
$image->shouldReceive('getCore')->once()->andReturn($core);
$image->shouldReceive('setEncoded')->once()->andReturn($image);
$img = $encoder->process($image, 'psd', 90);
$this->assertInstanceOf('Intervention\Image\Image', $img);
$this->assertEquals('mock-psd', $encoder->result);
}
public function testProcessUnknownWithMimeImagick()
{
$core = $this->getImagickMock('jpeg');