3include_once(
"Services/Style/System/classes/Utilities/class.ilSkinStyleXML.php");
4include_once(
"Services/Style/System/classes/Utilities/class.ilSkinXML.php");
5include_once(
"Services/Style/System/classes/Utilities/class.ilSystemStyleSkinContainer.php");
6include_once(
"Services/Style/System/test/fixtures/mocks/ilSystemStyleConfigMock.php");
7include_once(
"Services/Style/System/test/fixtures/mocks/ilSystemStyleDICMock.php");
9include_once(
"Services/Style/System/classes/Icons/class.ilSystemStyleIcon.php");
10include_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"));
120 $folder->getIconByName(
"doesNotExist.svg");
121 $this->assertTrue(
false);
129 $style_path = $this->container->getImagesSkinPath($this->style->getId());
131 $path1 = $style_path .
"/test_image_1.svg";
134 $path2 = $style_path .
"/image_subfolder/sub_test_image_1.svg";
137 $path3 = $style_path .
"/image_subfolder/sub_test_image_2.svg";
140 $path4 = $style_path .
"/nonsvg.png";
143 $expected_icons = [$icon2,$icon3,$icon1,$icon4];
146 $this->assertEquals($expected_icons,$folder->getIcons());
151 $style_path = $this->container->getImagesSkinPath($this->style->getId());
153 $path1 = $style_path.
"/test_image_1.svg";
156 $path2 = $style_path .
"/image_subfolder/sub_test_image_1.svg";
159 $path3 = $style_path .
"/image_subfolder/sub_test_image_2.svg";
162 $path4 = $style_path .
"/nonsvg.png";
166 $style_path => [$icon1,$icon4],
167 $style_path.
"/image_subfolder" => [$icon2,$icon3],
171 $this->assertEquals($expected_icons,$folder->getIconsSortedByFolder());
186 $expected_color_set->addColor($color1);
187 $expected_color_set->addColor($color2);
188 $expected_color_set->addColor($color3);
189 $expected_color_set->addColor($color4);
190 $expected_color_set->addColor($color5);
191 $expected_color_set->addColor($color6);
193 $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());
221 $style_path = $this->container->getImagesSkinPath($this->style->getId());
225 $path1 = $style_path .
"/test_image_1.svg";
227 $icon1->getColorSet();
229 $path2 = $style_path .
"/image_subfolder/sub_test_image_1.svg";
231 $icon2->getColorSet();
233 $path3 = $style_path .
"/image_subfolder/sub_test_image_2.svg";
235 $icon3->getColorSet();
237 $expected_icons_usages = [$icon2,$icon3,$icon1];
239 $this->assertEquals($expected_icons_usages,$folder1->getUsagesOfColor(
"6B6B6B"));
243 $style_path = $this->container->getImagesSkinPath($this->style->getId());
246 $folder1->changeIconColors([
"6B6B6B"=>
"7B6B6B"]);
250 $path1 = $style_path .
"/test_image_1.svg";
252 $icon1->getColorSet();
254 $path2 = $style_path .
"/image_subfolder/sub_test_image_1.svg";
256 $icon2->getColorSet();
258 $path3 = $style_path .
"/image_subfolder/sub_test_image_2.svg";
260 $icon3->getColorSet();
262 $expected_icons_usages = [$icon2,$icon3,$icon1];
264 $this->assertEquals($expected_icons_usages,$folder2->getUsagesOfColor(
"7B6B6B"));
265 $this->assertEquals([],$folder2->getUsagesOfColor(
"6B6B6B"));
271 $this->assertEquals(
'sub_test_image_1; sub_test_image_2; test_image_1; ' ,
272 $folder1->getUsagesOfColorAsString(
"6B6B6B"));
An exception for terminatinating execution or to throw for unit testing.
ilSystemStyleConfig wraps all 'constants' to ensure the testability of all classes using those 'const...
Class for advanced editing exception handling in ILIAS.
const IMAGES_FOLDER_DOES_NOT_EXIST
const ICON_DOES_NOT_EXIST
testReadRecursiveAndSortByFolder()
testGetUsagesAfterChangeColor()
testExtractChangeColors()
testReadRecursiveAndSortByName()
Abstracts a folder containing a set of icons.
Abstracts an Icon and the necessary actions to get all colors out of an svg Icon.
static recursiveRemoveDir($dir)
Recursive delete of a folder.
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.