ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilSystemStyleIconColorTest Class Reference
+ Inheritance diagram for ilSystemStyleIconColorTest:
+ Collaboration diagram for ilSystemStyleIconColorTest:

Public Member Functions

 testConstruct ()
 
 testSetMethods ()
 
 testLowerCaseColor ()
 
 testInvalidColor1 ()
 
 testInvalidColor2 ()
 
 testInvalidColor3 ()
 
 testGetDominantAspect ()
 
 testGetPerceivedBrightness ()
 
 testCompareColors ()
 

Detailed Description

Member Function Documentation

◆ testCompareColors()

ilSystemStyleIconColorTest::testCompareColors ( )

Definition at line 102 of file ilSystemStyleIconColorTest.php.

102 {
103 $white = new ilSystemStyleIconColor("id","name","FFFFFF","description");
104 $black = new ilSystemStyleIconColor("id","name","000000","description");
105
106 $grey = new ilSystemStyleIconColor("id","name","AAAAAA","description");
107 $red = new ilSystemStyleIconColor("id","name","FF0000","description");
108 $green = new ilSystemStyleIconColor("id","name","00FF00","description");
109 $blue = new ilSystemStyleIconColor("id","name","0000FF","description");
110
112 $this->assertEquals(-1,ilSystemStyleIconColor::compareColors($black,$white));
113 $this->assertEquals(0,ilSystemStyleIconColor::compareColors($grey,$grey));
114
115 $this->assertEquals(-1,ilSystemStyleIconColor::compareColors($red,$green));
116 $this->assertEquals(1,ilSystemStyleIconColor::compareColors($red,$blue));
117 $this->assertEquals(-1,ilSystemStyleIconColor::compareColors($blue,$green));
118 }
static compareColors(ilSystemStyleIconColor $color1, ilSystemStyleIconColor $color2)
Used to sort colors according to their brightness.
$red
Definition: example_030.php:80
$green
Definition: example_030.php:83
$black
Definition: example_030.php:85
$blue
Definition: example_030.php:81
$white
Definition: example_030.php:84

References $black, $blue, $green, $red, $white, and ilSystemStyleIconColor\compareColors().

+ Here is the call graph for this function:

◆ testConstruct()

ilSystemStyleIconColorTest::testConstruct ( )

Definition at line 14 of file ilSystemStyleIconColorTest.php.

14 {
15 $color = new ilSystemStyleIconColor("id","name","FF0000","description");
16
17 $this->assertEquals("id",$color->getId());
18 $this->assertEquals("name",$color->getName());
19 $this->assertEquals("FF0000",$color->getColor());
20 $this->assertEquals("description",$color->getDescription());
21 }

◆ testGetDominantAspect()

ilSystemStyleIconColorTest::testGetDominantAspect ( )

Definition at line 68 of file ilSystemStyleIconColorTest.php.

68 {
69 $white = new ilSystemStyleIconColor("id","name","FFFFFF","description");
70 $black = new ilSystemStyleIconColor("id","name","000000","description");
71
72 $grey = new ilSystemStyleIconColor("id","name","AAAAAA","description");
73 $red = new ilSystemStyleIconColor("id","name","FF0000","description");
74 $green = new ilSystemStyleIconColor("id","name","00FF00","description");
75 $blue = new ilSystemStyleIconColor("id","name","0000FF","description");
76
77 $this->assertEquals(ilSystemStyleIconColor::GREY,$white->getDominatAspect());
78 $this->assertEquals(ilSystemStyleIconColor::GREY,$black->getDominatAspect());
79 $this->assertEquals(ilSystemStyleIconColor::GREY,$grey->getDominatAspect());
80 $this->assertEquals(ilSystemStyleIconColor::RED,$red->getDominatAspect());
81 $this->assertEquals(ilSystemStyleIconColor::GREEN,$green->getDominatAspect());
82 $this->assertEquals(ilSystemStyleIconColor::BLUE,$blue->getDominatAspect());
83 }

