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 ()
 @dataProvider providerColorGetRed More...
 
 providerColorGetRed ()
 
 testGetGreen ()
 @dataProvider providerColorGetGreen More...
 
 providerColorGetGreen ()
 
 testGetBlue ()
 @dataProvider providerColorGetBlue More...
 
 providerColorGetBlue ()
 
 testChangeBrightness ()
 @dataProvider 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.

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

References defined.

◆ 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 ( )

@dataProvider providerColorChangeBrightness

Definition at line 68 of file ColorTest.php.

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

References $result.

◆ 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.

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 }

◆ testGetBlue()

ColorTest::testGetBlue ( )

@dataProvider providerColorGetBlue

Definition at line 52 of file ColorTest.php.

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 }

References $result.

◆ testGetGreen()

ColorTest::testGetGreen ( )

@dataProvider providerColorGetGreen

Definition at line 36 of file ColorTest.php.

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 }

References $result.

◆ testGetRed()

ColorTest::testGetRed ( )

@dataProvider providerColorGetRed

Definition at line 20 of file ColorTest.php.

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 }

References $result.

◆ testRBGValue()

ColorTest::testRBGValue ( )

Definition at line 53 of file ColorTest.php.

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 }

◆ testShortHexValue()

ColorTest::testShortHexValue ( )

Definition at line 37 of file ColorTest.php.

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 }

◆ testShortHexValue2()

ColorTest::testShortHexValue2 ( )

Definition at line 45 of file ColorTest.php.

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 }

◆ 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.

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 }

◆ testWrongRBGValue2()

ColorTest::testWrongRBGValue2 ( )

Definition at line 71 of file ColorTest.php.

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 }

◆ testWrongRBGValue3()

ColorTest::testWrongRBGValue3 ( )

Definition at line 81 of file ColorTest.php.

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 }

◆ testWrongRBGValue4()

ColorTest::testWrongRBGValue4 ( )

Definition at line 91 of file ColorTest.php.

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 }

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