| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Class CRM_Utils_ColorTest |
| 5 | * @group headless |
| 6 | */ |
| 7 | class CRM_Utils_ColorTest extends CiviUnitTestCase { |
| 8 | |
| 9 | /** |
| 10 | * @dataProvider contrastExamples |
| 11 | */ |
| 12 | public function testGetContrast($background, $text) { |
| 13 | $this->assertEquals($text, CRM_Utils_Color::getContrast($background)); |
| 14 | } |
| 15 | |
| 16 | public function contrastExamples() { |
| 17 | return array( |
| 18 | array('ef4444', 'white'), |
| 19 | array('FAA31B', 'black'), |
| 20 | array('FFF000', 'black'), |
| 21 | array(' 82c341', 'black'), |
| 22 | array('#009F75', 'white'), |
| 23 | array('#88C6eD', 'black'), |
| 24 | array('# 394ba0', 'white'), |
| 25 | array(' #D54799', 'white'), |
| 26 | ); |
| 27 | } |
| 28 | |
| 29 | } |