ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilSystemStyleIconTest Class Reference
+ Inheritance diagram for ilSystemStyleIconTest:
+ Collaboration diagram for ilSystemStyleIconTest:

Public Member Functions

 testConstruct ()
 
 testGetDirRelToCustomizing ()
 
 testGetColorSet ()
 
 testChangeColor ()
 
 testChangeColorInIconFile ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 

Protected Attributes

 $system_style_config
 
 $container
 
 $style
 
 $icon_name = "test_image_1.svg"
 
 $icon_type = "svg"
 
 $save_dic = null
 

Detailed Description

Author
Timon Amstutz timon.nosp@m..ams.nosp@m.tutz@.nosp@m.ilub.nosp@m..unib.nosp@m.e.ch
Version
$Id$*

Definition at line 17 of file ilSystemStyleIconTest.php.

Member Function Documentation

◆ setUp()

ilSystemStyleIconTest::setUp ( )
protected

Definition at line 48 of file ilSystemStyleIconTest.php.

References $DIC, ilSystemStyleSkinContainer\generateFromId(), and ilSystemStyleSkinContainer\xCopy().

49  {
50  global $DIC;
51 
52  $this->save_dic = $DIC;
53 
54  $DIC = new ilSystemStyleDICMock();
55 
56  $this->system_style_config = new ilSystemStyleConfigMock();
57 
58  mkdir($this->system_style_config->test_skin_temp_path);
59  ilSystemStyleSkinContainer::xCopy($this->system_style_config->test_skin_original_path, $this->system_style_config->test_skin_temp_path);
60 
61  $this->container = ilSystemStyleSkinContainer::generateFromId("skin1", null, $this->system_style_config);
62  $this->style = $this->container->getSkin()->getStyle("style1");
63  }
Class ilLanguageMock.
global $DIC
Definition: saml.php:7
"color:#CC0000 style
Definition: example_001.php:92
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
static xCopy($src, $dest)
Recursive copy of a folder.
+ Here is the call graph for this function:

◆ tearDown()

ilSystemStyleIconTest::tearDown ( )
protected

Definition at line 65 of file ilSystemStyleIconTest.php.

References $DIC, $save_dic, and ilSystemStyleSkinContainer\recursiveRemoveDir().

66  {
67  global $DIC;
68  $DIC = $this->save_dic;
69  ilSystemStyleSkinContainer::recursiveRemoveDir($this->system_style_config->test_skin_temp_path);
70  }
global $DIC
Definition: saml.php:7
static recursiveRemoveDir($dir)
Recursive delete of a folder.
+ Here is the call graph for this function:

◆ testChangeColor()

ilSystemStyleIconTest::testChangeColor ( )

Definition at line 115 of file ilSystemStyleIconTest.php.

References $path.

116  {
117  $path = $this->container->getImagesSkinPath($this->style->getId()) . "/" . $this->icon_name;
118  $icon = new ilSystemStyleIcon($this->icon_name, $path, $this->icon_type);
119 
120  $icon->changeColors(['505050' => '555555']);
121 
122  $expected_color_set = new ilSystemStyleIconColorSet();
123  $color1 = new ilSystemStyleIconColor("555555", "555555", "555555", "555555");
124  $color2 = new ilSystemStyleIconColor("6B6B6B", "6B6B6B", "6B6B6B", "6B6B6B");
125  $color3 = new ilSystemStyleIconColor("838383", "838383", "838383", "838383");
126  $color4 = new ilSystemStyleIconColor("8C8C8C", "8C8C8C", "8C8C8C", "8C8C8C");
127  $expected_color_set->addColor($color1);
128  $expected_color_set->addColor($color2);
129  $expected_color_set->addColor($color3);
130  $expected_color_set->addColor($color4);
131 
132  $this->assertEquals($expected_color_set, $icon->getColorSet());
133  }
"color:#CC0000 style
Definition: example_001.php:92
Abstracts an Icon and the necessary actions to get all colors out of an svg Icon. ...

◆ testChangeColorInIconFile()

ilSystemStyleIconTest::testChangeColorInIconFile ( )

Definition at line 135 of file ilSystemStyleIconTest.php.

References $path.

