Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Tests\Etron\GFX;
- use Etron\GFX\_I_Color;
- use Etron\GFX\Color;
- use PHPUnit_Framework_TestCase;
- abstract class _I_ColorTest extends PHPUnit_Framework_TestCase
- {
- /**
- * @return _I_Color
- */
- abstract function getEmptyObj();
- /**
- * @covers _I_Color::adjustBrightness()
- */
- function testAdjustBrightnessPositive()
- {
- $obj = $this->getEmptyObj()->setRGB(0, 0, 0);
- $modObj = $obj->adjustBrightness(100);
- $this->assertInstanceOf(_I_Color::class, $modObj);
- $this->assertEquals([100, 100, 100], $modObj->getRGB());
- }
- /**
- * @covers _I_Color::adjustBrightness()
- */
- function testAdjustBrightnessNegative()
- {
- $obj = $this->getEmptyObj()->setRGB(200, 200, 200);
- $modObj = $obj->adjustBrightness(-100);
- $this->assertInstanceOf(_I_Color::class, $modObj);
- $this->assertEquals([100, 100, 100], $modObj->getRGB());
- }
- /**
- * @covers _I_Color::adjustBrightness()
- */
- function testAdjustBrightnessUpperBoundary()
- {
- $obj = $this->getEmptyObj()->setRGB(0, 0, 0);
- $modObj = $obj->adjustBrightness(300);
- $this->assertInstanceOf(_I_Color::class, $modObj);
- $this->assertEquals([255, 255, 255], $modObj->getRGB());
- }
- /**
- * @covers _I_Color::adjustBrightness()
- */
- function testAdjustBrightnessLowerBoundary()
- {
- $obj = $this->getEmptyObj()->setRGB(100, 100, 100);
- $modObj = $obj->adjustBrightness(-300);
- $this->assertInstanceOf(_I_Color::class, $modObj);
- $this->assertEquals([0, 0, 0], $modObj->getRGB());
- }
- }
- class ColorTest extends _I_ColorTest
- {
- function getEmptyObj()
- {
- return new Color;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement