1
0
mirror of https://github.com/Intervention/image.git synced 2025-01-17 04:08:14 +01:00

fixed bug in imagick version of trim command

This commit is contained in:
Oliver Vogel 2014-06-08 15:59:04 +02:00
parent a17342106a
commit e95c4f2f8a
2 changed files with 3 additions and 1 deletions

View File

@ -111,6 +111,7 @@ class TrimCommand extends \Intervention\Image\Commands\AbstractCommand
// finally crop based on page
$image->getCore()->cropImage($crop_width, $crop_height, $crop_x, $crop_y);
$image->getCore()->setImagePage(0,0,0,0);
$trimed->destroy();

View File

@ -39,12 +39,13 @@ class TrimCommandTest extends PHPUnit_Framework_TestCase
$imagick->shouldReceive('trimimage')->with(29632.5)->once()->andReturn(true);
$imagick->shouldReceive('getimagepage')->once()->andReturn(array('x' => 50, 'y' => 50));
$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);
$image = Mockery::mock('Intervention\Image\Image');
$image->shouldReceive('getWidth')->once()->andReturn(800);
$image->shouldReceive('getHeight')->once()->andReturn(600);
$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));
$result = $command->execute($image);
$this->assertTrue($result);