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 <!-- 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) --> |
| 9 <img id="image" src="data:image/gif;base64,R0lGODlhAQABAIACAEAEHgqZHiH+E UNyZWF0ZWQgd2l0aCBHSU1QACH5BAkAAAEALAAAAAABAAEAAAICRAEAIfkECAAA/wAsAAAAAAEAAQAAA gJMAQA7" alt="Animated Image" /> | 5 <img id="image" src="data:image/gif;base64,R0lGODlhAQABAIACAEAEHgqZHiH+EUNyZWF0Z WQgd2l0aCBHSU1QACH5BAkAAAEALAAAAAABAAEAAAICRAEAIfkECAAA/wAsAAAAAAEAAQAAAgJMAQA7" alt="Animated Image" /> |
| 10 <canvas id="canvas" width="1" height="1"></canvas> | |
| 11 | 6 |
| 12 <script> | 7 <canvas id="canvas" width="1" height="1"></canvas> |
| 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)."); | |
| 14 | 8 |
| 15 if (window.testRunner) { | 9 <script> |
| 16 testRunner.waitUntilDone(); | 10 async_test(t => { |
| 17 } | 11 window.onload = function() { |
|
Justin Novosad
2017/02/14 20:22:05
Indent is weird.
zakerinasab
2017/02/15 14:53:02
Fixed.
| |
| 12 var canvas = document.getElementById("canvas"); | |
| 13 var image = document.getElementById("image"); | |
| 14 var canvasContext = canvas.getContext("2d"); | |
| 15 t.step(function(){ | |
| 16 canvasContext.drawImage(image, 0, 0); | |
| 17 imageData = canvasContext.getImageData(0, 0, 1, 1); | |
| 18 assert_equals(imageData.data[0], 64); | |
| 19 assert_equals(imageData.data[1], 4); | |
| 20 assert_equals(imageData.data[2], 30); | |
| 21 }); | |
| 22 t.done(); | |
| 23 } | |
| 24 }, 'When drawing an animated image to a canvas, the poster frame (or the first f rame) should be printed. This test passes if the canvas is filled with the color rgb(64, 4, 30).'); | |
| 25 </script> | |
| 26 </body> | |
| 18 | 27 |
| 19 | |
| 20 function ready() { | |
| 21 var canvas = document.getElementById("canvas"); | |
| 22 var image = document.getElementById("image"); | |
| 23 | |
| 24 var canvasContext = canvas.getContext("2d"); | |
| 25 | |
| 26 window.setTimeout(function() { | |
| 27 | |
| 28 canvasContext.drawImage(image, 0, 0); | |
| 29 | |
| 30 imageData = canvasContext.getImageData(0, 0, 1, 1); | |
| 31 | |
| 32 shouldBe("imageData.data[0]", "64"); | |
| 33 shouldBe("imageData.data[1]", "4"); | |
| 34 shouldBe("imageData.data[2]", "30"); | |
| 35 | |
| 36 if (window.testRunner) | |
| 37 testRunner.notifyDone(); | |
| 38 | |
| 39 }, 200); | |
| 40 } | |
| 41 </script> | |
| 42 | |
| 43 </body> | |
| 44 </html> | |
| OLD | NEW |