6 function init_data() { return testData("2d"); }
8 function loadImages(canvas) {
9 canvas.loadImage('green.png');
10 canvas.loadImage('red.png');
11 canvas.loadImage('rgrg-256x256.png');
12 canvas.loadImage('ggrr-256x256.png');
13 canvas.loadImage('broken.png');
14 if (!canvas.isImageLoaded('green.png'))
18 function test_3args(row) {
19 var canvas = createCanvasObject(row);
20 var ctx = canvas.getContext('2d');
24 ctx.drawImage('green.png', 0, 0);
25 ctx.drawImage('red.png', -100, 0);
26 ctx.drawImage('red.png', 100, 0);
27 ctx.drawImage('red.png', 0, -50);
28 ctx.drawImage('red.png', 0, 50);
30 comparePixel(ctx, 0,0, 0,255,0,255,2);
31 comparePixel(ctx, 99,0, 0,255,0,255,2);
32 comparePixel(ctx, 0,49, 0,255,0,255,2);
33 comparePixel(ctx, 99,49, 0,255,0,255,2);
36 function test_5args(row) {
37 var canvas = createCanvasObject(row);
38 var ctx = canvas.getContext('2d');
42 ctx.fillStyle = '#f00';
43 ctx.fillRect(0, 0, 100, 50);
44 ctx.drawImage('green.png', 50, 0, 50, 50);
45 ctx.drawImage('red.png', 0, 0, 50, 50);
46 ctx.fillStyle = '#0f0';
47 ctx.fillRect(0, 0, 50, 50);
49 comparePixel(ctx, 0,0, 0,255,0,255,2);
50 comparePixel(ctx, 99,0, 0,255,0,255,2);
51 comparePixel(ctx, 0,49, 0,255,0,255,2);
52 comparePixel(ctx, 99,49, 0,255,0,255,2);
55 function test_9args(row) {
56 var canvas = createCanvasObject(row);
57 var ctx = canvas.getContext('2d');
60 ctx.fillStyle = '#f00';
61 ctx.fillRect(0, 0, 100, 50);
62 ctx.drawImage('green.png', 0, 0, 100, 50, 0, 0, 100, 50);
63 comparePixel(ctx, 0,0, 0,255,0,255,2);
64 comparePixel(ctx, 99,0, 0,255,0,255,2);
65 comparePixel(ctx, 0,49, 0,255,0,255,2);
66 comparePixel(ctx, 99,49, 0,255,0,255,2);
70 ctx.fillStyle = '#f00';
71 ctx.fillRect(0, 0, 100, 50);
72 ctx.drawImage('green.png', 0, 0, 100, 50, 0, 0, 100, 50);
73 ctx.drawImage('red.png', 0, 0, 100, 50, -100, 0, 100, 50);
74 ctx.drawImage('red.png', 0, 0, 100, 50, 100, 0, 100, 50);
75 ctx.drawImage('red.png', 0, 0, 100, 50, 0, -50, 100, 50);
76 ctx.drawImage('red.png', 0, 0, 100, 50, 0, 50, 100, 50);
77 comparePixel(ctx, 0,0, 0,255,0,255,2);
78 comparePixel(ctx, 99,0, 0,255,0,255,2);
79 comparePixel(ctx, 0,49, 0,255,0,255,2);
80 comparePixel(ctx, 99,49, 0,255,0,255,2);
83 ctx.fillStyle = '#f00';
84 ctx.fillRect(0, 0, 100, 50);
85 ctx.drawImage('green.png', 1, 1, 1, 1, 0, 0, 100, 50);
86 ctx.drawImage('red.png', 0, 0, 100, 50, -50, 0, 50, 50);
87 ctx.drawImage('red.png', 0, 0, 100, 50, 100, 0, 50, 50);
88 ctx.drawImage('red.png', 0, 0, 100, 50, 0, -25, 100, 25);
89 ctx.drawImage('red.png', 0, 0, 100, 50, 0, 50, 100, 25);
90 comparePixel(ctx, 0,0, 0,255,0,255,2);
91 comparePixel(ctx, 99,0, 0,255,0,255,2);
92 comparePixel(ctx, 0,49, 0,255,0,255,2);
93 comparePixel(ctx, 99,49, 0,255,0,255,2);
95 ctx.fillStyle = '#f00';
96 ctx.fillRect(0, 0, 100, 50);
97 ctx.drawImage('rgrg-256x256.png', 140, 20, 100, 50, 0, 0, 100, 50);
98 comparePixel(ctx, 0,0, 0,255,0,255,2);
99 comparePixel(ctx, 99,0, 0,255,0,255,2);
100 comparePixel(ctx, 0,49, 0,255,0,255,2);
101 comparePixel(ctx, 99,49, 0,255,0,255,2);
103 ctx.fillStyle = '#f00';
104 ctx.fillRect(0, 0, 100, 50);
105 ctx.drawImage('rgrg-256x256.png', 0, 0, 256, 256, 0, 0, 100, 50);
106 ctx.fillStyle = '#0f0';
107 ctx.fillRect(0, 0, 51, 26);
108 ctx.fillRect(49, 24, 51, 26);
109 comparePixel(ctx, 0,0, 0,255,0,255,2);
110 comparePixel(ctx, 99,0, 0,255,0,255,2);
111 comparePixel(ctx, 0,49, 0,255,0,255,2);
112 comparePixel(ctx, 99,49, 0,255,0,255,2);
113 comparePixel(ctx, 20,20, 0,255,0,255,2);
114 comparePixel(ctx, 80,20, 0,255,0,255,2);
115 comparePixel(ctx, 20,30, 0,255,0,255,2);
116 comparePixel(ctx, 80,30, 0,255,0,255,2);
119 function test_animated(row) {
120 var canvas = createCanvasObject(row);
121 var ctx = canvas.getContext('2d');
124 //should animated image be supported at all?
126 function test_clip(row) {
127 var canvas = createCanvasObject(row);
128 var ctx = canvas.getContext('2d');
131 ctx.fillStyle = '#0f0';
132 ctx.fillRect(0, 0, 100, 50);
133 ctx.rect(-10, -10, 1, 1);
135 ctx.drawImage('red.png', 0, 0);
136 comparePixel(ctx, 50,25, 0,255,0,255,2);
140 function test_self(row) {
141 var canvas = createCanvasObject(row);
142 var ctx = canvas.getContext('2d');
145 ctx.fillStyle = '#0f0';
146 ctx.fillRect(0, 0, 50, 50);
147 ctx.fillStyle = '#f00';
148 ctx.fillRect(50, 0, 50, 50);
149 ctx.drawImage(canvas, 50, 0);
151 comparePixel(ctx, 0,0, 0,255,0,255,2);
152 comparePixel(ctx, 99,0, 0,255,0,255,2);
153 comparePixel(ctx, 0,49, 0,255,0,255,2);
154 comparePixel(ctx, 99,49, 0,255,0,255,2);
157 ctx.fillStyle = '#0f0';
158 ctx.fillRect(0, 1, 100, 49);
159 ctx.fillStyle = '#f00';
160 ctx.fillRect(0, 0, 100, 1);
161 ctx.drawImage(canvas, 0, 1);
162 ctx.fillStyle = '#0f0';
163 ctx.fillRect(0, 0, 100, 2);
165 comparePixel(ctx, 0,0, 0,255,0,255,2);
166 comparePixel(ctx, 99,0, 0,255,0,255,2);
167 comparePixel(ctx, 0,49, 0,255,0,255,2);
168 comparePixel(ctx, 99,49, 0,255,0,255,2);
171 function test_outsidesource(row) {
172 var canvas = createCanvasObject(row);
173 var ctx = canvas.getContext('2d');
177 ctx.drawImage('green.png', 10.5, 10.5, 89.5, 39.5, 0, 0, 100, 50);
178 ctx.drawImage('green.png', 5.5, 5.5, -5.5, -5.5, 0, 0, 100, 50);
179 ctx.drawImage('green.png', 100, 50, -5, -5, 0, 0, 100, 50);
180 try { var err = false;
181 ctx.drawImage('red.png', -0.001, 0, 100, 50, 0, 0, 100, 50);
182 } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', -0.001, 0, 100, 50, 0, 0, 100, 50)"); }
183 try { var err = false;
184 ctx.drawImage('red.png', 0, -0.001, 100, 50, 0, 0, 100, 50);
185 } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', 0, -0.001, 100, 50, 0, 0, 100, 50)"); }
186 try { var err = false;
187 ctx.drawImage('red.png', 0, 0, 100.001, 50, 0, 0, 100, 50);
188 } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', 0, 0, 100.001, 50, 0, 0, 100, 50)"); }
189 try { var err = false;
190 ctx.drawImage('red.png', 0, 0, 100, 50.001, 0, 0, 100, 50);
191 } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', 0, 0, 100, 50.001, 0, 0, 100, 50)"); }
192 try { var err = false;
193 ctx.drawImage('red.png', 50, 0, 50.001, 50, 0, 0, 100, 50);
194 } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', 50, 0, 50.001, 50, 0, 0, 100, 50)"); }
195 try { var err = false;
196 ctx.drawImage('red.png', 0, 0, -5, 5, 0, 0, 100, 50);
197 } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', 0, 0, -5, 5, 0, 0, 100, 50)"); }
198 try { var err = false;
199 ctx.drawImage('red.png', 0, 0, 5, -5, 0, 0, 100, 50);
200 } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', 0, 0, 5, -5, 0, 0, 100, 50)"); }
201 // try { var err = false;
202 // ctx.drawImage('red.png', 110, 60, -20, -20, 0, 0, 100, 50);
203 // } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) fail("Failed assertion: expected exception of type INDEX_SIZE_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type INDEX_SIZE_ERR: ctx.drawImage('red.png', 110, 60, -20, -20, 0, 0, 100, 50)"); }
204 // comparePixel(ctx, 50,25, 0,255,0,255,2);
208 function test_null(row) {
209 var canvas = createCanvasObject(row);
210 var ctx = canvas.getContext('2d');
213 try { var err = false;
214 ctx.drawImage(null, 0, 0);
215 } catch (e) { if (e.code != DOMException.TYPE_MISMATCH_ERR) fail("Failed assertion: expected exception of type TYPE_MISMATCH_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type TYPE_MISMATCH_ERR: ctx.drawImage(null, 0, 0)"); }
219 function test_composite(row) {
220 var canvas = createCanvasObject(row);
221 var ctx = canvas.getContext('2d');
224 ctx.fillStyle = '#0f0';
225 ctx.fillRect(0, 0, 100, 50);
226 ctx.globalCompositeOperation = 'destination-over';
227 ctx.drawImage('red.png', 0, 0);
228 comparePixel(ctx, 50,25, 0,255,0,255,2);
231 function test_path(row) {
232 var canvas = createCanvasObject(row);
233 var ctx = canvas.getContext('2d');
237 function test_transform(row) {
238 var canvas = createCanvasObject(row);
239 var ctx = canvas.getContext('2d');
242 ctx.fillStyle = '#0f0';
243 ctx.fillRect(0, 0, 100, 50);
244 ctx.translate(100, 0);
245 ctx.drawImage('red.png', 0, 0);
246 comparePixel(ctx, 50,25, 0,255,0,255,2);
250 function test_imageitem(row) {
251 var canvas = createCanvasObject(row);
252 var ctx = canvas.getContext('2d');
258 function test_imageData(row) {
259 var canvas = createCanvasObject(row);
260 var ctx = canvas.getContext('2d');
266 function test_wrongtype(row) {
267 var canvas = createCanvasObject(row);
268 var ctx = canvas.getContext('2d');
272 try { var err = false;
273 ctx.drawImage(undefined, 0, 0);
274 } catch (e) { if (e.code != DOMException.TYPE_MISMATCH_ERR) fail("Failed assertion: expected exception of type TYPE_MISMATCH_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type TYPE_MISMATCH_ERR: ctx.drawImage(undefined, 0, 0)"); }
275 try { var err = false;
276 ctx.drawImage(0, 0, 0);
277 } catch (e) { if (e.code != DOMException.TYPE_MISMATCH_ERR) fail("Failed assertion: expected exception of type TYPE_MISMATCH_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type TYPE_MISMATCH_ERR: ctx.drawImage(0, 0, 0)"); }
278 try { var err = false;
279 ctx.drawImage("", 0, 0);
280 } catch (e) { if (e.code != DOMException.TYPE_MISMATCH_ERR) fail("Failed assertion: expected exception of type TYPE_MISMATCH_ERR, got: "+e.message); err = true; } finally { verify(err, "should throw exception of type TYPE_MISMATCH_ERR: ctx.drawImage(\"\", 0, 0)"); }
283 function test_nonfinite(row) {
284 var canvas = createCanvasObject(row);
285 var ctx = canvas.getContext('2d');
288 ctx.fillStyle = '#0f0';
289 ctx.fillRect(0, 0, 100, 50);
291 ctx.drawImage(red, Infinity, 0);
292 ctx.drawImage(red, -Infinity, 0);
293 ctx.drawImage(red, NaN, 0);
294 ctx.drawImage(red, 0, Infinity);
295 ctx.drawImage(red, 0, -Infinity);
296 ctx.drawImage(red, 0, NaN);
297 ctx.drawImage(red, Infinity, Infinity);
298 ctx.drawImage(red, Infinity, 0, 100, 50);
299 ctx.drawImage(red, -Infinity, 0, 100, 50);
300 ctx.drawImage(red, NaN, 0, 100, 50);
301 ctx.drawImage(red, 0, Infinity, 100, 50);
302 ctx.drawImage(red, 0, -Infinity, 100, 50);
303 ctx.drawImage(red, 0, NaN, 100, 50);
304 ctx.drawImage(red, 0, 0, Infinity, 50);
305 ctx.drawImage(red, 0, 0, -Infinity, 50);
306 ctx.drawImage(red, 0, 0, NaN, 50);
307 ctx.drawImage(red, 0, 0, 100, Infinity);
308 ctx.drawImage(red, 0, 0, 100, -Infinity);
309 ctx.drawImage(red, 0, 0, 100, NaN);
310 ctx.drawImage(red, Infinity, Infinity, 100, 50);
311 ctx.drawImage(red, Infinity, Infinity, Infinity, 50);
312 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity);
313 ctx.drawImage(red, Infinity, Infinity, 100, Infinity);
314 ctx.drawImage(red, Infinity, 0, Infinity, 50);
315 ctx.drawImage(red, Infinity, 0, Infinity, Infinity);
316 ctx.drawImage(red, Infinity, 0, 100, Infinity);
317 ctx.drawImage(red, 0, Infinity, Infinity, 50);
318 ctx.drawImage(red, 0, Infinity, Infinity, Infinity);
319 ctx.drawImage(red, 0, Infinity, 100, Infinity);
320 ctx.drawImage(red, 0, 0, Infinity, Infinity);
321 ctx.drawImage(red, Infinity, 0, 100, 50, 0, 0, 100, 50);
322 ctx.drawImage(red, -Infinity, 0, 100, 50, 0, 0, 100, 50);
323 ctx.drawImage(red, NaN, 0, 100, 50, 0, 0, 100, 50);
324 ctx.drawImage(red, 0, Infinity, 100, 50, 0, 0, 100, 50);
325 ctx.drawImage(red, 0, -Infinity, 100, 50, 0, 0, 100, 50);
326 ctx.drawImage(red, 0, NaN, 100, 50, 0, 0, 100, 50);
327 ctx.drawImage(red, 0, 0, Infinity, 50, 0, 0, 100, 50);
328 ctx.drawImage(red, 0, 0, -Infinity, 50, 0, 0, 100, 50);
329 ctx.drawImage(red, 0, 0, NaN, 50, 0, 0, 100, 50);
330 ctx.drawImage(red, 0, 0, 100, Infinity, 0, 0, 100, 50);
331 ctx.drawImage(red, 0, 0, 100, -Infinity, 0, 0, 100, 50);
332 ctx.drawImage(red, 0, 0, 100, NaN, 0, 0, 100, 50);
333 ctx.drawImage(red, 0, 0, 100, 50, Infinity, 0, 100, 50);
334 ctx.drawImage(red, 0, 0, 100, 50, -Infinity, 0, 100, 50);
335 ctx.drawImage(red, 0, 0, 100, 50, NaN, 0, 100, 50);
336 ctx.drawImage(red, 0, 0, 100, 50, 0, Infinity, 100, 50);
337 ctx.drawImage(red, 0, 0, 100, 50, 0, -Infinity, 100, 50);
338 ctx.drawImage(red, 0, 0, 100, 50, 0, NaN, 100, 50);
339 ctx.drawImage(red, 0, 0, 100, 50, 0, 0, Infinity, 50);
340 ctx.drawImage(red, 0, 0, 100, 50, 0, 0, -Infinity, 50);
341 ctx.drawImage(red, 0, 0, 100, 50, 0, 0, NaN, 50);
342 ctx.drawImage(red, 0, 0, 100, 50, 0, 0, 100, Infinity);
343 ctx.drawImage(red, 0, 0, 100, 50, 0, 0, 100, -Infinity);
344 ctx.drawImage(red, 0, 0, 100, 50, 0, 0, 100, NaN);
345 ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, 0, 100, 50);
346 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, 0, 100, 50);
347 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, 50);
348 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, 50);
349 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50);
350 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50);
351 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
352 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity);
353 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50);
354 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity);
355 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity);
356 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, 50);
357 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50);
358 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity);
359 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity);
360 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, 50);
361 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity);
362 ctx.drawImage(red, Infinity, Infinity, Infinity, Infinity, 0, 0, 100, Infinity);
363 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, 50);
364 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, 50);
365 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50);
366 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity);
367 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity);
368 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, 50);
369 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity);
370 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, Infinity, 0, 100, Infinity);
371 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, 50);
372 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, 50);
373 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity);
374 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, Infinity, 100, Infinity);
375 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, 50);
376 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, 0, Infinity, Infinity);
377 ctx.drawImage(red, Infinity, Infinity, Infinity, 50, 0, 0, 100, Infinity);
378 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, 0, 100, 50);
379 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, 50);
380 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, 50);
381 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50);
382 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity);
383 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity);
384 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, 50);
385 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity);
386 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, Infinity, 0, 100, Infinity);
387 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, 50);
388 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, 50);
389 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity);
390 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, Infinity, 100, Infinity);
391 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, 50);
392 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, 0, Infinity, Infinity);
393 ctx.drawImage(red, Infinity, Infinity, 100, Infinity, 0, 0, 100, Infinity);
394 ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, 0, 100, 50);
395 ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, 50);
396 ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, 50);
397 ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity);
398 ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, Infinity, 100, Infinity);
399 ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, 50);
400 ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, 0, Infinity, Infinity);
401 ctx.drawImage(red, Infinity, Infinity, 100, 50, Infinity, 0, 100, Infinity);
402 ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, Infinity, 100, 50);
403 ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, 50);
404 ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, Infinity, Infinity, Infinity);
405 ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, Infinity, 100, Infinity);
406 ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, 0, Infinity, 50);
407 ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, 0, Infinity, Infinity);
408 ctx.drawImage(red, Infinity, Infinity, 100, 50, 0, 0, 100, Infinity);
409 ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, 0, 100, 50);
410 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, 0, 100, 50);
411 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, 50);
412 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, 50);
413 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50);
414 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
415 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity);
416 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, 50);
417 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity);
418 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, Infinity, 0, 100, Infinity);
419 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, 50);
420 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, 50);
421 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity);
422 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, Infinity, 100, Infinity);
423 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, 50);
424 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, 0, Infinity, Infinity);
425 ctx.drawImage(red, Infinity, 0, Infinity, Infinity, 0, 0, 100, Infinity);
426 ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, 0, 100, 50);
427 ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, 50);
428 ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, 50);
429 ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity);
430 ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, Infinity, 100, Infinity);
431 ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, 50);
432 ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, 0, Infinity, Infinity);
433 ctx.drawImage(red, Infinity, 0, Infinity, 50, Infinity, 0, 100, Infinity);
434 ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, Infinity, 100, 50);
435 ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, 50);
436 ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, Infinity, Infinity, Infinity);
437 ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, Infinity, 100, Infinity);
438 ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, 0, Infinity, 50);
439 ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, 0, Infinity, Infinity);
440 ctx.drawImage(red, Infinity, 0, Infinity, 50, 0, 0, 100, Infinity);
441 ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, 0, 100, 50);
442 ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, 0, 100, 50);
443 ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, 50);
444 ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, 50);
445 ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity);
446 ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, Infinity, 100, Infinity);
447 ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, 50);
448 ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, 0, Infinity, Infinity);
449 ctx.drawImage(red, Infinity, 0, 100, Infinity, Infinity, 0, 100, Infinity);
450 ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, Infinity, 100, 50);
451 ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, 50);
452 ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, Infinity, Infinity, Infinity);
453 ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, Infinity, 100, Infinity);
454 ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, 0, Infinity, 50);
455 ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, 0, Infinity, Infinity);
456 ctx.drawImage(red, Infinity, 0, 100, Infinity, 0, 0, 100, Infinity);
457 ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, 0, 100, 50);
458 ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, Infinity, 100, 50);
459 ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, 50);
460 ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, Infinity, Infinity, Infinity);
461 ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, Infinity, 100, Infinity);
462 ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, 0, Infinity, 50);
463 ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, 0, Infinity, Infinity);
464 ctx.drawImage(red, Infinity, 0, 100, 50, Infinity, 0, 100, Infinity);
465 ctx.drawImage(red, Infinity, 0, 100, 50, 0, Infinity, 100, 50);
466 ctx.drawImage(red, Infinity, 0, 100, 50, 0, Infinity, Infinity, 50);
467 ctx.drawImage(red, Infinity, 0, 100, 50, 0, Infinity, Infinity, Infinity);
468 ctx.drawImage(red, Infinity, 0, 100, 50, 0, Infinity, 100, Infinity);
469 ctx.drawImage(red, Infinity, 0, 100, 50, 0, 0, Infinity, 50);
470 ctx.drawImage(red, Infinity, 0, 100, 50, 0, 0, Infinity, Infinity);
471 ctx.drawImage(red, Infinity, 0, 100, 50, 0, 0, 100, Infinity);
472 ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, 0, 100, 50);
473 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, 0, 100, 50);
474 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, 50);
475 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, 50);
476 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, 50);
477 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
478 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 100, Infinity);
479 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, 50);
480 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, 0, Infinity, Infinity);
481 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, Infinity, 0, 100, Infinity);
482 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, 50);
483 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, 50);
484 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity, Infinity);
485 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, Infinity, 100, Infinity);
486 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, 50);
487 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, 0, Infinity, Infinity);
488 ctx.drawImage(red, 0, Infinity, Infinity, Infinity, 0, 0, 100, Infinity);
489 ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, 0, 100, 50);
490 ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, 50);
491 ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, 50);
492 ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, Infinity, Infinity, Infinity);
493 ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, Infinity, 100, Infinity);
494 ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, 50);
495 ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, 0, Infinity, Infinity);
496 ctx.drawImage(red, 0, Infinity, Infinity, 50, Infinity, 0, 100, Infinity);
497 ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, Infinity, 100, 50);
498 ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, 50);
499 ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, Infinity, Infinity, Infinity);
500 ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, Infinity, 100, Infinity);
501 ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, 0, Infinity, 50);
502 ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, 0, Infinity, Infinity);
503 ctx.drawImage(red, 0, Infinity, Infinity, 50, 0, 0, 100, Infinity);
504 ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, 0, 100, 50);
505 ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, 0, 100, 50);
506 ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, 50);
507 ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, 50);
508 ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, Infinity, Infinity, Infinity);
509 ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, Infinity, 100, Infinity);
510 ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, 50);
511 ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, 0, Infinity, Infinity);
512 ctx.drawImage(red, 0, Infinity, 100, Infinity, Infinity, 0, 100, Infinity);
513 ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, Infinity, 100, 50);
514 ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, 50);
515 ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, Infinity, Infinity, Infinity);
516 ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, Infinity, 100, Infinity);
517 ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, 0, Infinity, 50);
518 ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, 0, Infinity, Infinity);
519 ctx.drawImage(red, 0, Infinity, 100, Infinity, 0, 0, 100, Infinity);
520 ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, 0, 100, 50);
521 ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, Infinity, 100, 50);
522 ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, 50);
523 ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, Infinity, Infinity, Infinity);
524 ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, Infinity, 100, Infinity);
525 ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, 0, Infinity, 50);
526 ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, 0, Infinity, Infinity);
527 ctx.drawImage(red, 0, Infinity, 100, 50, Infinity, 0, 100, Infinity);
528 ctx.drawImage(red, 0, Infinity, 100, 50, 0, Infinity, 100, 50);
529 ctx.drawImage(red, 0, Infinity, 100, 50, 0, Infinity, Infinity, 50);
530 ctx.drawImage(red, 0, Infinity, 100, 50, 0, Infinity, Infinity, Infinity);
531 ctx.drawImage(red, 0, Infinity, 100, 50, 0, Infinity, 100, Infinity);
532 ctx.drawImage(red, 0, Infinity, 100, 50, 0, 0, Infinity, 50);
533 ctx.drawImage(red, 0, Infinity, 100, 50, 0, 0, Infinity, Infinity);
534 ctx.drawImage(red, 0, Infinity, 100, 50, 0, 0, 100, Infinity);
535 ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, 0, 100, 50);
536 ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, 0, 100, 50);
537 ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, 50);
538 ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, 50);
539 ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, Infinity, Infinity, Infinity);
540 ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, Infinity, 100, Infinity);
541 ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, 50);
542 ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, 0, Infinity, Infinity);
543 ctx.drawImage(red, 0, 0, Infinity, Infinity, Infinity, 0, 100, Infinity);
544 ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, Infinity, 100, 50);
545 ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, 50);
546 ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, Infinity, Infinity, Infinity);
547 ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, Infinity, 100, Infinity);
548 ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, 0, Infinity, 50);
549 ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, 0, Infinity, Infinity);
550 ctx.drawImage(red, 0, 0, Infinity, Infinity, 0, 0, 100, Infinity);
551 ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, 0, 100, 50);
552 ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, Infinity, 100, 50);
553 ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, 50);
554 ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, Infinity, Infinity, Infinity);
555 ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, Infinity, 100, Infinity);
556 ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, 0, Infinity, 50);
557 ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, 0, Infinity, Infinity);
558 ctx.drawImage(red, 0, 0, Infinity, 50, Infinity, 0, 100, Infinity);
559 ctx.drawImage(red, 0, 0, Infinity, 50, 0, Infinity, 100, 50);
560 ctx.drawImage(red, 0, 0, Infinity, 50, 0, Infinity, Infinity, 50);
561 ctx.drawImage(red, 0, 0, Infinity, 50, 0, Infinity, Infinity, Infinity);
562 ctx.drawImage(red, 0, 0, Infinity, 50, 0, Infinity, 100, Infinity);
563 ctx.drawImage(red, 0, 0, Infinity, 50, 0, 0, Infinity, 50);
564 ctx.drawImage(red, 0, 0, Infinity, 50, 0, 0, Infinity, Infinity);
565 ctx.drawImage(red, 0, 0, Infinity, 50, 0, 0, 100, Infinity);
566 ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, 0, 100, 50);
567 ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, Infinity, 100, 50);
568 ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, 50);
569 ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, Infinity, Infinity, Infinity);
570 ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, Infinity, 100, Infinity);
571 ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, 0, Infinity, 50);
572 ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, 0, Infinity, Infinity);
573 ctx.drawImage(red, 0, 0, 100, Infinity, Infinity, 0, 100, Infinity);
574 ctx.drawImage(red, 0, 0, 100, Infinity, 0, Infinity, 100, 50);
575 ctx.drawImage(red, 0, 0, 100, Infinity, 0, Infinity, Infinity, 50);
576 ctx.drawImage(red, 0, 0, 100, Infinity, 0, Infinity, Infinity, Infinity);
577 ctx.drawImage(red, 0, 0, 100, Infinity, 0, Infinity, 100, Infinity);
578 ctx.drawImage(red, 0, 0, 100, Infinity, 0, 0, Infinity, 50);
579 ctx.drawImage(red, 0, 0, 100, Infinity, 0, 0, Infinity, Infinity);
580 ctx.drawImage(red, 0, 0, 100, Infinity, 0, 0, 100, Infinity);
581 ctx.drawImage(red, 0, 0, 100, 50, Infinity, Infinity, 100, 50);
582 ctx.drawImage(red, 0, 0, 100, 50, Infinity, Infinity, Infinity, 50);
583 ctx.drawImage(red, 0, 0, 100, 50, Infinity, Infinity, Infinity, Infinity);
584 ctx.drawImage(red, 0, 0, 100, 50, Infinity, Infinity, 100, Infinity);
585 ctx.drawImage(red, 0, 0, 100, 50, Infinity, 0, Infinity, 50);
586 ctx.drawImage(red, 0, 0, 100, 50, Infinity, 0, Infinity, Infinity);
587 ctx.drawImage(red, 0, 0, 100, 50, Infinity, 0, 100, Infinity);
588 ctx.drawImage(red, 0, 0, 100, 50, 0, Infinity, Infinity, 50);
589 ctx.drawImage(red, 0, 0, 100, 50, 0, Infinity, Infinity, Infinity);
590 ctx.drawImage(red, 0, 0, 100, 50, 0, Infinity, 100, Infinity);
591 ctx.drawImage(red, 0, 0, 100, 50, 0, 0, Infinity, Infinity);
592 comparePixel(ctx, 50,25, 0,255,0,255);
596 function test_negative(row) {
597 var canvas = createCanvasObject(row);
598 var ctx = canvas.getContext('2d');
602 ctx.fillStyle = '#f00';
603 ctx.fillRect(0, 0, 100, 50);
604 ctx.drawImage('ggrr-256x256.png', 100, 78, 50, 50, 0, 50, 50, -50);
605 ctx.drawImage('ggrr-256x256.png', 100, 128, 50, -50, 100, 50, -50, -50);
606 // comparePixel(ctx, 1,1, 0,255,0,255,2);
607 // comparePixel(ctx, 1,48, 0,255,0,255,2);
608 // comparePixel(ctx, 98,1, 0,255,0,255,2);
609 // comparePixel(ctx, 98,48, 0,255,0,255,2);
610 // comparePixel(ctx, 48,1, 0,255,0,255,2);
611 // comparePixel(ctx, 48,48, 0,255,0,255,2);
612 // comparePixel(ctx, 51,1, 0,255,0,255,2);
613 // comparePixel(ctx, 51,48, 0,255,0,255,2);
614 // comparePixel(ctx, 25,25, 0,255,0,255,2);
615 // comparePixel(ctx, 75,25, 0,255,0,255,2);
618 ctx.fillStyle = '#f00';
619 ctx.fillRect(0, 0, 100, 50);
620 ctx.drawImage('ggrr-256x256.png', 0, 178, 50, -100, 0, 0, 50, 100);
621 ctx.drawImage('ggrr-256x256.png', 0, 78, 50, 100, 50, 100, 50, -100);
622 // comparePixel(ctx, 1,1, 0,255,0,255,2);
623 // comparePixel(ctx, 1,48, 0,255,0,255,2);
624 // comparePixel(ctx, 98,1, 0,255,0,255,2);
625 // comparePixel(ctx, 98,48, 0,255,0,255,2);
626 // comparePixel(ctx, 48,1, 0,255,0,255,2);
627 // comparePixel(ctx, 48,48, 0,255,0,255,2);
628 // comparePixel(ctx, 51,1, 0,255,0,255,2);
629 // comparePixel(ctx, 51,48, 0,255,0,255,2);
630 // comparePixel(ctx, 25,25, 0,255,0,255,2);
631 // comparePixel(ctx, 75,25, 0,255,0,255,2);
634 ctx.fillStyle = '#f00';
635 ctx.fillRect(0, 0, 100, 50);
636 ctx.drawImage('ggrr-256x256.png', 100, 78, -100, 50, 0, 0, 50, 50);
637 ctx.drawImage('ggrr-256x256.png', 100, 128, -100, -50, 50, 0, 50, 50);
638 // comparePixel(ctx, 1,1, 0,255,0,255,2);
639 // comparePixel(ctx, 1,48, 0,255,0,255,2);
640 // comparePixel(ctx, 98,1, 0,255,0,255,2);
641 // comparePixel(ctx, 98,48, 0,255,0,255,2);
642 // comparePixel(ctx, 48,1, 0,255,0,255,2);
643 // comparePixel(ctx, 48,48, 0,255,0,255,2);
644 // comparePixel(ctx, 51,1, 0,255,0,255,2);
645 // comparePixel(ctx, 51,48, 0,255,0,255,2);
646 // comparePixel(ctx, 25,25, 0,255,0,255,2);
647 // comparePixel(ctx, 75,25, 0,255,0,255,2);
651 function test_canvas(row) {
652 var canvas = createCanvasObject(row);
653 var ctx = canvas.getContext('2d');
656 var canvas2 = Qt.createQmlObject("import QtQuick 2.0; Canvas{renderTarget:Canvas.Image; renderStrategy:Canvas.Immediate}", canvas);
659 var ctx2 = canvas2.getContext('2d');
660 ctx2.fillStyle = '#0f0';
661 ctx2.fillRect(0, 0, 100, 50);
663 ctx.fillStyle = '#f00';
664 ctx.drawImage(canvas2, 0, 0);
666 //comparePixel(ctx, 0,0, 0,255,0,255,2);
667 //comparePixel(ctx, 99,0, 0,255,0,255,2);
668 //comparePixel(ctx, 0,49, 0,255,0,255,2);
669 //comparePixel(ctx, 99,49, 0,255,0,255,2);
673 function test_broken(row) {
674 var canvas = createCanvasObject(row);
675 var ctx = canvas.getContext('2d');
678 var img = 'broken.png';
679 verify(!img.complete);
680 ctx.drawImage(img, 0, 0);
683 function test_alpha(row) {
684 var canvas = createCanvasObject(row);
685 var ctx = canvas.getContext('2d');
688 ctx.fillStyle = '#0f0';
689 ctx.fillRect(0, 0, 100, 50);
691 ctx.drawImage('red.png', 0, 0);
692 comparePixel(ctx, 50,25, 0,255,0,255, 2);
695 function test_multiple_painting(row) {
696 var canvas = createCanvasObject(row);
697 var ctx = canvas.getContext('2d');
700 ctx.fillStyle = '#0f0';
701 ctx.fillRect(0, 0, 100, 50);
702 ctx.drawImage('red.png', 0, 0, 50, 50);
703 ctx.drawImage('red.png', 50, 0, 100, 50);
704 comparePixel(ctx, 25,25, 255,0,0,255, 2);
705 comparePixel(ctx, 75,25, 255,0,0,255, 2);