References $black, $blue, $green, $red, $white, ilSystemStyleIconColor\BLUE, ilSystemStyleIconColor\GREEN, ilSystemStyleIconColor\GREY, and ilSystemStyleIconColor\RED.

◆ testGetPerceivedBrightness()

ilSystemStyleIconColorTest::testGetPerceivedBrightness ( )

Definition at line 85 of file ilSystemStyleIconColorTest.php.

85 {
86 $white = new ilSystemStyleIconColor("id","name","FFFFFF","description");
87 $black = new ilSystemStyleIconColor("id","name","000000","description");
88
89 $grey = new ilSystemStyleIconColor("id","name","AAAAAA","description");
90 $red = new ilSystemStyleIconColor("id","name","FF0000","description");
91 $green = new ilSystemStyleIconColor("id","name","00FF00","description");
92 $blue = new ilSystemStyleIconColor("id","name","0000FF","description");
93
94 $this->assertEquals(255,ceil ($white->getPerceivedBrightness()));
95 $this->assertEquals(0,ceil ($black->getPerceivedBrightness()));
96 $this->assertEquals(170,ceil ($grey->getPerceivedBrightness()));
97 $this->assertEquals(140,ceil ($red->getPerceivedBrightness()));
98 $this->assertEquals(196,ceil ($green->getPerceivedBrightness()));
99 $this->assertEquals(87,ceil ($blue->getPerceivedBrightness()));
100 }

References $black, $blue, $green, $red, and $white.

◆ testInvalidColor1()

ilSystemStyleIconColorTest::testInvalidColor1 ( )

Definition at line 43 of file ilSystemStyleIconColorTest.php.

43 {
44 try{
45 new ilSystemStyleIconColor("id","name","#FF0000","description");
46 $this->assertTrue(false);
48 $this->assertEquals(ilSystemStyleColorException::INVALID_COLOR_EXCEPTION,$e->getCode());
49 }
50 }
Class for advanced editing exception handling in ILIAS.

References ilSystemStyleColorException\INVALID_COLOR_EXCEPTION.

◆ testInvalidColor2()

ilSystemStyleIconColorTest::testInvalidColor2 ( )

Definition at line 51 of file ilSystemStyleIconColorTest.php.

51 {
52 try{
53 new ilSystemStyleIconColor("id","name","ZZ0000","description");
54 $this->assertTrue(false);
56 $this->assertEquals(ilSystemStyleColorException::INVALID_COLOR_EXCEPTION,$e->getCode());
57 }
58 }

References ilSystemStyleColorException\INVALID_COLOR_EXCEPTION.

◆ testInvalidColor3()

ilSystemStyleIconColorTest::testInvalidColor3 ( )

Definition at line 59 of file ilSystemStyleIconColorTest.php.

59 {
60 try{
61 new ilSystemStyleIconColor("id","name","F00","description");
62 $this->assertTrue(false);
64 $this->assertEquals(ilSystemStyleColorException::INVALID_COLOR_EXCEPTION,$e->getCode());
65 }
66 }

References ilSystemStyleColorException\INVALID_COLOR_EXCEPTION.

◆ testLowerCaseColor()

ilSystemStyleIconColorTest::testLowerCaseColor ( )

Definition at line 37 of file ilSystemStyleIconColorTest.php.

37 {
38 $color = new ilSystemStyleIconColor("id","name","abcdef","description");
39
40 $this->assertEquals("ABCDEF",$color->getColor());
41 }

◆ testSetMethods()

ilSystemStyleIconColorTest::testSetMethods ( )

Definition at line 23 of file ilSystemStyleIconColorTest.php.

23 {
24 $color = new ilSystemStyleIconColor("id","name","FF0000","description");
25
26 $color->setId("idnew");
27 $color->setName("namenew");
28 $color->setColor("EE0000");
29 $color->setDescription("descriptionnew");
30
31 $this->assertEquals("idnew",$color->getId());
32 $this->assertEquals("namenew",$color->getName());
33 $this->assertEquals("EE0000",$color->getColor());
34 $this->assertEquals("descriptionnew",$color->getDescription());
35 }

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