ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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 18 of file ilSystemStyleIconTest.php.

Member Function Documentation

◆ setUp()

ilSystemStyleIconTest::setUp ( )
protected

Definition at line 49 of file ilSystemStyleIconTest.php.

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

49  : void
50  {
51  global $DIC;
52 
53  $this->save_dic = $DIC;
54 
55  $DIC = new ilSystemStyleDICMock();
56 
57  $this->system_style_config = new ilSystemStyleConfigMock();
58 
59  mkdir($this->system_style_config->test_skin_temp_path);
60  ilSystemStyleSkinContainer::xCopy($this->system_style_config->test_skin_original_path, $this->system_style_config->test_skin_temp_path);
61 
62  $this->container = ilSystemStyleSkinContainer::generateFromId("skin1", null, $this->system_style_config);
63  $this->style = $this->container->getSkin()->getStyle("style1");
64  }
Class ilLanguageMock.
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...
$DIC
Definition: xapitoken.php:46
static xCopy($src, $dest)
Recursive copy of a folder.
+ Here is the call graph for this function:

◆ tearDown()

ilSystemStyleIconTest::tearDown ( )
protected

Definition at line 66 of file ilSystemStyleIconTest.php.

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

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

◆ testChangeColor()

ilSystemStyleIconTest::testChangeColor ( )

Definition at line 116 of file ilSystemStyleIconTest.php.

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

◆ testChangeColorInIconFile()

ilSystemStyleIconTest::testChangeColorInIconFile ( )

Definition at line 136 of file ilSystemStyleIconTest.php.

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

◆ testConstruct()

ilSystemStyleIconTest::testConstruct ( )

Definition at line 73 of file ilSystemStyleIconTest.php.

References $icon_name, and $icon_type.

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

◆ testGetColorSet()

ilSystemStyleIconTest::testGetColorSet ( )

Definition at line 98 of file ilSystemStyleIconTest.php.

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

◆ testGetDirRelToCustomizing()

ilSystemStyleIconTest::testGetDirRelToCustomizing ( )

Definition at line 83 of file ilSystemStyleIconTest.php.

References $name.

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

Field Documentation

◆ $container

ilSystemStyleIconTest::$container
protected

Definition at line 29 of file ilSystemStyleIconTest.php.

◆ $icon_name

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

Definition at line 39 of file ilSystemStyleIconTest.php.

Referenced by testConstruct().

◆ $icon_type

ilSystemStyleIconTest::$icon_type = "svg"
protected

Definition at line 44 of file ilSystemStyleIconTest.php.

Referenced by testConstruct().

◆ $save_dic

ilSystemStyleIconTest::$save_dic = null
protected

Definition at line 47 of file ilSystemStyleIconTest.php.

Referenced by tearDown().

◆ $style

ilSystemStyleIconTest::$style
protected

Definition at line 34 of file ilSystemStyleIconTest.php.

◆ $system_style_config

ilSystemStyleIconTest::$system_style_config
protected

Definition at line 24 of file ilSystemStyleIconTest.php.


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