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> |
9 canvas = document.createElement("canvas"); | 5 function newCanvasContext() { |
10 canvas.width = 100; | 6 canvas = document.createElement("canvas"); |
11 canvas.height = 100; | 7 canvas.width = 100; |
12 return canvas.getContext("2d"); | 8 canvas.height = 100; |
13 } | 9 return canvas.getContext("2d"); |
| 10 } |
14 | 11 |
15 window.onload = function () { | 12 function runTest() { |
16 ctx = newCanvasContext(); | 13 ctx = newCanvasContext(); |
17 ctx.fillStyle = '#0f0'; | 14 ctx.fillStyle = '#0f0'; |
18 ctx.fillRect(0, 0, 100, 50); | 15 ctx.fillRect(0, 0, 100, 50); |
19 ctx.moveTo(10500000000, 10500000000); | 16 ctx.moveTo(10500000000, 10500000000); |
20 ctx.lineTo(110, -10); | 17 ctx.lineTo(110, -10); |
21 ctx.lineTo(-10, 60); | 18 ctx.lineTo(-10, 60); |
22 ctx.fill(); | 19 ctx.fill(); |
23 ctx.getImageData(50, 25, 1, 1); | 20 ctx.getImageData(50, 25, 1, 1); |
24 | 21 |
25 ctx = newCanvasContext(); | 22 ctx = newCanvasContext(); |
26 ctx.fillStyle = '#0f0'; | 23 ctx.fillStyle = '#0f0'; |
27 ctx.scale(4500000000, 4500000000); | 24 ctx.scale(4500000000, 4500000000); |
28 ctx.moveTo(0, 0.5); | 25 ctx.moveTo(0, 0.5); |
29 ctx.lineTo(2, 0.5); | 26 ctx.lineTo(2, 0.5); |
30 ctx.stroke(); | 27 ctx.stroke(); |
31 ctx.getImageData(50, 25, 1, 1); | 28 ctx.getImageData(50, 25, 1, 1); |
32 | 29 |
33 ctx = newCanvasContext(); | 30 ctx = newCanvasContext(); |
34 ctx.fillStyle = '#0f0'; | 31 ctx.fillStyle = '#0f0'; |
35 ctx.fillRect(0, 0, 100, 50); | 32 ctx.fillRect(0, 0, 100, 50); |
36 ctx.scale(2, -4500000000); | 33 ctx.scale(2, -4500000000); |
37 ctx.arc(25, 50, 56, 0, 2*Math.PI, false); | 34 ctx.arc(25, 50, 56, 0, 2*Math.PI, false); |
38 ctx.fill(); | 35 ctx.fill(); |
39 ctx.arc(105000000005, -105000000005, 105000000004, 0, 10500000000*Math.P
I, false); | 36 ctx.arc(105000000005, -105000000005, 105000000004, 0, 10500000000*Math.PI, f
alse); |
40 ctx.fill(); | 37 ctx.fill(); |
41 ctx.getImageData(50, 25, 1, 1); | 38 ctx.getImageData(50, 25, 1, 1); |
42 } | 39 } |
43 </script> | |
44 PASS: Draw commands with big numbers cause no problems. | |
45 </body> | |
46 </html> | |
47 | 40 |
| 41 async_test(t => { |
| 42 window.onload = function() { |
| 43 t.step(runTest); |
| 44 t.done(); |
| 45 } |
| 46 }, 'Draw commands with big numbers cause no problems.'); |
| 47 |
| 48 </script> |
| 49 |
OLD | NEW |