Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <link rel="stylesheet" href="about:blank" type="text/css"> | 3 <link rel="stylesheet" href="about:blank" type="text/css"> |
| 4 </head> | 4 </head> |
| 5 <script src="../../resources/testharness.js"></script> | |
| 6 <script src="../../resources/testharnessreport.js"></script> | |
| 7 <canvas id="mycanvas" width="400" height="200"></canvas> | |
| 8 | |
| 5 <body> | 9 <body> |
| 6 <p>If the canvas below is black, then we managed to draw before loading styl esheets. Hooray!</p> | 10 <script> |
| 7 <canvas id="mycanvas" width="400" height="200"></canvas> | 11 test(function(t) { |
| 8 <script type="application/x-javascript"> | 12 var canvas = document.getElementById("mycanvas"); |
| 9 var canvas = document.getElementById("mycanvas"); | 13 ctx = canvas.getContext("2d"); |
| 10 canvas.getContext("2d").fillRect(0, 0, canvas.width, canvas.height); | 14 ctx.fillRect(0, 0, canvas.width, canvas.height); |
| 11 </script> | 15 |
| 16 checkPixel(25, 25, 0, 0, 0, 255); | |
| 17 checkPixel(75, 75, 0, 0, 0, 255); | |
| 18 | |
| 19 function checkPixel(x, y, r, g, b, a) { | |
| 20 var data = ctx.getImageData(x,y,1,1).data; | |
|
Justin Novosad
2017/02/08 16:52:33
This is not correct. getImageData is independent o
zakerinasab
2017/02/08 19:04:10
Reverted.
| |
| 21 assert_equals(data[0], r); | |
| 22 assert_equals(data[1], g); | |
| 23 assert_equals(data[2], b); | |
| 24 assert_equals(data[3], a); | |
| 25 } | |
| 26 }, 'Tests if we can correctly draw before loading stylesheets.'); | |
| 27 </script> | |
| 12 </body> | 28 </body> |
| 13 </html> | |
| OLD | NEW |