Debian Codegraph @

dojox/gfx/tests/performance/gfx_primitives.html

raw symbols SCIP
1 <html>
2 <head>
3 <title>Testing Primitives</title>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <style type="text/css">
6 @import "../../../../dojo/resources/dojo.css";
7 @import "../../../../dijit/tests/css/dijitTests.css";
8 </style>
9 <script type="text/javascript" src="../../../../dojo/dojo.js" data-dojo-config="isDebug: true"></script>
10 <script type="text/javascript" src="../../../../util/doh/runner.js"></script>
11 <script type="text/javascript">
12 dojo.require("doh.runner");
13 dojo.require("dojox.gfx");
14
15 var surface;
16 createSurface = function(){
17 surface = dojox.gfx.createSurface("test", 500, 500);
18 };
19
20 destroySurface = function(){
21 if(surface){
22 surface.destroy();
23 surface = null;
24 }
25 }
26
27 var imageHref;
28
29 dojo.addOnLoad(function(){
30 imageHref = dojo.moduleUrl("dojox", "gfx/tests/performance/images/testImage.jpg").toString();
31 doh.register("gfx.primitives.performance", [
32 {
33 name: "Line",
34 testType: "perf",
35 trialDuration: 100,
36 trialDelay: 50,
37 trialIterations: 50,
38 setUp: function() {
39 createSurface();
40 },
41 tearDown: function(){
42 destroySurface();
43 },
44 runTest: function(){
45 surface.clear();
46 var path = surface.createLine({
47 x: 100,
48 y: 100,
49 x1: 200,
50 y1: 200
51 }).setStroke({color: "black"});
52 }
53 },
54 {
55 name: "PolyLine",
56 testType: "perf",
57 trialDuration: 100,
58 trialDelay: 50,
59 trialIterations: 50,
60 setUp: function() {
61 createSurface();
62 },
63 tearDown: function(){
64 destroySurface();
65 },
66 runTest: function(){
67 surface.clear();
68 var path = surface.createPolyline([{
69 x: 100,
70 y: 100
71 },{
72 x: 200,
73 y: 200
74 },{
75 x: 150,
76 y: 200
77 },{
78 x: 150,
79 y: 100
80 }
81 ]).setStroke({color: "black"});
82 }
83 },
84 {
85 name: "Path (lineTo)",
86 testType: "perf",
87 trialDuration: 100,
88 trialDelay: 50,
89 trialIterations: 50,
90 setUp: function() {
91 createSurface();
92 },
93 tearDown: function(){
94 destroySurface();
95 },
96 runTest: function(){
97 surface.clear();
98 var path = surface.createPath();
99 path.moveTo(100,100);
100 path.lineTo(200, 200);
101 path.lineTo(150, 200);
102 path.lineTo(150, 100);
103 path.setStroke({color: "black"});
104 }
105 },
106 {
107 name: "Path (hLineTo)",
108 testType: "perf",
109 trialDuration: 100,
110 trialDelay: 50,
111 trialIterations: 50,
112 setUp: function() {
113 createSurface();
114 },
115 tearDown: function(){
116 destroySurface();
117 },
118 runTest: function(){
119 surface.clear();
120 var path = surface.createPath();
121 path.moveTo(100,100);
122 path.hLineTo(200);
123 path.setStroke({color: "black"});
124 }
125 },
126 {
127 name: "Path (vLineTo)",
128 testType: "perf",
129 trialDuration: 100,
130 trialDelay: 50,
131 trialIterations: 50,
132 setUp: function() {
133 createSurface();
134 },
135 tearDown: function(){
136 destroySurface();
137 },
138 runTest: function(){
139 surface.clear();
140 var path = surface.createPath();
141 path.moveTo(100,100);
142 path.vLineTo(200);
143 path.setStroke({color: "black"});
144 }
145 },
146 {
147 name: "Path (qCurveTo)",
148 testType: "perf",
149 trialDuration: 100,
150 trialDelay: 50,
151 trialIterations: 50,
152 setUp: function() {
153 createSurface();
154 },
155 tearDown: function(){
156 destroySurface();
157 },
158 runTest: function(){
159 surface.clear();
160 var path = surface.createPath();
161 path.moveTo(50,50);
162 path.qCurveTo(175,150, 200,200);
163 path.setStroke({color: "black"});
164 }
165 },
166 {
167 name: "Path (qSmoothCurveTo)",
168 testType: "perf",
169 trialDuration: 100,
170 trialDelay: 50,
171 trialIterations: 50,
172 setUp: function() {
173 createSurface();
174 },
175 tearDown: function(){
176 destroySurface();
177 },
178 runTest: function(){
179 surface.clear();
180 var path = surface.createPath();
181 path.moveTo(50,50);
182 path.qCurveTo(175,150, 200,200);
183 path.qSmoothCurveTo(100,300);
184 path.setStroke({color: "black"});
185 }
186 },
187 {
188 name: "Path (arcTo)",
189 testType: "perf",
190 trialDuration: 100,
191 trialDelay: 50,
192 trialIterations: 50,
193 setUp: function() {
194 createSurface();
195 },
196 tearDown: function(){
197 destroySurface();
198 },
199 runTest: function(){
200 surface.clear();
201 var path = surface.createPath();
202 path.moveTo(50,50);
203 path.arcTo(75, 60, -30, false, true, 200,200);
204 path.setStroke({color: "black"});
205 }
206 },
207 {
208 name: "Image",
209 testType: "perf",
210 trialDuration: 100,
211 trialDelay: 50,
212 trialIterations: 50,
213 setUp: function() {
214 createSurface();
215 },
216 tearDown: function(){
217 destroySurface();
218 },
219 runTest: function(){
220 surface.clear();
221 surface.createImage({
222 src: imageHref,
223 x: 50,
224 y: 50,
225 width: 300,
226 height: 50
227 });
228 }
229 },
230 {
231 name: "Text",
232 testType: "perf",
233 trialDuration: 100,
234 trialDelay: 50,
235 trialIterations: 50,
236 setUp: function() {
237 createSurface();
238 },
239 tearDown: function(){
240 destroySurface();
241 },
242 runTest: function(){
243 surface.clear();
244 surface.createText({
245 x: 50,
246 y: 50,
247 text: "I'm a bunch of text!"
248 }).setStroke({color: "black"});;
249 }
250 },
251 {
252 name: "Textpath",
253 testType: "perf",
254 trialDuration: 100,
255 trialDelay: 50,
256 trialIterations: 50,
257 setUp: function() {
258 createSurface();
259 },
260 tearDown: function(){
261 destroySurface();
262 },
263 runTest: function(){
264 surface.clear();
265 var tp = surface.createTextPath({
266 text: "I'm a bunch of text!"
267 });
268 tp.moveTo(50, 100);
269 tp.arcTo(75, 60, -30, false, true, 200,200);
270 tp.setStroke({color: "black"});
271 }
272 },
273 {
274 name: "Rectangle",
275 testType: "perf",
276 trialDuration: 100,
277 trialDelay: 50,
278 trialIterations: 50,
279 setUp: function() {
280 createSurface();
281 },
282 tearDown: function(){
283 destroySurface();
284 },
285 runTest: function(){
286 surface.clear();
287 surface.createRect({
288 x: 100,
289 y: 100,
290 width: 200,
291 height: 50
292 }).setStroke({color: "black"});
293 }
294 },
295 {
296 name: "Circle",
297 testType: "perf",
298 trialDuration: 100,
299 trialDelay: 50,
300 trialIterations: 50,
301 setUp: function() {
302 createSurface();
303 },
304 tearDown: function(){
305 destroySurface();
306 },
307 runTest: function(){
308 surface.clear();
309 surface.createCircle({
310 cx: 150,
311 cy: 150,
312 r: 100
313 }).setStroke({color: "black"});
314 }
315 },
316 {
317 name: "Ellipse",
318 testType: "perf",
319 trialDuration: 100,
320 trialDelay: 50,
321 trialIterations: 50,
322 setUp: function() {
323 createSurface();
324 },
325 tearDown: function(){
326 destroySurface();
327 },
328 runTest: function(){
329 surface.clear();
330 surface.createEllipse({
331 cx: 150,
332 cy: 150,
333 rx: 100,
334 ry: 50
335 }).setStroke({color: "black"});
336 }
337 }
338 ]);
339 doh.run();
340 });
341 </script>
342 </head>
343 <body>
344 <h1>Testing Primitive Shapes</h1>
345 <div id="test" style="width: 500px; height: 500px;"></div>
346 </body>
347 </html>