ILIAS  release_8 Revision v8.24
ChartProgressMeterTest Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ChartProgressMeterTest:
+ Collaboration diagram for ChartProgressMeterTest:

Public Member Functions

 test_implements_factory_interface ()
 
 test_get_instances ()
 
 test_get_values_of_standard ()
 
 test_get_values_of_fixedSize ()
 
 test_get_values_of_mini ()
 
 test_render_standard_two_bar ()
 
 test_render_fixedSize_one_bar ()
 
 test_render_mini ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML (string $html)
 
 assertHTMLEquals (string $expected_html_as_string, string $html_as_string)
 

Protected Member Functions

 getFactory ()
 
- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML (string $html)
 A more radical version of normalizeHTML. More...
 
 brutallyTrimSignals (string $html)
 A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output. More...
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Test on ProgressMeter implementation.

Definition at line 30 of file ChartProgressMeterTest.php.

Member Function Documentation

◆ getFactory()

ChartProgressMeterTest::getFactory ( )
protected

Definition at line 32 of file ChartProgressMeterTest.php.

32 : C\Chart\ProgressMeter\Factory
33 {
34 return new I\Component\Chart\ProgressMeter\Factory();
35 }

Referenced by test_get_instances(), test_get_values_of_fixedSize(), test_get_values_of_mini(), test_get_values_of_standard(), test_implements_factory_interface(), test_render_fixedSize_one_bar(), test_render_mini(), and test_render_standard_two_bar().

+ Here is the caller graph for this function:

◆ test_get_instances()

ChartProgressMeterTest::test_get_instances ( )

Definition at line 44 of file ChartProgressMeterTest.php.

44 : void
45 {
46 $progressmeter = $this->getFactory();
47
48 $standard = $progressmeter->standard(400, 250);
49 $this->assertInstanceOf("ILIAS\\UI\\Component\\Chart\\ProgressMeter\\Standard", $standard);
50
51 $fixedSize = $progressmeter->fixedSize(400, 250);
52 $this->assertInstanceOf("ILIAS\\UI\\Component\\Chart\\ProgressMeter\\FixedSize", $fixedSize);
53
54 $mini = $progressmeter->mini(400, 250);
55 $this->assertInstanceOf("ILIAS\\UI\\Component\\Chart\\ProgressMeter\\Mini", $mini);
56 }

References getFactory().

+ Here is the call graph for this function:

◆ test_get_values_of_fixedSize()

ChartProgressMeterTest::test_get_values_of_fixedSize ( )

Definition at line 72 of file ChartProgressMeterTest.php.

72 : void
73 {
74 $f = $this->getFactory();
75 $fixedSize = $f->fixedSize(400, 250, 300, 200);
76
77 $this->assertEquals(400, $fixedSize->getMaximum());
78 $this->assertEquals(250, $fixedSize->getMainValue());
79 $this->assertEquals(63, $fixedSize->getMainValueAsPercent());
80 $this->assertEquals(300, $fixedSize->getRequired());
81 $this->assertEquals(75, $fixedSize->getRequiredAsPercent());
82 $this->assertEquals(200, $fixedSize->getComparison());
83 $this->assertEquals(50, $fixedSize->getComparisonAsPercent());
84 }

References Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ test_get_values_of_mini()

ChartProgressMeterTest::test_get_values_of_mini ( )

Definition at line 86 of file ChartProgressMeterTest.php.

86 : void
87 {
88 $f = $this->getFactory();
89 $mini = $f->mini(400, 250, 300);
90
91 $this->assertEquals(400, $mini->getMaximum());
92 $this->assertEquals(250, $mini->getMainValue());
93 $this->assertEquals(63, $mini->getMainValueAsPercent());
94 $this->assertEquals(300, $mini->getRequired());
95 $this->assertEquals(75, $mini->getRequiredAsPercent());
96 }

References Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ test_get_values_of_standard()

ChartProgressMeterTest::test_get_values_of_standard ( )

Definition at line 58 of file ChartProgressMeterTest.php.

