Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(698)

Side by Side Diff: LayoutTests/fast/canvas/canvas-createImageBitmap-animated.html

Issue 22346004: Ensure that createImageBitmap takes a snapshot of a gifs frame 0 image. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove binary file. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/fast/canvas/canvas-createImageBitmap-animated-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../js/resources/js-test-pre.js"></script>
4 </head>
5 <body>
6 <script>
7 window.jsTestIsAsync = true;
8
9 function shouldBeGreen(x, y) {
10 d = ctx.getImageData(x, y, 1, 1).data;
11 shouldBeTrue("d[0] == 0");
12 shouldBeTrue("d[1] == 255");
13 shouldBeTrue("d[2] == 0");
14 shouldBeTrue("d[3] == 255");
15 }
16
17 var canvas = document.createElement("canvas");
18 canvas.width = 200;
19 canvas.height = 200;
20 var ctx = canvas.getContext("2d");
21
22 var img = new Image();
23 img.src = 'resources/green-red-animated.gif';
24 img.onload = imageLoaded;
25
26 function imageLoaded() {
27 // The gif switches from green to red in 10ms. We wait 50ms to ensure th at the gif will have changed colors.
28 // If the ImageBitmap is green, we know that it is a snapshot of the gif 's 0th frame.
29 window.setTimeout(function() {
30 createImageBitmap(img).then(function (imageBitmap) {
31 ctx.drawImage(imageBitmap, 0, 0);
32 shouldBeGreen(100, 100);
33 finishJSTest();
34 }, function() {
35 testFailed("Promise was rejected.");
36 finishJSTest();
37 });
38 }, 50);
39 }
40 </script>
41 <script src="../js/resources/js-test-post.js"></script>
42 </body>
43 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/canvas/canvas-createImageBitmap-animated-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698