3 include_once(
"Services/Style/System/classes/Utilities/class.ilSkinStyleXML.php");
4 include_once(
"Services/Style/System/classes/Utilities/class.ilSkinXML.php");
5 include_once(
"Services/Style/System/classes/Utilities/class.ilSystemStyleSkinContainer.php");
6 include_once(
"Services/Style/System/test/fixtures/mocks/ilSystemStyleConfigMock.php");
7 include_once(
"Services/Style/System/test/fixtures/mocks/ilSystemStyleDICMock.php");
9 include_once(
"Services/Style/System/classes/Icons/class.ilSystemStyleIcon.php");
10 include_once(
"Services/Style/System/classes/Icons/class.ilSystemStyleIconFolder.php");
52 $this->save_dic =
$DIC;
57 mkdir($this->system_style_config->test_skin_temp_path);
61 $this->
style = $this->container->getSkin()->getStyle(
"style1");
76 $this->assertEquals($this->container->getImagesSkinPath($this->style->getId()), $folder->getPath());
82 $folder->setPath(
"pathnew");
84 $this->assertEquals(
"pathnew", $folder->getPath());
91 $this->assertEquals(4, count($folder->getIcons()));
98 $this->assertTrue(
false);
106 $style_path = $this->container->getImagesSkinPath($this->
style->getId());
108 $path1 = $style_path .
"/test_image_1.svg";
111 $this->assertEquals($icon1, $folder->getIconByName(
"test_image_1.svg"));
119 $folder->getIconByName(
"doesNotExist.svg");
120 $this->assertTrue(
false);
128 $style_path = $this->container->getImagesSkinPath($this->
style->getId());
130 $path1 = $style_path .
"/test_image_1.svg";
133 $path2 = $style_path .
"/image_subfolder/sub_test_image_1.svg";
136 $path3 = $style_path .
"/image_subfolder/sub_test_image_2.svg";
139 $path4 = $style_path .
"/nonsvg.png";
142 $expected_icons = [$icon2,$icon3,$icon1,$icon4];
145 $this->assertEquals($expected_icons, $folder->getIcons());
150 $style_path = $this->container->getImagesSkinPath($this->
style->getId());
152 $path1 = $style_path .
"/test_image_1.svg";
155 $path2 = $style_path .
"/image_subfolder/sub_test_image_1.svg";
158 $path3 = $style_path .
"/image_subfolder/sub_test_image_2.svg";
161 $path4 = $style_path .
"/nonsvg.png";
165 $style_path => [$icon1,$icon4],
166 $style_path .
"/image_subfolder" => [$icon2,$icon3],
170 $this->assertEquals($expected_icons, $folder->getIconsSortedByFolder());
185 $expected_color_set->addColor($color1);
186 $expected_color_set->addColor($color2);
187 $expected_color_set->addColor($color3);
188 $expected_color_set->addColor($color4);
189 $expected_color_set->addColor($color5);
190 $expected_color_set->addColor($color6);
192 $this->assertEquals($expected_color_set, $folder->getColorSet());
198 $folder1->changeIconColors([
"505050"=>
"555555"]);
210 $expected_color_set->addColor($color2);
211 $expected_color_set->addColor($color3);
212 $expected_color_set->addColor($color4);
213 $expected_color_set->addColor($color5);
214 $expected_color_set->addColor($color6);
215 $expected_color_set->addColor($color1);
217 $this->assertEquals($expected_color_set, $folder2->getColorSet());
222 $style_path = $this->container->getImagesSkinPath($this->
style->getId());
226 $path1 = $style_path .
"/test_image_1.svg";
228 $icon1->getColorSet();
230 $path2 = $style_path .
"/image_subfolder/sub_test_image_1.svg";
232 $icon2->getColorSet();
234 $path3 = $style_path .
"/image_subfolder/sub_test_image_2.svg";
236 $icon3->getColorSet();
238 $expected_icons_usages = [$icon2,$icon3,$icon1];
240 $this->assertEquals($expected_icons_usages, $folder1->getUsagesOfColor(
"6B6B6B"));
245 $style_path = $this->container->getImagesSkinPath($this->
style->getId());
248 $folder1->changeIconColors([
"6B6B6B"=>
"7B6B6B"]);
252 $path1 = $style_path .
"/test_image_1.svg";
254 $icon1->getColorSet();
256 $path2 = $style_path .
"/image_subfolder/sub_test_image_1.svg";
258 $icon2->getColorSet();
260 $path3 = $style_path .
"/image_subfolder/sub_test_image_2.svg";
262 $icon3->getColorSet();
264 $expected_icons_usages = [$icon2,$icon3,$icon1];
266 $this->assertEquals($expected_icons_usages, $folder2->getUsagesOfColor(
"7B6B6B"));
267 $this->assertEquals([], $folder2->getUsagesOfColor(
"6B6B6B"));
275 'sub_test_image_1; sub_test_image_2; test_image_1; ',
276 $folder1->getUsagesOfColorAsString(
"6B6B6B")
Class for advanced editing exception handling in ILIAS.
testReadRecursiveAndSortByName()
Abstracts an Icon and the necessary actions to get all colors out of an svg Icon. ...
static recursiveRemoveDir($dir)
Recursive delete of a folder.
const IMAGES_FOLDER_DOES_NOT_EXIST
static generateFromId($skin_id, ilSystemStyleMessageStack $message_stack=null, ilSystemStyleConfig $system_styles_conf=null)
Generate the container class by parsing the corresponding XML.
testReadRecursiveAndSortByFolder()
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
Abstracts a folder containing a set of icons.
testExtractChangeColors()
const ICON_DOES_NOT_EXIST
static xCopy($src, $dest)
Recursive copy of a folder.
testGetUsagesAfterChangeColor()