58 : void
59 {
60 $f = $this->getFactory();
61 $standard = $f->standard(400, 250, 300, 200);
62
63 $this->assertEquals(400, $standard->getMaximum());
64 $this->assertEquals(250, $standard->getMainValue());
65 $this->assertEquals(63, $standard->getMainValueAsPercent());
66 $this->assertEquals(300, $standard->getRequired());
67 $this->assertEquals(75, $standard->getRequiredAsPercent());
68 $this->assertEquals(200, $standard->getComparison());
69 $this->assertEquals(50, $standard->getComparisonAsPercent());
70 }

References Vendor\Package\$f, and getFactory().

+ Here is the call graph for this function:

◆ test_implements_factory_interface()

ChartProgressMeterTest::test_implements_factory_interface ( )

Definition at line 37 of file ChartProgressMeterTest.php.

37 : void
38 {
39 $progressmeter = $this->getFactory();
40
41 $this->assertInstanceOf("ILIAS\\UI\\Component\\Chart\\ProgressMeter\\Factory", $progressmeter);
42 }

References getFactory().

+ Here is the call graph for this function:

◆ test_render_fixedSize_one_bar()

ChartProgressMeterTest::test_render_fixedSize_one_bar ( )

Definition at line 139 of file ChartProgressMeterTest.php.

139 : void
140 {
141 $r = $this->getDefaultRenderer();
142 $f = $this->getFactory();
143 $fixedSize = $f->fixedSize(100, 75, 80, null, 300);
144
145 $this->assertInstanceOf("ILIAS\\UI\\Component\\Chart\\ProgressMeter\\FixedSize", $fixedSize);
146
147 $html = $r->render($fixedSize);
148
149 $expected_html =
150 '<div class="il-chart-progressmeter-box fixed-size">' .
151 '<div class="il-chart-progressmeter-container">' .
152 '<svg viewBox="0 0 50 40" class="il-chart-progressmeter-viewbox">' .
153 '<path class="il-chart-progressmeter-circle-bg" stroke-dasharray="100, 100" ' .
154 'd="M10.4646,37.0354 q-5.858,-5.858 -5.858,-14.142 a1,1 0 1,1 40,0 q0,8.284 -5.858,14.142"></path>' .
155 '<g class="il-chart-progressmeter-monocircle">' .
156 '<path class="il-chart-progressmeter-circle no-success" stroke-dasharray="75, 100" ' .
157 'd="M10.4646,37.0354 q-5.858,-5.858 -5.858,-14.142 a1,1 0 1,1 40,0 q0,8.284 -5.858,14.142"></path>' .
158 '</g>' .
159 '<g class="il-chart-progressmeter-text">' .
160 '<text class="text-score-info" x="25" y="16"></text>' .
161 '<text class="text-score" x="25" y="25">75 %</text>' .
162 '<text class="text-comparision" x="25" y="31">80 %</text>' .
163 '<text class="text-comparision-info" x="25" y="34"></text>' .
164 '</g>' .
165 '<g class="il-chart-progressmeter-needle " style="transform: rotate(82.8deg)">' .
166 '<polygon class="il-chart-progressmeter-needle-border" points="23.5,0.1 25,2.3 26.5,0.1"></polygon>' .
167 '<polygon class="il-chart-progressmeter-needle-fill" points="23.5,0 25,2.2 26.5,0"></polygon>' .
168 '</g>' .
169 '</svg>' .
170 '</div>' .
171 '</div>';
172
173 $this->assertHTMLEquals($expected_html, $html);
174 }
assertHTMLEquals(string $expected_html_as_string, string $html_as_string)
Definition: Base.php:427
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355

References Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

+ Here is the call graph for this function:

◆ test_render_mini()

ChartProgressMeterTest::test_render_mini ( )

Definition at line 176 of file ChartProgressMeterTest.php.

