OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <script src="../../resources/testharness.js"></script> |
2 <html> | 2 <script src="../../resources/testharnessreport.js"></script> |
3 <body> | |
4 <script> | |
5 if (window.testRunner) | |
6 testRunner.dumpAsText(); | |
7 | 3 |
8 function newCanvasContext() { | 4 <script> |
5 test(function(t) { | |
6 function newCanvasContext() { | |
9 canvas = document.createElement("canvas"); | 7 canvas = document.createElement("canvas"); |
10 canvas.width = 100; | 8 canvas.width = 100; |
11 canvas.height = 100; | 9 canvas.height = 100; |
12 return canvas.getContext("2d"); | 10 return canvas.getContext("2d"); |
13 } | 11 } |
14 | 12 |
15 window.onload = function () { | 13 window.onload = function () { |
Justin Novosad
2017/02/16 15:41:56
onload is async. This code will end up being calle
zakerinasab
2017/02/16 18:12:40
Done.
| |
16 ctx = newCanvasContext(); | 14 ctx = newCanvasContext(); |
17 ctx.fillStyle = '#0f0'; | 15 ctx.fillStyle = '#0f0'; |
18 ctx.fillRect(0, 0, 100, 50); | 16 ctx.fillRect(0, 0, 100, 50); |
19 ctx.moveTo(10500000000, 10500000000); | 17 ctx.moveTo(10500000000, 10500000000); |
20 ctx.lineTo(110, -10); | 18 ctx.lineTo(110, -10); |
21 ctx.lineTo(-10, 60); | 19 ctx.lineTo(-10, 60); |
22 ctx.fill(); | 20 ctx.fill(); |
23 ctx.getImageData(50, 25, 1, 1); | 21 ctx.getImageData(50, 25, 1, 1); |
24 | 22 |
25 ctx = newCanvasContext(); | 23 ctx = newCanvasContext(); |
26 ctx.fillStyle = '#0f0'; | 24 ctx.fillStyle = '#0f0'; |
27 ctx.scale(4500000000, 4500000000); | 25 ctx.scale(4500000000, 4500000000); |
28 ctx.moveTo(0, 0.5); | 26 ctx.moveTo(0, 0.5); |
29 ctx.lineTo(2, 0.5); | 27 ctx.lineTo(2, 0.5); |
30 ctx.stroke(); | 28 ctx.stroke(); |
31 ctx.getImageData(50, 25, 1, 1); | 29 ctx.getImageData(50, 25, 1, 1); |
32 | 30 |
33 ctx = newCanvasContext(); | 31 ctx = newCanvasContext(); |
34 ctx.fillStyle = '#0f0'; | 32 ctx.fillStyle = '#0f0'; |
35 ctx.fillRect(0, 0, 100, 50); | 33 ctx.fillRect(0, 0, 100, 50); |
36 ctx.scale(2, -4500000000); | 34 ctx.scale(2, -4500000000); |
37 ctx.arc(25, 50, 56, 0, 2*Math.PI, false); | 35 ctx.arc(25, 50, 56, 0, 2*Math.PI, false); |
38 ctx.fill(); | 36 ctx.fill(); |
39 ctx.arc(105000000005, -105000000005, 105000000004, 0, 10500000000*Math.P I, false); | 37 ctx.arc(105000000005, -105000000005, 105000000004, 0, 10500000000*Math.P I, false); |
40 ctx.fill(); | 38 ctx.fill(); |
41 ctx.getImageData(50, 25, 1, 1); | 39 ctx.getImageData(50, 25, 1, 1); |
42 } | 40 } |
43 </script> | 41 }, 'Draw commands with big numbers cause no problems.'); |
44 PASS: Draw commands with big numbers cause no problems. | 42 </script> |
45 </body> | |
46 </html> | |
47 | 43 |
OLD | NEW |