Exemple #1
0
 public function testInitFromRgbString()
 {
     $c = new Color();
     $c->initFromString('rgb(1, 14, 144)');
     $this->validateColor($c, 1, 14, 144, 0);
     $c->initFromString('rgb (255, 255, 255)');
     $this->validateColor($c, 255, 255, 255, 0);
     $c->initFromString('rgb(0,0,0)');
     $this->validateColor($c, 0, 0, 0, 0);
     $c->initFromString('rgba(0,0,0,0)');
     $this->validateColor($c, 0, 0, 0, 127);
     $c->initFromString('rgba(0,0,0,0.5)');
     $this->validateColor($c, 0, 0, 0, 64);
     $c->initFromString('rgba(255, 0, 0, 0.5)');
     $this->validateColor($c, 255, 0, 0, 64);
     $c->initFromString('rgba(204, 204, 204, 0.9)');
     $this->validateColor($c, 204, 204, 204, 13);
 }