176 : void
177 {
178 $r = $this->getDefaultRenderer();
179 $f = $this->getFactory();
180 $mini = $f->mini(400, 250, 300);
181
182 $this->assertInstanceOf("ILIAS\\UI\\Component\\Chart\\ProgressMeter\\Mini", $mini);
183
184 $html = $r->render($mini);
185
186 $expected_html =
187 '<div class="il-chart-progressmeter-box il-chart-progressmeter-mini">' .
188 '<div class="il-chart-progressmeter-container">' .
189 '<svg viewBox="0 0 50 40" class="il-chart-progressmeter-viewbox">' .
190 '<path class="il-chart-progressmeter-circle-bg" stroke-dasharray="100, 100" ' .
191 'd="M9,35 q-4.3934,-4.3934 -4.3934,-10.6066 a1,1 0 1,1 40,0 q0,6.2132 -4.3934,10.6066"></path>' .
192 '<path class="il-chart-progressmeter-circle no-success" stroke-dasharray="54.495, 100" ' .
193 'd="M9,35 q-4.3934,-4.3934 -4.3934,-10.6066 a1,1 0 1,1 40,0 q0,6.2132 -4.3934,10.6066"></path>' .
194 '<path class="il-chart-progressmeter-needle " stroke-dasharray="100, 100" d="M25,10 l0,15" ' .
195 'style="transform: rotate(57.5deg)"></path>' .
196 '</svg>' .
197 '</div>' .
198 '</div>';
199
200 $this->assertHTMLEquals($expected_html, $html);
201 }

References Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

+ Here is the call graph for this function:

◆ test_render_standard_two_bar()

ChartProgressMeterTest::test_render_standard_two_bar ( )

Definition at line 98 of file ChartProgressMeterTest.php.

98 : void
99 {
100 $r = $this->getDefaultRenderer();
101 $f = $this->getFactory();
102 $standard = $f->standard(100, 75, 80, 50);
103
104 $this->assertInstanceOf("ILIAS\\UI\\Component\\Chart\\ProgressMeter\\Standard", $standard);
105
106 $html = $r->render($standard);
107
108 $expected_html =
109 '<div class="il-chart-progressmeter-box ">' .
110 '<div class="il-chart-progressmeter-container">' .
111 '<svg viewBox="0 0 50 40" class="il-chart-progressmeter-viewbox">' .
112 '<path class="il-chart-progressmeter-circle-bg" stroke-dasharray="100, 100" ' .
113 'd="M10.4646,37.0354 q-5.858,-5.858 -5.858,-14.142 a1,1 0 1,1 40,0 q0,8.284 -5.858,14.142"></path>' .
114 '<g class="il-chart-progressmeter-multicircle">' .
115 '<path class="il-chart-progressmeter-circle no-success" ' .
116 'd="M9.6514,37.8486 q-6.1948,-6.1948 -6.1948,-14.9552 a1,1 0 1,1 42.30,0 q0,8.7604 -6.1948,14.9552" ' .
117 'stroke-dasharray="75, 100"></path>' .
118 '<path class="il-chart-progressmeter-circle active" ' .
119 'd="M11.2778,36.2222 q-5.5212,-5.5212 -5.5212,-13.3288 a1,1 0 1,1 37.70,0 q0,7.8076 -5.5212,13.3288" ' .
120 'stroke-dasharray="44.4, 100"></path>' .
121 '</g>' .
122 '<g class="il-chart-progressmeter-text">' .
123 '<text class="text-score-info" x="25" y="16"></text>' .
124 '<text class="text-score" x="25" y="25">75 %</text>' .
125 '<text class="text-comparision" x="25" y="31">80 %</text>' .
126 '<text class="text-comparision-info" x="25" y="34"></text>' .
127 '</g>' .
128 '<g class="il-chart-progressmeter-needle " style="transform: rotate(82.8deg)">' .
129 '<polygon class="il-chart-progressmeter-needle-border" points="23.5,0.1 25,2.3 26.5,0.1"></polygon>' .
130 '<polygon class="il-chart-progressmeter-needle-fill" points="23.5,0 25,2.2 26.5,0"></polygon>' .
131 '</g>' .
132 '</svg>' .
133 '</div>' .
134 '</div>';
135
136 $this->assertHTMLEquals($expected_html, $html);
137 }

References Vendor\Package\$f, ILIAS_UI_TestBase\assertHTMLEquals(), ILIAS_UI_TestBase\getDefaultRenderer(), and getFactory().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: