|
@@ 358-369 (lines=12) @@
|
| 355 |
|
* @covers \Kint\Object\Representation\ColorRepresentation::hslToRgb |
| 356 |
|
* @covers \Kint\Object\Representation\ColorRepresentation::hueToRgb |
| 357 |
|
*/ |
| 358 |
|
public function testHslToRgb() |
| 359 |
|
{ |
| 360 |
|
$this->assertSame(array(0, 255, 0), ColorRepresentation::hslToRgb(120, 100, 50)); |
| 361 |
|
$this->assertSame(array(255, 255, 255), ColorRepresentation::hslToRgb(120, 100, 100)); |
| 362 |
|
$this->assertSame(array(0, 0, 0), ColorRepresentation::hslToRgb(120, 100, 0)); |
| 363 |
|
$this->assertSame(array(255, 0, 0), ColorRepresentation::hslToRgb(0, 100, 50)); |
| 364 |
|
$this->assertSame(array(255, 128, 128), ColorRepresentation::hslToRgb(0, 100, 75)); |
| 365 |
|
$this->assertSame(array(255, 0, 0), ColorRepresentation::hslToRgb(360, 100, 50)); |
| 366 |
|
|
| 367 |
|
// Hue between 50% and 66% |
| 368 |
|
$this->assertSame(array(0, 170, 255), ColorRepresentation::hslToRgb(200, 100, 50)); |
| 369 |
|
} |
| 370 |
|
|
| 371 |
|
/** |
| 372 |
|
* @covers \Kint\Object\Representation\ColorRepresentation::rgbToHsl |
|
@@ 374-387 (lines=14) @@
|
| 371 |
|
/** |
| 372 |
|
* @covers \Kint\Object\Representation\ColorRepresentation::rgbToHsl |
| 373 |
|
*/ |
| 374 |
|
public function testRgbToHsl() |
| 375 |
|
{ |
| 376 |
|
$this->assertSame(array(0.0, 100.0, 50.0), ColorRepresentation::rgbToHsl(255, 0, 0)); |
| 377 |
|
$this->assertSame(array(120.0, 100.0, 50.0), ColorRepresentation::rgbToHsl(0, 255, 0)); |
| 378 |
|
$this->assertSame(array(240.0, 100.0, 50.0), ColorRepresentation::rgbToHsl(0, 0, 255)); |
| 379 |
|
$this->assertSame(array(0.0, 0.0, 0.0), ColorRepresentation::rgbToHsl(0, 0, 0)); |
| 380 |
|
$this->assertSame(array(0.0, 0.0, 100.0), ColorRepresentation::rgbToHsl(255, 255, 255)); |
| 381 |
|
|
| 382 |
|
// Lightness below half |
| 383 |
|
$this->assertSame(array(30.0, 100.0, 10.0), ColorRepresentation::rgbToHsl(51, 25.5, 0)); |
| 384 |
|
|
| 385 |
|
// Hue below 0 |
| 386 |
|
$this->assertSame(array(300.0, 100.0, 50.0), ColorRepresentation::rgbToHsl(255, 0, 255)); |
| 387 |
|
} |
| 388 |
|
|
| 389 |
|
/** |
| 390 |
|
* @covers \Kint\Object\Representation\ColorRepresentation::rgbToHsl |