ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 110 of file ilSystemStyleIconColorTest.php.

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

111  {
112  $white = new ilSystemStyleIconColor("id", "name", "FFFFFF", "description");
113  $black = new ilSystemStyleIconColor("id", "name", "000000", "description");
114 
115  $grey = new ilSystemStyleIconColor("id", "name", "AAAAAA", "description");
116  $red = new ilSystemStyleIconColor("id", "name", "FF0000", "description");
117  $green = new ilSystemStyleIconColor("id", "name", "00FF00", "description");
118  $blue = new ilSystemStyleIconColor("id", "name", "0000FF", "description");
119 
120  $this->assertEquals(1, ilSystemStyleIconColor::compareColors($white, $black));
121  $this->assertEquals(-1, ilSystemStyleIconColor::compareColors($black, $white));
122  $this->assertEquals(0, ilSystemStyleIconColor::compareColors($grey, $grey));
123 
124  $this->assertEquals(-1, ilSystemStyleIconColor::compareColors($red, $green));
125  $this->assertEquals(1, ilSystemStyleIconColor::compareColors($red, $blue));
126  $this->assertEquals(-1, ilSystemStyleIconColor::compareColors($blue, $green));
127  }
$blue
Definition: example_030.php:81
$red
Definition: example_030.php:80
static compareColors(ilSystemStyleIconColor $color1, ilSystemStyleIconColor $color2)
Used to sort colors according to their brightness.
$green
Definition: example_030.php:83
$white
Definition: example_030.php:84
$black
Definition: example_030.php:85
+ Here is the call graph for this function:

◆ testConstruct()

ilSystemStyleIconColorTest::testConstruct ( )

Definition at line 14 of file ilSystemStyleIconColorTest.php.

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

◆ testGetDominantAspect()

ilSystemStyleIconColorTest::testGetDominantAspect ( )

Definition at line 74 of file ilSystemStyleIconColorTest.php.

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

75  {
76  $white = new ilSystemStyleIconColor("id", "name", "FFFFFF", "description");
77  $black = new ilSystemStyleIconColor("id", "name", "000000", "description");
78 
79  $grey = new ilSystemStyleIconColor("id", "name", "AAAAAA", "description");
80  $red = new ilSystemStyleIconColor("id", "name", "FF0000", "description");
81  $green = new ilSystemStyleIconColor("id", "name", "00FF00", "description");
82  $blue = new ilSystemStyleIconColor("id", "name", "0000FF", "description");
83 
84  $this->assertEquals(ilSystemStyleIconColor::GREY, $white->getDominatAspect());
85  $this->assertEquals(ilSystemStyleIconColor::GREY, $black->getDominatAspect());
86  $this->assertEquals(ilSystemStyleIconColor::GREY, $grey->getDominatAspect());
87  $this->assertEquals(ilSystemStyleIconColor::RED, $red->getDominatAspect());
88  $this->assertEquals(ilSystemStyleIconColor::GREEN, $green->getDominatAspect());
89  $this->assertEquals(ilSystemStyleIconColor::BLUE, $blue->getDominatAspect());
90  }
$blue
Definition: example_030.php:81
$red
Definition: example_030.php:80
$green
Definition: example_030.php:83
$white
Definition: example_030.php:84
$black
Definition: example_030.php:85

◆ testGetPerceivedBrightness()

ilSystemStyleIconColorTest::testGetPerceivedBrightness ( )

Definition at line 92 of file ilSystemStyleIconColorTest.php.

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

93  {
94  $white = new ilSystemStyleIconColor("id", "name", "FFFFFF", "description");
95  $black = new ilSystemStyleIconColor("id", "name", "000000", "description");
96 
97  $grey = new ilSystemStyleIconColor("id", "name", "AAAAAA", "description");
98  $red = new ilSystemStyleIconColor("id", "name", "FF0000", "description");
99  $green = new ilSystemStyleIconColor("id", "name", "00FF00", "description");
100  $blue = new ilSystemStyleIconColor("id", "name", "0000FF", "description");
101 
102  $this->assertEquals(255, ceil($white->getPerceivedBrightness()));
103  $this->assertEquals(0, ceil($black->getPerceivedBrightness()));
104  $this->assertEquals(170, ceil($grey->getPerceivedBrightness()));
105  $this->assertEquals(140, ceil($red->getPerceivedBrightness()));
106  $this->assertEquals(196, ceil($green->getPerceivedBrightness()));
107  $this->assertEquals(87, ceil($blue->getPerceivedBrightness()));
108  }
$blue
Definition: example_030.php:81
$red
Definition: example_030.php:80
$green
Definition: example_030.php:83
$white
Definition: example_030.php:84
$black
Definition: example_030.php:85

◆ testInvalidColor1()

ilSystemStyleIconColorTest::testInvalidColor1 ( )

Definition at line 46 of file ilSystemStyleIconColorTest.php.

References ilSystemStyleColorException\INVALID_COLOR_EXCEPTION.

47  {
48  try {
49  new ilSystemStyleIconColor("id", "name", "#FF0000", "description");
50  $this->assertTrue(false);
51  } catch (ilSystemStyleColorException $e) {
52  $this->assertEquals(ilSystemStyleColorException::INVALID_COLOR_EXCEPTION, $e->getCode());
53  }
54  }
Class for advanced editing exception handling in ILIAS.

◆ testInvalidColor2()

ilSystemStyleIconColorTest::testInvalidColor2 ( )

Definition at line 55 of file ilSystemStyleIconColorTest.php.

References ilSystemStyleColorException\INVALID_COLOR_EXCEPTION.

56  {
57  try {
58  new ilSystemStyleIconColor("id", "name", "ZZ0000", "description");
59  $this->assertTrue(false);
60  } catch (ilSystemStyleColorException $e) {
61  $this->assertEquals(ilSystemStyleColorException::INVALID_COLOR_EXCEPTION, $e->getCode());
62  }
63  }
Class for advanced editing exception handling in ILIAS.

◆ testInvalidColor3()

ilSystemStyleIconColorTest::testInvalidColor3 ( )

Definition at line 64 of file ilSystemStyleIconColorTest.php.

References ilSystemStyleColorException\INVALID_COLOR_EXCEPTION.

65  {
66  try {
67  new ilSystemStyleIconColor("id", "name", "F00", "description");
68  $this->assertTrue(false);
69  } catch (ilSystemStyleColorException $e) {
70  $this->assertEquals(ilSystemStyleColorException::INVALID_COLOR_EXCEPTION, $e->getCode());
71  }
72  }
Class for advanced editing exception handling in ILIAS.

◆ testLowerCaseColor()

ilSystemStyleIconColorTest::testLowerCaseColor ( )

Definition at line 39 of file ilSystemStyleIconColorTest.php.

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

◆ testSetMethods()

ilSystemStyleIconColorTest::testSetMethods ( )

Definition at line 24 of file ilSystemStyleIconColorTest.php.

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

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