:octocat: test GD RGB clamp

This commit is contained in:
codemasher
2018-11-10 19:29:12 +01:00
parent 826c3ace45
commit 3c8af1916d
+16
View File
@@ -67,4 +67,20 @@ class QROptionsTest extends TestCase{
public function testInvalidEccLevelException(){
new QROptions(['eccLevel' => 42]);
}
public function testClampRGBValues(){
$o = new QROptions(['imageTransparencyBG' => [-1, 0, 999]]);
$this->assertSame(0, $o->imageTransparencyBG[0]);
$this->assertSame(0, $o->imageTransparencyBG[1]);
$this->assertSame(255, $o->imageTransparencyBG[2]);
}
/**
* @expectedException \chillerlan\QRCode\QRCodeException
* @expectedExceptionMessage Invalid RGB value.
*/
public function testInvalidRGBValueException(){
new QROptions(['imageTransparencyBG' => ['r', 'g', 'b']]);
}
}