2012-08-03 20:21:32 +00:00
|
|
|
<?php
|
|
|
|
|
2016-08-31 17:18:12 +00:00
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Style;
|
2012-08-03 20:21:32 +00:00
|
|
|
|
2016-08-31 17:18:12 +00:00
|
|
|
use PhpOffice\PhpSpreadsheet\Style\Color;
|
2017-11-08 15:48:01 +00:00
|
|
|
use PHPUnit\Framework\TestCase;
|
2016-08-14 04:08:43 +00:00
|
|
|
|
2017-11-08 15:48:01 +00:00
|
|
|
class ColorTest extends TestCase
|
2012-08-03 20:21:32 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @dataProvider providerColorGetRed
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-08-03 20:21:32 +00:00
|
|
|
*/
|
2020-05-18 04:49:57 +00:00
|
|
|
public function testGetRed($expectedResult, ...$args): void
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Color::getRed(...$args);
|
2017-09-20 05:55:42 +00:00
|
|
|
self::assertEquals($expectedResult, $result);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-08-03 20:21:32 +00:00
|
|
|
|
|
|
|
public function providerColorGetRed()
|
|
|
|
{
|
2020-05-17 09:35:55 +00:00
|
|
|
return require 'tests/data/Style/ColorGetRed.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-08-03 20:21:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerColorGetGreen
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-08-03 20:21:32 +00:00
|
|
|
*/
|
2020-05-18 04:49:57 +00:00
|
|
|
public function testGetGreen($expectedResult, ...$args): void
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Color::getGreen(...$args);
|
2017-09-20 05:55:42 +00:00
|
|
|
self::assertEquals($expectedResult, $result);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-08-03 20:21:32 +00:00
|
|
|
|
|
|
|
public function providerColorGetGreen()
|
|
|
|
{
|
2020-05-17 09:35:55 +00:00
|
|
|
return require 'tests/data/Style/ColorGetGreen.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-08-03 20:21:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerColorGetBlue
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-08-03 20:21:32 +00:00
|
|
|
*/
|
2020-05-18 04:49:57 +00:00
|
|
|
public function testGetBlue($expectedResult, ...$args): void
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Color::getBlue(...$args);
|
2017-09-20 05:55:42 +00:00
|
|
|
self::assertEquals($expectedResult, $result);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-08-03 20:21:32 +00:00
|
|
|
|
|
|
|
public function providerColorGetBlue()
|
|
|
|
{
|
2020-05-17 09:35:55 +00:00
|
|
|
return require 'tests/data/Style/ColorGetBlue.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-08-03 20:21:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider providerColorChangeBrightness
|
2017-01-23 05:49:10 +00:00
|
|
|
*
|
|
|
|
* @param mixed $expectedResult
|
2012-08-03 20:21:32 +00:00
|
|
|
*/
|
2020-05-18 04:49:57 +00:00
|
|
|
public function testChangeBrightness($expectedResult, ...$args): void
|
2015-05-17 13:00:02 +00:00
|
|
|
{
|
2017-01-23 05:49:10 +00:00
|
|
|
$result = Color::changeBrightness(...$args);
|
2017-09-20 05:55:42 +00:00
|
|
|
self::assertEquals($expectedResult, $result);
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-08-03 20:21:32 +00:00
|
|
|
|
|
|
|
public function providerColorChangeBrightness()
|
|
|
|
{
|
2020-05-17 09:35:55 +00:00
|
|
|
return require 'tests/data/Style/ColorChangeBrightness.php';
|
2015-05-17 13:00:02 +00:00
|
|
|
}
|
2012-08-03 20:21:32 +00:00
|
|
|
}
|