1
0
mirror of https://github.com/Intervention/image.git synced 2025-09-09 21:50:47 +02:00

added crop method

This commit is contained in:
Oliver Vogel
2013-02-28 17:35:28 +01:00
parent aa4f78b92f
commit fd29c19fde
3 changed files with 66 additions and 0 deletions

View File

@@ -107,6 +107,25 @@ class ImageTest extends PHPUnit_Framework_Testcase
$this->assertEquals($img->height, $original_height);
}
public function testCropImage()
{
$img = $this->getTestImage();
$img->crop(100, 100);
$this->assertInternalType('int', $img->width);
$this->assertInternalType('int', $img->height);
$this->assertEquals($img->width, 100);
$this->assertEquals($img->height, 100);
$this->assertEquals('#ffbe46', $img->pickColor(99, 99, 'hex'));
$img = $this->getTestImage();
$img->crop(100, 100, 650, 400);
$this->assertInternalType('int', $img->width);
$this->assertInternalType('int', $img->height);
$this->assertEquals($img->width, 100);
$this->assertEquals($img->height, 100);
$this->assertEquals('#ffa600', $img->pickColor(99, 99, 'hex'));
}
public function testLegacyResize()
{
// auto height