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:
parent
a17342106a
commit
e95c4f2f8a
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user