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

more detailed color test

This commit is contained in:
Oliver Vogel 2014-05-13 19:09:59 +02:00
parent 4878b6003e
commit eb37dee6f0

View File

@ -836,16 +836,10 @@ class ImagickSystemTest extends PHPUnit_Framework_TestCase
$img->mask('tests/images/gradient.png'); $img->mask('tests/images/gradient.png');
$this->assertTransparentPosition($img, 0, 0); $this->assertTransparentPosition($img, 0, 0);
$this->assertTransparentPosition($img, 23, 23); $this->assertTransparentPosition($img, 23, 23);
$checkColor = $img->pickColor(23, 24, 'array'); $c = $img->getCore()->getImagePixelColor(23, 24)->getColorAsString();
$this->assertEquals($checkColor[0], 255); $this->assertEquals('srgba(255,166,1,0.972549)', $c);
$this->assertEquals($checkColor[1], 166); $c = $img->getCore()->getImagePixelColor(39, 25)->getColorAsString();
$this->assertEquals($checkColor[2], 1); $this->assertEquals('srgba(0,174,240,0.333333)', $c);
$this->assertEquals($checkColor[3], 0.97);
$checkColor = $img->pickColor(39, 25, 'array');
$this->assertEquals($checkColor[0], 0);
$this->assertEquals($checkColor[1], 174);
$this->assertEquals($checkColor[2], 240);
$this->assertEquals($checkColor[3], 0.33);
} }
public function testMaskImageWithAlpha() public function testMaskImageWithAlpha()
@ -854,16 +848,10 @@ class ImagickSystemTest extends PHPUnit_Framework_TestCase
$img->mask('tests/images/star.png', true); $img->mask('tests/images/star.png', true);
$this->assertTransparentPosition($img, 0, 0); $this->assertTransparentPosition($img, 0, 0);
$this->assertTransparentPosition($img, 16, 16); $this->assertTransparentPosition($img, 16, 16);
$checkColor = $img->pickColor(18, 18, 'array'); $c = $img->getCore()->getImagePixelColor(18, 18)->getColorAsString();
$this->assertEquals($checkColor[0], 255); $this->assertEquals('srgba(255,166,1,0.466667)', $c);
$this->assertEquals($checkColor[1], 166); $c = $img->getCore()->getImagePixelColor(24, 10)->getColorAsString();
$this->assertEquals($checkColor[2], 1); $this->assertEquals('srgba(0,174,240,0.776471)', $c);
$this->assertEquals($checkColor[3], 0.47);
$checkColor = $img->pickColor(24, 10, 'array');
$this->assertEquals($checkColor[0], 0);
$this->assertEquals($checkColor[1], 174);
$this->assertEquals($checkColor[2], 240);
$this->assertEquals($checkColor[3], 0.78);
} }
public function testPixelateImage() public function testPixelateImage()