From: Coleman Watts Date: Tue, 9 Apr 2019 01:08:59 +0000 (-0400) Subject: colorTest X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=dfc29fbb70d562b26ba938bf149cbaf9ab03d6cd;p=civicrm-core.git colorTest --- diff --git a/tests/phpunit/CRM/Utils/ColorTest.php b/tests/phpunit/CRM/Utils/ColorTest.php index 77b894f2a9..94cb87527c 100644 --- a/tests/phpunit/CRM/Utils/ColorTest.php +++ b/tests/phpunit/CRM/Utils/ColorTest.php @@ -14,16 +14,32 @@ class CRM_Utils_ColorTest extends CiviUnitTestCase { } public function contrastExamples() { - return array( - array('ef4444', 'white'), - array('FAA31B', 'black'), - array('FFF000', 'black'), - array(' 82c341', 'black'), - array('#009F75', 'white'), - array('#88C6eD', 'black'), - array('# 394ba0', 'white'), - array(' #D54799', 'white'), - ); + return [ + ['ef4444', 'white'], + ['FAA31B', 'black'], + ['FFF000', 'black'], + [' 82c341', 'black'], + ['#009F75', 'white'], + ['#88C6eD', 'black'], + ['# 394ba0', 'white'], + [' #D54799', 'white'], + ]; + } + + /** + * @dataProvider rgbExamples + */ + public function testGetRgb($hex, $rgb) { + $this->assertEquals($rgb, CRM_Utils_Color::getRgb($hex)); + } + + public function rgbExamples() { + return [ + ['#fff', [255, 255, 255]], + ['#000000', [0, 0, 0]], + ['#111', [17, 17, 17]], + [' fffc99 ', [255, 252, 153]], + ]; } }