test_drawSnapshot.html (1254B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Test for drawSnapshot</title> 6 <script src="/tests/SimpleTest/SimpleTest.js"></script> 7 <script src="/tests/SimpleTest/WindowSnapshot.js"></script> 8 <script type="application/javascript" src="file_drawWindow_common.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 10 <script type="application/javascript"> 11 12 SimpleTest.waitForExplicitFinish(); 13 window.addEventListener("load", runTests); 14 15 async function runTests(event) { 16 let snapshot = async function(context, x, y, width, height, bg) { 17 let elem = document.getElementById("source"); 18 19 var rect = new window.DOMRect(x, y, width, height); 20 21 let image = await SpecialPowers.snapshotContext(elem, rect, bg); 22 context.drawImage(image, 0, 0); 23 } 24 25 // Run the tests with the source document in an <iframe> within this 26 // page, which we expect to have transparency. 27 await runDrawWindowTests(snapshot, true); 28 29 SimpleTest.finish(); 30 } 31 32 </script> 33 </head> 34 <body> 35 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a> 36 <iframe id="source" src="file_drawWindow_source.html" width="200" height="100"></iframe> 37 </body> 38 </html>