ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ChartProgressMeterTest Class Reference

Test on ProgressMeter implementation. More...

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

Public Member Functions

 testImplementsFactoryInterface ()
 
 testGetInstances ()
 
 testGetValuesOfStandard ()
 
 testGetValuesOfFixedSize ()
 
 testGetValuesOfMini ()
 
 testRenderStandardTwoBar ()
 
 testRenderFixedSizeOneBar ()
 
 testRenderMini ()
 

Protected Member Functions

 getFactory ()
 

Detailed Description

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 testGetInstances(), testGetValuesOfFixedSize(), testGetValuesOfMini(), testGetValuesOfStandard(), testImplementsFactoryInterface(), testRenderFixedSizeOneBar(), testRenderMini(), and testRenderStandardTwoBar().

+ Here is the caller graph for this function:

◆ testGetInstances()

ChartProgressMeterTest::testGetInstances ( )

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:

◆ testGetValuesOfFixedSize()

ChartProgressMeterTest::testGetValuesOfFixedSize ( )

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:

◆ testGetValuesOfMini()

ChartProgressMeterTest::testGetValuesOfMini ( )

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:

◆ testGetValuesOfStandard()

ChartProgressMeterTest::testGetValuesOfStandard ( )

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:

◆ testImplementsFactoryInterface()

ChartProgressMeterTest::testImplementsFactoryInterface ( )

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:

◆ testRenderFixedSizeOneBar()

ChartProgressMeterTest::testRenderFixedSizeOneBar ( )

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="71, 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(86.5deg)">' .
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 }

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

+ Here is the call graph for this function:

◆ testRenderMini()

ChartProgressMeterTest::testRenderMini ( )

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(65.5deg)"></path>' .
196 '</svg>' .
197 '</div>' .
198 '</div>';
199
200 $this->assertHTMLEquals($expected_html, $html);
201 }

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

+ Here is the call graph for this function:

◆ testRenderStandardTwoBar()

ChartProgressMeterTest::testRenderStandardTwoBar ( )

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(86.5deg)">' .
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, and getFactory().

+ Here is the call graph for this function:

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