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

Public Member Functions

 testConstruct ()
 
 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.

49 {
50 global $DIC;
51
52 $this->save_dic = $DIC;
53
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 }
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
Class ilLanguageMock.
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
static xCopy($src, $dest)
Recursive copy of a folder.
global $DIC

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

+ Here is the call graph for this function:

◆ tearDown()

ilSystemStyleIconTest::tearDown ( )
protected

Definition at line 65 of file ilSystemStyleIconTest.php.

66 {
67 global $DIC;
69 ilSystemStyleSkinContainer::recursiveRemoveDir($this->system_style_config->test_skin_temp_path);
70 }
static recursiveRemoveDir($dir)
Recursive delete of a folder.

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

+ Here is the call graph for this function:

◆ testChangeColor()

ilSystemStyleIconTest::testChangeColor ( )

Definition at line 100 of file ilSystemStyleIconTest.php.

101 {
102 $path = $this->container->getImagesSkinPath($this->style->getId()) . "/" . $this->icon_name;
103 $icon = new ilSystemStyleIcon($this->icon_name, $path, $this->icon_type);
104
105 $icon->changeColors(['505050' => '555555']);
106
107 $expected_color_set = new ilSystemStyleIconColorSet();
108 $color1 = new ilSystemStyleIconColor("555555", "555555", "555555", "555555");
109 $color2 = new ilSystemStyleIconColor("6B6B6B", "6B6B6B", "6B6B6B", "6B6B6B");
110 $color3 = new ilSystemStyleIconColor("838383", "838383", "838383", "838383");
111 $color4 = new ilSystemStyleIconColor("8C8C8C", "8C8C8C", "8C8C8C", "8C8C8C");
112 $expected_color_set->addColor($color1);
113 $expected_color_set->addColor($color2);
114 $expected_color_set->addColor($color3);
115 $expected_color_set->addColor($color4);
116
117 $this->assertEquals($expected_color_set, $icon->getColorSet());
118 }
$path
Definition: aliased.php:25
Abstracts an Icon and the necessary actions to get all colors out of an svg Icon.

References $icon_name, and $path.

◆ testChangeColorInIconFile()

ilSystemStyleIconTest::testChangeColorInIconFile ( )

Definition at line 120 of file ilSystemStyleIconTest.php.

121 {
122 $path = $this->container->getImagesSkinPath($this->style->getId()) . "/" . $this->icon_name;
123 $icon = new ilSystemStyleIcon($this->icon_name, $path, $this->icon_type);
124
125 $icon->changeColors(['505050' => '555555']);
126
127 $expected_color_set = new ilSystemStyleIconColorSet();
128 $color1 = new ilSystemStyleIconColor("555555", "555555", "555555", "555555");
129 $color2 = new ilSystemStyleIconColor("6B6B6B", "6B6B6B", "6B6B6B", "6B6B6B");
130 $color3 = new ilSystemStyleIconColor("838383", "838383", "838383", "838383");
131 $color4 = new ilSystemStyleIconColor("8C8C8C", "8C8C8C", "8C8C8C", "8C8C8C");
132 $expected_color_set->addColor($color1);
133 $expected_color_set->addColor($color2);
134 $expected_color_set->addColor($color3);
135 $expected_color_set->addColor($color4);
136
137 $icon_new = new ilSystemStyleIcon($this->icon_name, $path, $this->icon_type);
138
139 $this->assertEquals($expected_color_set, $icon_new->getColorSet());
140 }

References $icon_name, and $path.

◆ testConstruct()

ilSystemStyleIconTest::testConstruct ( )

Definition at line 72 of file ilSystemStyleIconTest.php.

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 }

References $icon_name, and $path.

◆ testGetColorSet()

ilSystemStyleIconTest::testGetColorSet ( )

Definition at line 82 of file ilSystemStyleIconTest.php.

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 $expected_color_set = new ilSystemStyleIconColorSet();
88 $color1 = new ilSystemStyleIconColor("505050", "505050", "505050", "505050");
89 $color2 = new ilSystemStyleIconColor("6B6B6B", "6B6B6B", "6B6B6B", "6B6B6B");
90 $color3 = new ilSystemStyleIconColor("838383", "838383", "838383", "838383");
91 $color4 = new ilSystemStyleIconColor("8C8C8C", "8C8C8C", "8C8C8C", "8C8C8C");
92 $expected_color_set->addColor($color1);
93 $expected_color_set->addColor($color2);
94 $expected_color_set->addColor($color3);
95 $expected_color_set->addColor($color4);
96
97 $this->assertEquals($expected_color_set, $icon->getColorSet());
98 }

References $icon_name, and $path.

Field Documentation

◆ $container

ilSystemStyleIconTest::$container
protected

Definition at line 28 of file ilSystemStyleIconTest.php.

◆ $icon_name

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

◆ $icon_type

ilSystemStyleIconTest::$icon_type = "svg"
protected

Definition at line 43 of file ilSystemStyleIconTest.php.

◆ $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: