-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes for alpha value conversions #37
- Loading branch information
1 parent
b7c3791
commit f6f9069
Showing
7 changed files
with
148 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
namespace OzdemirBurak\Iris\Tests\Color; | ||
|
||
use OzdemirBurak\Iris\Color\Cmyk; | ||
use OzdemirBurak\Iris\Color\Hex; | ||
use OzdemirBurak\Iris\Color\Hexa; | ||
use OzdemirBurak\Iris\Color\Hsl; | ||
use OzdemirBurak\Iris\Color\Hsla; | ||
use OzdemirBurak\Iris\Color\Hsv; | ||
use OzdemirBurak\Iris\Color\Rgb; | ||
use OzdemirBurak\Iris\Color\Rgba; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class AlphaTest extends TestCase | ||
{ | ||
/** | ||
* @group alpha | ||
*/ | ||
public function testRgb() | ||
{ | ||
[$rgba, $hex] = $this->getBaseValues(); | ||
$this->assertEquals($hex, $rgba->toRgb()->toHex()); | ||
$this->assertEquals($hex, $rgba->toHex()); | ||
} | ||
/** | ||
* @group alpha | ||
*/ | ||
public function testHexa() | ||
{ | ||
[$rgba, $hex] = $this->getBaseValues(); | ||
$this->assertEquals($hex, $rgba->toHexa()->toHex()); | ||
} | ||
/** | ||
* @group alpha | ||
*/ | ||
public function testHsl() | ||
{ | ||
[$rgba, $hex] = $this->getBaseValues(); | ||
$this->assertEquals($hex, $rgba->toHsl()->toHex()); | ||
} | ||
|
||
/** | ||
* @group alpha | ||
*/ | ||
public function testHsla() | ||
{ | ||
[$rgba, $hex] = $this->getBaseValues(); | ||
$this->assertEquals($hex, $rgba->toHsla()->toHex()); | ||
} | ||
|
||
/** | ||
* @group alpha | ||
*/ | ||
public function testIssueValues() | ||
{ | ||
[$rgb, $hsl] = [new Rgb('127,127,127'), new Hsl('0, 0%, 49.8%')]; | ||
$this->assertEquals($rgb->toHsl(), $hsl); | ||
[$rgba, $hex] = $this->getBaseValues(); | ||
$this->assertEquals($rgba->toHsla(), new Hsla('0, 0%, 40%, 0.5')); | ||
|
||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
protected function getBaseValues(): array | ||
{ | ||
return [new Rgba('rgba(102, 102, 102, 0.5)'), new Hex('b2b2b2')]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,6 @@ public function testInvalidColor() | |
new Rgb('333,0,666'); | ||
} | ||
|
||
|
||
/** | ||
* @group rgb-construction | ||
*/ | ||
|