Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / canvas / canvas-drawImage-animated.html
blob454f9400818d6ad599731609a718ae38846fddb1
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body onload="javascript:ready()">
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, 153, 30) -->
9 <img id="image" src="data:image/gif;base64,R0lGODlhAQABAIACAEAEHgqZHiH+EUNyZWF0ZWQgd2l0aCBHSU1QACH5BAkAAAEALAAAAAABAAEAAAICRAEAIfkECAAA/wAsAAAAAAEAAQAAAgJMAQA7" alt="Animated Image" />
10 <canvas id="canvas" width="1" height="1"></canvas>
12 <script>
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).");
15 if (window.testRunner) {
16 testRunner.waitUntilDone();
20 function ready() {
21 var canvas = document.getElementById("canvas");
22 var image = document.getElementById("image");
24 var canvasContext = canvas.getContext("2d");
26 window.setTimeout(function() {
28 canvasContext.drawImage(image, 0, 0);
30 imageData = canvasContext.getImageData(0, 0, 1, 1);
32 shouldBe("imageData.data[0]", "64");
33 shouldBe("imageData.data[1]", "4");
34 shouldBe("imageData.data[2]", "30");
36 if (window.testRunner)
37 testRunner.notifyDone();
39 }, 200);
41 </script>
43 </body>
44 </html>