| <script src="../../resources/js-test-pre.js"></script> |
| <canvas id="canvas"></canvas> |
| description("Ensure the image frame duration is respected even if the frame finishes decoding early."); |
| internals.clearMemoryCache(); |
| image.onload = imageLoaded; |
| image.src = "resources/animated-red-green-blue.gif"; |
| internals.setImageFrameDecodingDuration(image, 0.040); |
| if (drawImage.count == undefined) |
| var canvas = document.getElementById("canvas"); |
| var ctx = canvas.getContext("2d"); |
| ctx.drawImage(image, 0, 0, canvas.width, canvas.height); |
| return ++drawImage.count; |
| // 1st time the image is drawn, time = 0, current_frame = 0 |
| // 2nd time the image is drawn, time = 50, current_frame = 1 |
| // 3rd time the image is drawn, time = 100, current_frame = 2 |
| shouldBe("internals.imageFrameIndex(image)", "2"); |
| <script src="../../resources/js-test-post.js"></script> |