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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/canvas/canvas-createImageBitmap-animated-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/canvas/canvas-createImageBitmap-animated.html
diff --git a/LayoutTests/fast/canvas/canvas-createImageBitmap-animated.html b/LayoutTests/fast/canvas/canvas-createImageBitmap-animated.html
new file mode 100644
index 0000000000000000000000000000000000000000..073c38f6ab43c5a044ea865f9df14f7a0ad2e71c
--- /dev/null
+++ b/LayoutTests/fast/canvas/canvas-createImageBitmap-animated.html
@@ -0,0 +1,43 @@
+<html>
+<head>
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+ window.jsTestIsAsync = true;
+
+ function shouldBeGreen(x, y) {
+ d = ctx.getImageData(x, y, 1, 1).data;
+ shouldBeTrue("d[0] == 0");
+ shouldBeTrue("d[1] == 255");
+ shouldBeTrue("d[2] == 0");
+ shouldBeTrue("d[3] == 255");
+ }
+
+ var canvas = document.createElement("canvas");
+ canvas.width = 200;
+ canvas.height = 200;
+ var ctx = canvas.getContext("2d");
+
+ var img = new Image();
+ img.src = 'resources/green-red-animated.gif';
+ img.onload = imageLoaded;
+
+ function imageLoaded() {
+ // The gif switches from green to red in 10ms. We wait 50ms to ensure that the gif will have changed colors.
+ // If the ImageBitmap is green, we know that it is a snapshot of the gif's 0th frame.
+ window.setTimeout(function() {
+ createImageBitmap(img).then(function (imageBitmap) {
+ ctx.drawImage(imageBitmap, 0, 0);
+ shouldBeGreen(100, 100);
+ finishJSTest();
+ }, function() {
+ testFailed("Promise was rejected.");
+ finishJSTest();
+ });
+ }, 50);
+ }
+</script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
« 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