ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSystemStyleIconColorTest Class Reference
+ Inheritance diagram for ilSystemStyleIconColorTest:
+ Collaboration diagram for ilSystemStyleIconColorTest:

Public Member Functions

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

Detailed Description

Member Function Documentation

◆ testCompareColors()

ilSystemStyleIconColorTest::testCompareColors ( )

Definition at line 111 of file ilSystemStyleIconColorTest.php.

References ilSystemStyleIconColor\compareColors().

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

◆ testConstruct()

ilSystemStyleIconColorTest::testConstruct ( )

Definition at line 15 of file ilSystemStyleIconColorTest.php.

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

◆ testGetDominantAspect()

ilSystemStyleIconColorTest::testGetDominantAspect ( )

Definition at line 75 of file ilSystemStyleIconColorTest.php.

References ilSystemStyleIconColor\BLUE, ilSystemStyleIconColor\GREEN, ilSystemStyleIconColor\GREY, and ilSystemStyleIconColor\RED.

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

◆ testGetPerceivedBrightness()

ilSystemStyleIconColorTest::testGetPerceivedBrightness ( )

Definition at line 93 of file ilSystemStyleIconColorTest.php.

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

◆ testInvalidColor1()

ilSystemStyleIconColorTest::testInvalidColor1 ( )

Definition at line 47 of file ilSystemStyleIconColorTest.php.

References Vendor\Package\$e, and ilSystemStyleColorException\INVALID_COLOR_EXCEPTION.

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

◆ testInvalidColor2()

ilSystemStyleIconColorTest::testInvalidColor2 ( )

Definition at line 56 of file ilSystemStyleIconColorTest.php.

References Vendor\Package\$e, and ilSystemStyleColorException\INVALID_COLOR_EXCEPTION.

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

◆ testLowerCaseColor()

ilSystemStyleIconColorTest::testLowerCaseColor ( )

Definition at line 40 of file ilSystemStyleIconColorTest.php.

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

◆ testSetMethods()

ilSystemStyleIconColorTest::testSetMethods ( )

Definition at line 25 of file ilSystemStyleIconColorTest.php.

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

◆ testValidColor3()

ilSystemStyleIconColorTest::testValidColor3 ( )

Definition at line 65 of file ilSystemStyleIconColorTest.php.

References Vendor\Package\$e.

66  {
67  try {
68  new ilSystemStyleIconColor("id", "name", "F00", "description");
69  $this->assertTrue(true);
71  $this->assertTrue(false);
72  }
73  }
Class for advanced editing exception handling in ILIAS.

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