test_bug1414077.html (1554B)
1 <!DOCTYPE html> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1414077 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 1414077</title> 9 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/> 11 <script type="application/javascript"> 12 13 /** Test for Bug 1414077 */ 14 15 add_task(async function() { 16 await SpecialPowers.pushPrefEnv({"set": [["browser.enable_automatic_image_resizing", true]]}); 17 18 return new Promise(resolve => { 19 var testWin = document.querySelector("iframe"); 20 testWin.src = "image.png"; 21 testWin.onload = function() { 22 var testDoc = testWin.contentDocument; 23 24 // testDoc should be a image document. 25 ok(testDoc.imageIsOverflowing, "image is overflowing"); 26 ok(testDoc.imageIsResized, "image is resized to fit visible area by default"); 27 28 // Restore image to original size. 29 testDoc.restoreImage(); 30 ok(testDoc.imageIsOverflowing, "image is overflowing"); 31 ok(!testDoc.imageIsResized, "image is restored to original size"); 32 33 // Resize the image to fit visible area 34 testDoc.shrinkToFit(); 35 ok(testDoc.imageIsOverflowing, "image is overflowing"); 36 ok(testDoc.imageIsResized, "image is resized to fit visible area"); 37 38 resolve(); 39 }; 40 }) 41 }); 42 43 </script> 44 </head> 45 46 <body> 47 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1414077">Mozilla Bug 1414077</a> 48 <iframe width="0" height="0"></iframe> 49 </body> 50 </html>