ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ColorTest Class Reference

Tests working with color data object. More...

+ Inheritance diagram for ColorTest:
+ Collaboration diagram for ColorTest:

Public Member Functions

 setUp ()
 
 testGetRed ()
 providerColorGetRed More...
 
 providerColorGetRed ()
 
 testGetGreen ()
 providerColorGetGreen More...
 
 providerColorGetGreen ()
 
 testGetBlue ()
 providerColorGetBlue More...
 
 providerColorGetBlue ()
 
 testChangeBrightness ()
 providerColorChangeBrightness More...
 
 providerColorChangeBrightness ()
 
 testFullHexValue ()
 
 testShortHexValue ()
 
 testShortHexValue2 ()
 
 testRBGValue ()
 
 testWrongRBGValue ()
 
 testWrongRBGValue2 ()
 
 testWrongRBGValue3 ()
 
 testWrongRBGValue4 ()
 
 testWrongHexValue ()
 
 testWrongHexValue2 ()
 
 testWrongHexValue4 ()
 
 testDarkness ()
 
 testDarkness2 ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 

Detailed Description

Tests working with color data object.

Author
Nils Haagen nils..nosp@m.haag.nosp@m.en@co.nosp@m.ncep.nosp@m.ts-an.nosp@m.d-tr.nosp@m.ainin.nosp@m.g.de

Definition at line 6 of file ColorTest.php.

Member Function Documentation

◆ providerColorChangeBrightness()

ColorTest::providerColorChangeBrightness ( )

Definition at line 76 of file ColorTest.php.

77  {
78  return new testDataFileIterator('rawTestData/Style/ColorChangeBrightness.data');
79  }

◆ providerColorGetBlue()

ColorTest::providerColorGetBlue ( )

Definition at line 60 of file ColorTest.php.

61  {
62  return new testDataFileIterator('rawTestData/Style/ColorGetBlue.data');
63  }

◆ providerColorGetGreen()

ColorTest::providerColorGetGreen ( )

Definition at line 44 of file ColorTest.php.

45  {
46  return new testDataFileIterator('rawTestData/Style/ColorGetGreen.data');
47  }

◆ providerColorGetRed()

ColorTest::providerColorGetRed ( )

Definition at line 28 of file ColorTest.php.

29  {
30  return new testDataFileIterator('rawTestData/Style/ColorGetRed.data');
31  }

◆ setUp() [1/2]

ColorTest::setUp ( )

Definition at line 9 of file ColorTest.php.

References defined.

