Eine Klasse für das HSV-Farbmodel hinzugefügt.
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace TorstenHettstedtUnitTests\Colors\ColorModels;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use TorstenHettstedt\Colors\ColorModels\HueSaturationValue;
|
||||
|
||||
class HueSaturationValueTest extends AbstractColorModelUnit
|
||||
{
|
||||
|
||||
public function testConstruct()
|
||||
{
|
||||
$color = new HueSaturationValue();
|
||||
|
||||
$this->assertEquals(0.0, $color->getHue());
|
||||
$this->assertEquals(0.0, $color->getSaturation());
|
||||
$this->assertEquals(1.0, $color->getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $value
|
||||
*
|
||||
* @dataProvider validValueProvider
|
||||
*/
|
||||
public function testSetHueWithValidValue(float $value)
|
||||
{
|
||||
$color = new HueSaturationValue();
|
||||
|
||||
$color->setHue($value);
|
||||
$this->assertEquals($value, $color->getHue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $value
|
||||
*
|
||||
* @dataProvider invalidValueProvider
|
||||
*/
|
||||
public function testSetHueWithInvalidValue(float $value)
|
||||
{
|
||||
$color = new HueSaturationValue();
|
||||
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$color->setHue($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $value
|
||||
*
|
||||
* @dataProvider validValueProvider
|
||||
*/
|
||||
public function testSetSaturationWithValidValue(float $value)
|
||||
{
|
||||
$color = new HueSaturationValue();
|
||||
|
||||
$color->setSaturation($value);
|
||||
$this->assertEquals($value, $color->getSaturation());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $value
|
||||
*
|
||||
* @dataProvider invalidValueProvider
|
||||
*/
|
||||
public function testSetSaturationWithInvalidValue(float $value)
|
||||
{
|
||||
$color = new HueSaturationValue();
|
||||
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$color->setSaturation($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $value
|
||||
*
|
||||
* @dataProvider validValueProvider
|
||||
*/
|
||||
public function testSetValueWithValidValue(float $value)
|
||||
{
|
||||
$color = new HueSaturationValue();
|
||||
|
||||
$color->setValue($value);
|
||||
$this->assertEquals($value, $color->getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $value
|
||||
*
|
||||
* @dataProvider invalidValueProvider
|
||||
*/
|
||||
public function testSetValueWithInvalidValue(float $value)
|
||||
{
|
||||
$color = new HueSaturationValue();
|
||||
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
$color->setValue($value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user