Skip to content

Commit 3c8af19

Browse files
committed
:octocat: test GD RGB clamp
1 parent 826c3ac commit 3c8af19

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/QROptionsTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,20 @@ public function testMaskPatternClamp(){
6767
public function testInvalidEccLevelException(){
6868
new QROptions(['eccLevel' => 42]);
6969
}
70+
71+
public function testClampRGBValues(){
72+
$o = new QROptions(['imageTransparencyBG' => [-1, 0, 999]]);
73+
74+
$this->assertSame(0, $o->imageTransparencyBG[0]);
75+
$this->assertSame(0, $o->imageTransparencyBG[1]);
76+
$this->assertSame(255, $o->imageTransparencyBG[2]);
77+
}
78+
79+
/**
80+
* @expectedException \chillerlan\QRCode\QRCodeException
81+
* @expectedExceptionMessage Invalid RGB value.
82+
*/
83+
public function testInvalidRGBValueException(){
84+
new QROptions(['imageTransparencyBG' => ['r', 'g', 'b']]);
85+
}
7086
}

0 commit comments

Comments
 (0)