10  {
11  if (!defined('PHPEXCEL_ROOT')) {
12  define('PHPEXCEL_ROOT', APPLICATION_PATH . '/');
13  }
14  require_once(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
15  }
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27

◆ setUp() [2/2]

ColorTest::setUp ( )
protected

Definition at line 15 of file ColorTest.php.

16  {
17  $this->f = new Data\Factory();
18  }

◆ tearDown()

ColorTest::tearDown ( )
protected

Definition at line 20 of file ColorTest.php.

21  {
22  $this->f = null;
23  }

◆ testChangeBrightness()

ColorTest::testChangeBrightness ( )

providerColorChangeBrightness

Definition at line 68 of file ColorTest.php.

References $result, and array.

69  {
70  $args = func_get_args();
71  $expectedResult = array_pop($args);
72  $result = call_user_func_array(array('PHPExcel_Style_Color','changeBrightness'),$args);
73  $this->assertEquals($expectedResult, $result);
74  }
$result
Create styles array
The data for the language used.

◆ testDarkness()

ColorTest::testDarkness ( )

Definition at line 131 of file ColorTest.php.

132  {
133  $v = $this->f->color('#6541f4');
134  $this->assertEquals(true, $v->isDark());
135  }

◆ testDarkness2()

ColorTest::testDarkness2 ( )

Definition at line 137 of file ColorTest.php.

138  {
139  $v = $this->f->color('#c1f441');
140  $this->assertEquals(false, $v->isDark());
141  }

◆ testFullHexValue()

ColorTest::testFullHexValue ( )

Definition at line 25 of file ColorTest.php.

References array.

26  {
27  $v = $this->f->color('#0fff2f');
28 
29  $this->assertEquals('#0fff2f', $v->asHex());
30  $this->assertEquals('rgb(15, 255, 47)', $v->asRGBString());
31  $this->assertEquals(array(15, 255, 47), $v->asArray());
32  $this->assertEquals(15, $v->r());
33  $this->assertEquals(255, $v->g());
34  $this->assertEquals(47, $v->b());
35  }
Create styles array
The data for the language used.

◆ testGetBlue()

ColorTest::testGetBlue ( )

providerColorGetBlue

Definition at line 52 of file ColorTest.php.

References $result, and array.

53  {
54  $args = func_get_args();
55  $expectedResult = array_pop($args);
56  $result = call_user_func_array(array('PHPExcel_Style_Color','getBlue'),$args);
57  $this->assertEquals($expectedResult, $result);
58  }
$result
Create styles array
The data for the language used.

◆ testGetGreen()

ColorTest::testGetGreen ( )

providerColorGetGreen

Definition at line 36 of file ColorTest.php.

References $result, and array.

37  {
38  $args = func_get_args();
39  $expectedResult = array_pop($args);
40  $result = call_user_func_array(array('PHPExcel_Style_Color','getGreen'),$args);
41  $this->assertEquals($expectedResult, $result);
42  }
$result
Create styles array
The data for the language used.

◆ testGetRed()

ColorTest::testGetRed ( )

providerColorGetRed

Definition at line 20 of file ColorTest.php.

References $result, and array.

21  {
22  $args = func_get_args();
23  $expectedResult = array_pop($args);
24  $result = call_user_func_array(array('PHPExcel_Style_Color','getRed'),$args);
25  $this->assertEquals($expectedResult, $result);
26  }
$result
Create styles array
The data for the language used.

◆ testRBGValue()

ColorTest::testRBGValue ( )

Definition at line 53 of file ColorTest.php.

References array.

54  {
55  $v = $this->f->color(array(15,255,47));
56  $this->assertEquals('#0fff2f', $v->asHex());
57  $this->assertEquals('rgb(15, 255, 47)', $v->asRGBString());
58  $this->assertEquals(array(15, 255, 47), $v->asArray());
59  }
Create styles array
The data for the language used.

◆ testShortHexValue()

ColorTest::testShortHexValue ( )

Definition at line 37 of file ColorTest.php.

References array.

38  {
39  $v = $this->f->color('#f0f');
40  $this->assertEquals('#ff00ff', $v->asHex());
41  $this->assertEquals('rgb(255, 0, 255)', $v->asRGBString());
42  $this->assertEquals(array(255, 0, 255), $v->asArray());
43  }
Create styles array
The data for the language used.

◆ testShortHexValue2()

ColorTest::testShortHexValue2 ( )

Definition at line 45 of file ColorTest.php.

References array.

46  {
47  $v = $this->f->color('f0f');
48  $this->assertEquals('#ff00ff', $v->asHex());
49  $this->assertEquals('rgb(255, 0, 255)', $v->asRGBString());
50  $this->assertEquals(array(255, 0, 255), $v->asArray());
51  }
Create styles array
The data for the language used.

◆ testWrongHexValue()

ColorTest::testWrongHexValue ( )

Definition at line 101 of file ColorTest.php.

102  {
103  try {
104  $v = $this->f->color('1234');
105  $this->assertFalse("This should not happen.");
106  } catch (\InvalidArgumentException $e) {
107  $this->assertTrue(true);
108  }
109  }

◆ testWrongHexValue2()

ColorTest::testWrongHexValue2 ( )

Definition at line 111 of file ColorTest.php.

112  {
113  try {
114  $v = $this->f->color('#ff');
115  $this->assertFalse("This should not happen.");
116  } catch (\InvalidArgumentException $e) {
117  $this->assertTrue(true);
118  }
119  }

◆ testWrongHexValue4()

ColorTest::testWrongHexValue4 ( )

Definition at line 121 of file ColorTest.php.

122  {
123  try {
124  $v = $this->f->color('#gg0000');
125  $this->assertFalse("This should not happen.");
126  } catch (\InvalidArgumentException $e) {
127  $this->assertTrue(true);
128  }
129  }

◆ testWrongRBGValue()

ColorTest::testWrongRBGValue ( )

Definition at line 61 of file ColorTest.php.

References array.

62  {
63  try {
64  $v = $this->f->color(array(-1,0,0));
65  $this->assertFalse("This should not happen.");
66  } catch (\InvalidArgumentException $e) {
67  $this->assertTrue(true);
68  }
69  }
Create styles array
The data for the language used.

◆ testWrongRBGValue2()

ColorTest::testWrongRBGValue2 ( )

Definition at line 71 of file ColorTest.php.

References array.

72  {
73  try {
74  $v = $this->f->color(array(256,0,0));
75  $this->assertFalse("This should not happen.");
76  } catch (\InvalidArgumentException $e) {
77  $this->assertTrue(true);
78  }
79  }
Create styles array
The data for the language used.

◆ testWrongRBGValue3()

ColorTest::testWrongRBGValue3 ( )

Definition at line 81 of file ColorTest.php.

References array.

82  {
83  try {
84  $v = $this->f->color(array(1,1,'123'));
85  $this->assertFalse("This should not happen.");
86  } catch (\InvalidArgumentException $e) {
87  $this->assertTrue(true);
88  }
89  }
Create styles array
The data for the language used.

◆ testWrongRBGValue4()

ColorTest::testWrongRBGValue4 ( )

Definition at line 91 of file ColorTest.php.

References array.

92  {
93  try {
94  $v = $this->f->color(array());
95  $this->assertFalse("This should not happen.");
96  } catch (\InvalidArgumentException $e) {
97  $this->assertTrue(true);
98  }
99  }
Create styles array
The data for the language used.

The documentation for this class was generated from the following file: