4 require_once(
"libs/composer/vendor/autoload.php");
5 require_once(__DIR__ .
"/../../../Base.php");
7 use \ILIAS\UI\Implementation as
I;
14 const ICON_PATH = __DIR__ .
"/../../../../../templates/default/images/";
19 return new I\Component\Symbol\Icon\Factory();
25 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Symbol\\Icon\\Factory",
$f);
27 $si =
$f->standard(
'course',
'Kurs');
28 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Symbol\\Icon\\Standard",
$si);
30 $ci =
$f->custom(
'course',
'Kurs');
31 $this->assertInstanceOf(
"ILIAS\\UI\\Component\\Symbol\\Icon\\Custom", $ci);
38 $ico =
$f->standard(
'course',
'Kurs');
39 $this->assertEquals(
'Kurs', $ico->getLabel());
40 $this->assertEquals(
'course', $ico->getName());
41 $this->assertEquals(
'small', $ico->getSize());
42 $this->assertEquals(
false, $ico->isDisabled());
43 $this->assertEquals(
false, $ico->isOutlined());
45 $this->assertNull($ico->getAbbreviation());
47 $ico = $ico->withAbbreviation(
'K');
48 $this->assertEquals(
'K', $ico->getAbbreviation());
54 $ico =
$f->standard(
'course',
'Kurs');
56 $ico = $ico->withSize(
'medium');
57 $this->assertEquals(
'medium', $ico->getSize());
59 $ico = $ico->withSize(
'large');
60 $this->assertEquals(
'large', $ico->getSize());
62 $ico = $ico->withSize(
'small');
63 $this->assertEquals(
'small', $ico->getSize());
70 $ico =
$f->standard(
'course',
'Kurs');
71 $ico = $ico->withSize(
'tiny');
72 $this->assertFalse(
"This should not happen");
74 $this->assertTrue(
true);
81 $ico =
$f->standard(
'course',
'Kurs',
'small');
83 $ico = $ico->withDisabled(
false);
84 $this->assertEquals(
false, $ico->isDisabled());
86 $ico = $ico->withDisabled(
true);
87 $this->assertEquals(
true, $ico->isDisabled());
94 $ico =
$f->standard(
'course',
'Kurs',
'small');
95 $ico = $ico->withDisabled(
'true');
96 $this->assertFalse(
"This should not happen");
98 $this->assertTrue(
true);
105 $ico =
$f->standard(
'course',
'Kurs',
'small');
107 $ico = $ico->withIsOutlined(
true);
108 $this->assertEquals(
true, $ico->isOutlined());
110 $ico = $ico->withIsOutlined(
false);
111 $this->assertEquals(
false, $ico->isOutlined());
118 $ico =
$f->custom(
'/some/path/',
'Custom Icon');
119 $this->assertEquals(
'/some/path/', $ico->getIconPath());
124 $ico = $this->
getIconFactory()->standard(
'crs',
'Course',
'medium');
126 $expected =
'<img class="icon crs medium" src="./templates/default/images/icon_crs.svg" alt="Course"/>';
127 $this->assertEquals($expected, $html);
136 $ico = $ico->withDisabled(
true);
138 $expected =
'<img class="icon crs medium disabled" src="./templates/default/images/icon_crs.svg" alt="Course" aria-disabled="true"/>';
139 $this->assertEquals($expected, $html);
147 $ico = $ico->withAbbreviation(
'CRS');
149 $expected = <<<imgtag
150 <img
class=
"icon crs medium" src=
"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4bWxuczp4PSImbnNfZXh0ZW5kOyIgeG1sbnM6aT0iJm5zX2FpOyIgeG1sbnM6Z3JhcGg9IiZuc19ncmFwaHM7Ig0KCSB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjMycHgiIGhlaWdodD0iMzJweCINCgkgdmlld0JveD0iMCAwIDMyIDMyIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAzMiAzMiIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3dpdGNoPg0KCTxnIGk6ZXh0cmFuZW91cz0ic2VsZiI+DQoJCTxyZWN0IHg9IjAiIGZpbGw9Im5vbmUiIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIvPg0KCQk8Zz4NCgkJCTxnPg0KCQkJCTxkZWZzPg0KCQkJCQk8cmVjdCBpZD0iU1ZHSURfMV8iIHg9IjYiIHk9IjQiIH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0wLjU4MmwxLjQ5Ni0zLjI1NmgxMC42OTFsMS40OTYsMy4yNTZDMjMuMDEsMjcuNzg0LDIzLjM3MiwyOCwyMy43NTEsMjgNCgkJCWMwLjE0LDAsMC4yODItMC4wMjksMC40MTctMC4wOTJjMC41MDItMC4yMywwLjcyMi0wLjgyNCwwLjQ5MS0xLjMyNkwyMC43MTYsMThIMjZWMTZ6IE0xOC41OTEsMTguMTY4bDEuODM1LDMuOTk0aC04Ljg1Mw0KCQkJbDEuODM1LTMuOTk0YzAuMDI1LTAuMDU0LDAuMDI1LTAuMTEyLDAuMDQtMC4xNjhoNS4xMDRDMTguNTY2LDE4LjA1NiwxOC41NjYsMTguMTEzLDE4LjU5MSwxOC4xNjh6Ii8+DQoJPC9nPg0KPC9zd2l0Y2g+DQo8dGV4dAogICBzdHlsZT0iCiAgICAgIGZvbnQtc3R5bGU6bm9ybWFsOwogICAgICBmb250LXdlaWdodDpub3JtYWw7CiAgICAgIGZvbnQtc2l6ZToxNHB4OwogICAgICBmb250LWZhbWlseTpzYW5zLXNlcmlmOwogICAgICBsZXR0ZXItc3BhY2luZzowcHg7CiAgICAgIGZpbGw6IzAwMDsKICAgICAgZmlsbC1vcGFjaXR5OjE7CiAgICAiCiAgICB4PSI1MCUiCiAgICB5PSI1NSUiCiAgICBkb21pbmFudC1iYXNlbGluZT0ibWlkZGxlIgogICAgdGV4dC1hbmNob3I9Im1pZGRsZSIKICA+Q1JTPC90ZXh0Pjwvc3ZnPg==" alt=
"Course" data-abbreviation=
"CRS"/>
152 $this->assertEquals(trim($expected), trim($html));
160 $ico = $ico->withIsOutlined(
true);
162 $expected =
'<img class="icon crs medium outlined" src="./templates/default/images/outlined/icon_crs.svg" alt="Course"/>';
163 $this->assertEquals($expected, $html);
168 $path =
'./templates/default/images/icon_fold.svg';
169 $ico = $this->
getIconFactory()->custom($path,
'Custom',
'medium');
171 $expected =
'<img class="icon custom medium" src="./templates/default/images/icon_fold.svg" alt="Custom"/>';
172 $this->assertEquals($expected, $html);
179 $default_icons_abr =
$f->standard(
"nothing",
"nothing")->getAllStandardHandles();
181 foreach ($default_icons_abr as $icon_abr) {
182 $path = self::ICON_PATH .
"icon_" . $icon_abr .
".svg";
183 $this->assertTrue(file_exists($path),
"Missing Standard Icon: " . $path);
190 $default_icons_abr =
$f->standard(
"nothing",
"nothing")->getAllStandardHandles();
192 foreach ($default_icons_abr as $icon_abr) {
193 $path = self::ICON_OUTLINED_PATH .
"icon_" . $icon_abr .
".svg";
195 $this->assertTrue(file_exists($path),
"Missing Outlined Icon: " . $path);
204 $ico = $ico->withAdditionalOnLoadCode(
function ($id) {
208 $expected = $this->
normalizeHTML(
'<img id="id_1" class="icon crs medium" src="./templates/default/images/icon_crs.svg" alt="Course"/>');
209 $this->assertEquals($expected, $html);
testDisabledModificationWrongParam()
testRenderingStandardAbbreviation($ico)
testRenderingStandard
testDisabledModification()
testAllOutlinedIconsExist()
testRenderingStandardJSBindable($ico)
testRenderingStandard
testRenderingStandardDisabled($ico)
testRenderingStandard
Provides common functionality for UI tests.
testRenderingStandardOutlined($ico)
testRenderingStandard
testSizeModificationWrongParam()
testAllStandardIconsExist()
testOutlinedModification()
Test on icon implementation.
getDefaultRenderer(JavaScriptBinding $js_binding=null, $with_stub_renderings=[])