mirror of
https://github.com/Intervention/image.git
synced 2025-08-11 16:34:00 +02:00
fixed bug in imagick version of trim command
This commit is contained in:
@@ -111,6 +111,7 @@ class TrimCommand extends \Intervention\Image\Commands\AbstractCommand
|
|||||||
|
|
||||||
// finally crop based on page
|
// finally crop based on page
|
||||||
$image->getCore()->cropImage($crop_width, $crop_height, $crop_x, $crop_y);
|
$image->getCore()->cropImage($crop_width, $crop_height, $crop_x, $crop_y);
|
||||||
|
$image->getCore()->setImagePage(0,0,0,0);
|
||||||
|
|
||||||
$trimed->destroy();
|
$trimed->destroy();
|
||||||
|
|
||||||
|
@@ -39,12 +39,13 @@ class TrimCommandTest extends PHPUnit_Framework_TestCase
|
|||||||
$imagick->shouldReceive('trimimage')->with(29632.5)->once()->andReturn(true);
|
$imagick->shouldReceive('trimimage')->with(29632.5)->once()->andReturn(true);
|
||||||
$imagick->shouldReceive('getimagepage')->once()->andReturn(array('x' => 50, 'y' => 50));
|
$imagick->shouldReceive('getimagepage')->once()->andReturn(array('x' => 50, 'y' => 50));
|
||||||
$imagick->shouldReceive('cropimage')->with(104, 202, 47, 0)->once()->andReturn(true);
|
$imagick->shouldReceive('cropimage')->with(104, 202, 47, 0)->once()->andReturn(true);
|
||||||
|
$imagick->shouldReceive('setimagepage')->with(0, 0, 0, 0)->once()->andReturn(true);
|
||||||
$imagick->shouldReceive('destroy')->with()->once()->andReturn(true);
|
$imagick->shouldReceive('destroy')->with()->once()->andReturn(true);
|
||||||
$image = Mockery::mock('Intervention\Image\Image');
|
$image = Mockery::mock('Intervention\Image\Image');
|
||||||
$image->shouldReceive('getWidth')->once()->andReturn(800);
|
$image->shouldReceive('getWidth')->once()->andReturn(800);
|
||||||
$image->shouldReceive('getHeight')->once()->andReturn(600);
|
$image->shouldReceive('getHeight')->once()->andReturn(600);
|
||||||
$image->shouldReceive('pickColor')->with(0, 0, 'object')->once()->andReturn($baseColor);
|
$image->shouldReceive('pickColor')->with(0, 0, 'object')->once()->andReturn($baseColor);
|
||||||
$image->shouldReceive('getCore')->times(2)->andReturn($imagick);
|
$image->shouldReceive('getCore')->times(3)->andReturn($imagick);
|
||||||
$command = new TrimImagick(array('top-left', array('left', 'right'), 45, 2));
|
$command = new TrimImagick(array('top-left', array('left', 'right'), 45, 2));
|
||||||
$result = $command->execute($image);
|
$result = $command->execute($image);
|
||||||
$this->assertTrue($result);
|
$this->assertTrue($result);
|
||||||
|
Reference in New Issue
Block a user