Beim Testen kann eine Genauigkeit angegeben werden.
This commit is contained in:
@@ -10,6 +10,8 @@ use TorstenHettstedt\Colors\Transformer\CyanMagentaYellowKeyTransformer;
|
||||
class CyanMagentaYellowKeyTransformerTest extends Unit
|
||||
{
|
||||
|
||||
const FLOAT_DELTA = 0.001;
|
||||
|
||||
protected CyanMagentaYellowKey $color;
|
||||
|
||||
/**
|
||||
@@ -228,9 +230,9 @@ class CyanMagentaYellowKeyTransformerTest extends Unit
|
||||
|
||||
$color = $transformer->toRedGreenBlue();
|
||||
|
||||
$this->assertEquals($rgb['red'], $color->getRed());
|
||||
$this->assertEquals($rgb['green'], $color->getGreen());
|
||||
$this->assertEquals($rgb['blue'], $color->getBlue());
|
||||
$this->assertEqualsWithDelta($rgb['red'], $color->getRed(), self::FLOAT_DELTA);
|
||||
$this->assertEqualsWithDelta($rgb['green'], $color->getGreen(), self::FLOAT_DELTA);
|
||||
$this->assertEqualsWithDelta($rgb['blue'], $color->getBlue(), self::FLOAT_DELTA);
|
||||
|
||||
}
|
||||
|
||||
@@ -250,10 +252,10 @@ class CyanMagentaYellowKeyTransformerTest extends Unit
|
||||
|
||||
$color = $transformer->toCyanMagentaYellowKey();
|
||||
|
||||
$this->assertEquals($cmyk['cyan'], $color->getCyan());
|
||||
$this->assertEquals($cmyk['magenta'], $color->getMagenta());
|
||||
$this->assertEquals($cmyk['yellow'], $color->getYellow());
|
||||
$this->assertEquals($cmyk['key'], $color->getKey());
|
||||
$this->assertEqualsWithDelta($cmyk['cyan'], $color->getCyan(), self::FLOAT_DELTA);
|
||||
$this->assertEqualsWithDelta($cmyk['magenta'], $color->getMagenta(), self::FLOAT_DELTA);
|
||||
$this->assertEqualsWithDelta($cmyk['yellow'], $color->getYellow(), self::FLOAT_DELTA);
|
||||
$this->assertEqualsWithDelta($cmyk['key'], $color->getKey(), self::FLOAT_DELTA);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -273,8 +275,8 @@ class CyanMagentaYellowKeyTransformerTest extends Unit
|
||||
|
||||
$color = $transformer->toHueSaturationValue();
|
||||
|
||||
$this->assertEquals($hsv['hue'], $color->getHue());
|
||||
$this->assertEquals($hsv['saturation'], $color->getSaturation());
|
||||
$this->assertEquals($hsv['value'], $color->getValue());
|
||||
$this->assertEqualsWithDelta($hsv['hue'], $color->getHue(), self::FLOAT_DELTA);
|
||||
$this->assertEqualsWithDelta($hsv['saturation'], $color->getSaturation(), self::FLOAT_DELTA);
|
||||
$this->assertEqualsWithDelta($hsv['value'], $color->getValue(), self::FLOAT_DELTA);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user