136  {
137  $path = $this->container->getImagesSkinPath($this->style->getId()) . "/" . $this->icon_name;
138  $icon = new ilSystemStyleIcon($this->icon_name, $path, $this->icon_type);
139 
140  $icon->changeColors(['505050' => '555555']);
141 
142  $expected_color_set = new ilSystemStyleIconColorSet();
143  $color1 = new ilSystemStyleIconColor("555555", "555555", "555555", "555555");
144  $color2 = new ilSystemStyleIconColor("6B6B6B", "6B6B6B", "6B6B6B", "6B6B6B");
145  $color3 = new ilSystemStyleIconColor("838383", "838383", "838383", "838383");
146  $color4 = new ilSystemStyleIconColor("8C8C8C", "8C8C8C", "8C8C8C", "8C8C8C");
147  $expected_color_set->addColor($color1);
148  $expected_color_set->addColor($color2);
149  $expected_color_set->addColor($color3);
150  $expected_color_set->addColor($color4);
151 
152  $icon_new = new ilSystemStyleIcon($this->icon_name, $path, $this->icon_type);
153 
154  $this->assertEquals($expected_color_set, $icon_new->getColorSet());
155  }
"color:#CC0000 style
Definition: example_001.php:92
Abstracts an Icon and the necessary actions to get all colors out of an svg Icon. ...

◆ testConstruct()

ilSystemStyleIconTest::testConstruct ( )

Definition at line 72 of file ilSystemStyleIconTest.php.

References $icon_name, $icon_type, and $path.

73  {
74  $path = $this->container->getImagesSkinPath($this->style->getId()) . "/" . $this->icon_name;
75  $icon = new ilSystemStyleIcon($this->icon_name, $path, $this->icon_type);
76 
77  $this->assertEquals($icon->getName(), $this->icon_name);
78  $this->assertEquals($icon->getPath(), $path);
79  $this->assertEquals($icon->getType(), $this->icon_type);
80  }
"color:#CC0000 style
Definition: example_001.php:92
Abstracts an Icon and the necessary actions to get all colors out of an svg Icon. ...

◆ testGetColorSet()

ilSystemStyleIconTest::testGetColorSet ( )

Definition at line 97 of file ilSystemStyleIconTest.php.

References $path.

98  {
99  $path = $this->container->getImagesSkinPath($this->style->getId()) . "/" . $this->icon_name;
100  $icon = new ilSystemStyleIcon($this->icon_name, $path, $this->icon_type);
101 
102  $expected_color_set = new ilSystemStyleIconColorSet();
103  $color1 = new ilSystemStyleIconColor("505050", "505050", "505050", "505050");
104  $color2 = new ilSystemStyleIconColor("6B6B6B", "6B6B6B", "6B6B6B", "6B6B6B");
105  $color3 = new ilSystemStyleIconColor("838383", "838383", "838383", "838383");
106  $color4 = new ilSystemStyleIconColor("8C8C8C", "8C8C8C", "8C8C8C", "8C8C8C");
107  $expected_color_set->addColor($color1);
108  $expected_color_set->addColor($color2);
109  $expected_color_set->addColor($color3);
110  $expected_color_set->addColor($color4);
111 
112  $this->assertEquals($expected_color_set, $icon->getColorSet());
113  }
"color:#CC0000 style
Definition: example_001.php:92
Abstracts an Icon and the necessary actions to get all colors out of an svg Icon. ...

◆ testGetDirRelToCustomizing()

ilSystemStyleIconTest::testGetDirRelToCustomizing ( )

Definition at line 82 of file ilSystemStyleIconTest.php.

References $name, and $path.

83  {
84  $path = $this->container->getImagesSkinPath($this->style->getId()) . "/" . $this->icon_name;
85  $icon = new ilSystemStyleIcon($this->icon_name, $path, $this->icon_type);
86 
87  $this->assertEquals($icon->getDirRelToCustomizing(), "");
88 
89  $name = "test.svg";
90  $rel_path = "global/skin/unibe50/images";
91  $path = "./Customizing" . $rel_path . "/" . $name;
92  $icon = new ilSystemStyleIcon($name, $path, "svg");
93 
94  $this->assertEquals($icon->getDirRelToCustomizing(), $rel_path);
95  }
"color:#CC0000 style
Definition: example_001.php:92
Abstracts an Icon and the necessary actions to get all colors out of an svg Icon. ...
if($format !==null) $name
Definition: metadata.php:146

Field Documentation

◆ $container

ilSystemStyleIconTest::$container
protected

Definition at line 28 of file ilSystemStyleIconTest.php.

◆ $icon_name

ilSystemStyleIconTest::$icon_name = "test_image_1.svg"
protected

Definition at line 38 of file ilSystemStyleIconTest.php.

Referenced by testConstruct().

◆ $icon_type

ilSystemStyleIconTest::$icon_type = "svg"
protected

Definition at line 43 of file ilSystemStyleIconTest.php.

Referenced by testConstruct().

◆ $save_dic

ilSystemStyleIconTest::$save_dic = null
protected

Definition at line 46 of file ilSystemStyleIconTest.php.

Referenced by tearDown().

◆ $style

ilSystemStyleIconTest::$style
protected

Definition at line 33 of file ilSystemStyleIconTest.php.

◆ $system_style_config

ilSystemStyleIconTest::$system_style_config
protected

Definition at line 23 of file ilSystemStyleIconTest.php.


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