OLD | NEW |
1 <!-- | 1 <!DOCTYPE html> |
| 2 <title>Check Borkedness of canvas fill rect with zero size</title> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 |
| 6 <canvas width="100" height="100"></canvas> |
| 7 <script> |
| 8 /* |
2 Creates a canvas which is filled red, then attempts to | 9 Creates a canvas which is filled red, then attempts to |
3 fill a number of 0 size rects, finally fills with green. | 10 fill a number of 0 size rects, finally fills with green. |
4 | 11 |
5 Fill of a 0-sized rect should not throw an exception, so | 12 Fill of a 0-sized rect should not throw an exception, so |
6 we expected the output to be a green rect. | 13 we expected the output to be a green rect. |
7 --> | 14 */ |
8 <html> | 15 async_test(function(t) { |
9 <head> | 16 window.onload = t.step_func_done(function() { |
10 <script type="text/javascript"> | 17 var canvas = document.querySelector('canvas'); |
11 window.onload = function() { | 18 var context = canvas.getContext("2d"); |
12 if (window.testRunner) | 19 context.fillStyle = '#f00'; |
13 testRunner.dumpAsText(); | 20 context.fillRect(0, 0, canvas.width, canvas.height); |
14 var canvas = document.getElementById("test"); | |
15 var context = canvas.getContext("2d"); | |
16 context.fillStyle = '#f00'; | |
17 context.fillRect(0, 0, canvas.width, canvas.height); | |
18 try { | |
19 context.fillRect(0, 0, 0, 0); | 21 context.fillRect(0, 0, 0, 0); |
20 context.fillRect(0, 0, canvas.width, 0); | 22 context.fillRect(0, 0, canvas.width, 0); |
21 context.fillRect(0, 0, 0, canvas.height); | 23 context.fillRect(0, 0, 0, canvas.height); |
22 } catch (e) { | 24 context.fillStyle = '#0f0'; |
23 var node = document.createTextNode("FAIL -- an exception was thrown when
drawing a 0 sized rect"); | 25 context.fillRect(0, 0, canvas.width, canvas.height); |
24 document.getElementById("body").appendChild(node); | 26 }); |
25 return; | 27 }); |
26 } | |
27 context.fillStyle = '#0f0'; | |
28 context.fillRect(0, 0, canvas.width, canvas.height); | |
29 var node = document.createTextNode("PASS -- 0 sized rects did not trigger an
exception"); | |
30 document.getElementById("body").appendChild(node); | |
31 } | |
32 </script> | 28 </script> |
33 <title>borkedness</title> | |
34 </head> | |
35 <body id="body"> | |
36 <canvas id="test" width="100" height="100"></canvas> | |
37 <br> | |
38 </body> | |
39 </html> | |
OLD | NEW |