1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/image/test/reftest/apng/delaytest.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,41 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html class="reftest-wait"> 1.6 +<head> 1.7 +<title>Delayed image reftest wrapper</title> 1.8 +</head> 1.9 +<body> 1.10 +<img id="image1"> 1.11 +<script> 1.12 +// This loads a externally specified image, forces a draw (in case of 1.13 +// decode-on-draw), waits 100ms, and then triggers the reftest snapshot. 1.14 +// This allows the animation on the page to complete. 1.15 +// 1.16 +// Use as "delaytest.html?animation.png" 1.17 +// 1.18 + 1.19 +// Get the image URL from our URL 1.20 +var imgURL = document.location.search.substr(1); 1.21 + 1.22 +// Load the image 1.23 +var img = document.images[0]; 1.24 +img.src = imgURL; 1.25 +img.onload = forceDecode; 1.26 + 1.27 +function forceDecode() { 1.28 + 1.29 + // We need to force drawing of the image in an invisible context 1.30 + var canvas = document.createElement("canvas"); 1.31 + var ctx = canvas.getContext("2d"); 1.32 + ctx.drawImage(img, 0, 0); 1.33 + 1.34 + // We've force the decode. start the timer to trigger the reftest 1.35 + startTimer(); 1.36 +} 1.37 + 1.38 +function startTimer() { 1.39 + const delay = 100; 1.40 + setTimeout("document.documentElement.className = '';", delay); 1.41 +} 1.42 +</script> 1.43 +</body> 1.44 +</html>