mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-19 01:50:04 +00:00
:octocat: test GD RGB clamp
This commit is contained in:
@@ -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']]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user