Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <script src="../../resources/testharness.js"></script> |
| 2 <html> | 2 <script src="../../resources/testharnessreport.js"></script> |
| 3 <head> | |
| 4 <script src="../../resources/js-test.js"></script> | |
| 5 </head> | |
| 6 <body onload="javascript:ready()"> | |
| 7 | 3 |
| 8 <!-- This image is an animated GIF (1px by 1px). Animation time is 0ms. First frame has the color rgb(64, 4, 30). The second one has the color rgb(10, 1 53, 30) --> | 4 <body onload="javascript:ready()"> |
| 9 <img id="image" src="data:image/gif;base64,R0lGODlhAQABAIACAEAEHgqZHiH+E UNyZWF0ZWQgd2l0aCBHSU1QACH5BAkAAAEALAAAAAABAAEAAAICRAEAIfkECAAA/wAsAAAAAAEAAQAAA gJMAQA7" alt="Animated Image" /> | |
| 10 <canvas id="canvas" width="1" height="1"></canvas> | |
| 11 | 5 |
| 12 <script> | 6 <!-- This image is an animated GIF (1px by 1px). Animation time is 0ms. First fr ame has the color rgb(64, 4, 30). The second one has the color rgb(10, 153, 30) --> |
| 13 description("When drawing an animated image to a canvas, the poster frame (or the first frame) should be printed.<br/>This test passes if the canvas is filled with the color rgb(64, 4, 30)."); | 7 <img id="image" src="data:image/gif;base64,R0lGODlhAQABAIACAEAEHgqZHiH+EUNyZWF0Z WQgd2l0aCBHSU1QACH5BAkAAAEALAAAAAABAAEAAAICRAEAIfkECAAA/wAsAAAAAAEAAQAAAgJMAQA7" alt="Animated Image" /> |
| 14 | 8 |
| 15 if (window.testRunner) { | 9 <canvas id="canvas" width="1" height="1"></canvas> |
| 16 testRunner.waitUntilDone(); | |
| 17 } | |
| 18 | 10 |
| 11 <script> | |
| 12 function ready() { | |
| 13 var canvas = document.getElementById("canvas"); | |
| 14 var image = document.getElementById("image"); | |
| 19 | 15 |
| 20 function ready() { | 16 var canvasContext = canvas.getContext("2d"); |
| 21 var canvas = document.getElementById("canvas"); | |
| 22 var image = document.getElementById("image"); | |
| 23 | 17 |
| 24 var canvasContext = canvas.getContext("2d"); | 18 test(function(t) { |
|
Justin Novosad
2017/02/09 20:32:01
Test may quit before this runs. Please keep this
zakerinasab
2017/02/13 16:25:19
Done.
| |
| 19 canvasContext.drawImage(image, 0, 0); | |
| 25 | 20 |
| 26 window.setTimeout(function() { | 21 imageData = canvasContext.getImageData(0, 0, 1, 1); |
| 27 | 22 |
| 28 canvasContext.drawImage(image, 0, 0); | 23 assert_equals(imageData.data[0], 64); |
| 29 | 24 assert_equals(imageData.data[1], 4); |
| 30 imageData = canvasContext.getImageData(0, 0, 1, 1); | 25 assert_equals(imageData.data[2], 30); |
| 31 | 26 }, 'When drawing an animated image to a canvas, the poster frame (or the fir st frame) should be printed. This test passes if the canvas is filled with the c olor rgb(64, 4, 30).'); |
| 32 shouldBe("imageData.data[0]", "64"); | 27 } |
| 33 shouldBe("imageData.data[1]", "4"); | 28 </script> |
| 34 shouldBe("imageData.data[2]", "30"); | 29 </body> |
| 35 | |
| 36 if (window.testRunner) | |
| 37 testRunner.notifyDone(); | |
| 38 | |
| 39 }, 200); | |
| 40 } | |
| 41 </script> | |
| 42 | |
| 43 </body> | |
| 44 </html> | |
| OLD | NEW |