OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 description("Tests to ensure correct behaviour of canvas loss and restoration wh
en size is extremely large then, restored to a reasonable value."); | 8 description("Tests to ensure correct behaviour of canvas loss and restoration wh
en size is extremely large then, restored to a reasonable value."); |
9 | 9 |
10 if (window.testRunner) { | 10 if (window.testRunner) { |
11 testRunner.dumpAsText(); | 11 testRunner.dumpAsText(); |
12 testRunner.waitUntilDone(); | 12 testRunner.waitUntilDone(); |
13 } | 13 } |
14 | 14 |
15 var canvas = document.createElement('canvas') | 15 var canvas = document.createElement('canvas') |
16 canvas.addEventListener('contextlost', contextLost); | 16 canvas.addEventListener('contextlost', contextLost); |
17 canvas.addEventListener('contextrestored', contextRestored); | 17 canvas.addEventListener('contextrestored', contextRestored); |
18 var ctx = canvas.getContext('2d'); | 18 var ctx = canvas.getContext('2d'); |
19 var lostEventHasFired = false; | 19 var lostEventHasFired = false; |
20 verifyContextLost(false); | 20 verifyContextLost(false); |
21 | 21 |
22 var googol = Math.pow(10,100); | 22 var bigsize = 1000000000; |
23 canvas.width = googol; | 23 canvas.width = bigsize; |
24 canvas.height = googol; | 24 canvas.height = bigsize; |
25 verifyContextLost(true); | 25 verifyContextLost(true); |
26 canvas.width = googol; | 26 canvas.width = bigsize; |
27 verifyContextLost(true); | 27 verifyContextLost(true); |
28 canvas.width = 100; | 28 canvas.width = 100; |
29 canvas.height = 100; | 29 canvas.height = 100; |
30 verifyContextLost(true); // Restoration is async. | 30 verifyContextLost(true); // Restoration is async. |
31 | 31 |
32 // Restore a sane dimension | 32 // Restore a sane dimension |
33 | 33 |
34 function verifyContextLost(shouldBeLost) { | 34 function verifyContextLost(shouldBeLost) { |
35 // Verify context loss experimentally as well as isContextLost() | 35 // Verify context loss experimentally as well as isContextLost() |
36 ctx.fillStyle = '#0f0'; | 36 ctx.fillStyle = '#0f0'; |
(...skipping 25 matching lines...) Expand all Loading... |
62 testFailed('Context restored event was dispatched before a context lost
event.'); | 62 testFailed('Context restored event was dispatched before a context lost
event.'); |
63 } | 63 } |
64 verifyContextLost(false); | 64 verifyContextLost(false); |
65 if (window.testRunner) { | 65 if (window.testRunner) { |
66 testRunner.notifyDone(); | 66 testRunner.notifyDone(); |
67 } | 67 } |
68 } | 68 } |
69 </script> | 69 </script> |
70 </body> | 70 </body> |
71 </html> | 71 </html> |
OLD | NEW |