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");
49 protected function setUp() : void
53 $this->save_dic =
$DIC;
58 mkdir($this->system_style_config->test_skin_temp_path);
62 $this->style = $this->container->getSkin()->getStyle(
"style1");
77 $this->assertEquals($this->container->getImagesSkinPath($this->style->getId()), $folder->getPath());
83 $folder->setPath(
"pathnew");
85 $this->assertEquals(
"pathnew", $folder->getPath());
92 $this->assertEquals(5, count($folder->getIcons()));
99 $this->assertTrue(
false);
107 $style_path = $this->container->getImagesSkinPath($this->style->getId());
109 $path1 = $style_path .
"/test_image_1.svg";
112 $this->assertEquals($icon1, $folder->getIconByName(
"test_image_1.svg"));
117 $style_path = $this->container->getImagesSkinPath($this->style->getId());
119 $path1 = $style_path .
"/test_image_1.svg";
122 $this->assertEquals($icon1, $folder->getIconByPath($path1));
130 $folder->getIconByName(
"doesNotExist.svg");
131 $this->assertTrue(
false);
139 $style_path = $this->container->getImagesSkinPath($this->style->getId());
141 $path1 = $style_path .
"/test_image_1.svg";
144 $path2 = $style_path .
"/image_subfolder/sub_test_image_1.svg";
147 $path3 = $style_path .
"/image_subfolder/sub_test_image_2.svg";
150 $path4 = $style_path .
"/nonsvg.png";
153 $path5 = $style_path .
"/icon_accs.svg";
156 $expected_icons = [$icon5,$icon2,$icon3,$icon1,$icon4];
159 $this->assertEquals($expected_icons, $folder->getIcons());
164 $style_path = $this->container->getImagesSkinPath($this->style->getId());
166 $path1 = $style_path .
"/test_image_1.svg";
169 $path2 = $style_path .
"/image_subfolder/sub_test_image_1.svg";
172 $path3 = $style_path .
"/image_subfolder/sub_test_image_2.svg";
175 $path4 = $style_path .
"/nonsvg.png";
178 $path5 = $style_path .
"/icon_accs.svg";
182 $style_path => [$icon5,$icon1,$icon4],
183 $style_path .
"/image_subfolder" => [$icon2,$icon3],
187 $this->assertEquals($expected_icons, $folder->getIconsSortedByFolder());
203 $expected_color_set->addColor($color1);
204 $expected_color_set->addColor($color2);
205 $expected_color_set->addColor($color3);
206 $expected_color_set->addColor($color4);
207 $expected_color_set->addColor($color5);
208 $expected_color_set->addColor($color6);
209 $expected_color_set->addColor($color7);
211 $this->assertEquals($expected_color_set, $folder->getColorSet());
217 $folder1->changeIconColors([
"505050" =>
"555555"]);
230 $expected_color_set->addColor($color2);
231 $expected_color_set->addColor($color3);
232 $expected_color_set->addColor($color4);
233 $expected_color_set->addColor($color5);
234 $expected_color_set->addColor($color6);
235 $expected_color_set->addColor($color1);
236 $expected_color_set->addColor($color7);
238 $this->assertEquals($expected_color_set, $folder2->getColorSet());
243 $style_path = $this->container->getImagesSkinPath($this->style->getId());
247 $path1 = $style_path .
"/test_image_1.svg";
249 $icon1->getColorSet();
251 $path2 = $style_path .
"/image_subfolder/sub_test_image_1.svg";
253 $icon2->getColorSet();
255 $path3 = $style_path .
"/image_subfolder/sub_test_image_2.svg";
257 $icon3->getColorSet();
259 $expected_icons_usages = [$icon2,$icon3,$icon1];
261 $this->assertEquals($expected_icons_usages, $folder1->getUsagesOfColor(
"id_6B6B6B"));
266 $style_path = $this->container->getImagesSkinPath($this->style->getId());
269 $folder1->changeIconColors([
"6B6B6B" =>
"7B6B6B"]);
273 $path1 = $style_path .
"/test_image_1.svg";
275 $icon1->getColorSet();
277 $path2 = $style_path .
"/image_subfolder/sub_test_image_1.svg";
279 $icon2->getColorSet();
281 $path3 = $style_path .
"/image_subfolder/sub_test_image_2.svg";
283 $icon3->getColorSet();
285 $expected_icons_usages = [$icon2,$icon3,$icon1];
287 $this->assertEquals($expected_icons_usages, $folder2->getUsagesOfColor(
"id_7B6B6B"));
288 $this->assertEquals([], $folder2->getUsagesOfColor(
"id_6B6B6B"));
296 'sub_test_image_1; sub_test_image_2; test_image_1; ',
297 $folder1->getUsagesOfColorAsString(
"id_6B6B6B")
Class for advanced editing exception handling in ILIAS.
testReadRecursiveAndSortByName()
testFolderGetIconByName()
Abstracts an Icon and the necessary actions to get all colors out of an svg Icon. ...
testFolderGetIconByPath()
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()