test_bug593689.html (1104B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=593689 5 --> 6 <head> 7 <title>Test for Bug 593689</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 10 </head> 11 <body> 12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=593689">Mozilla Bug 593689</a> 13 <p id="display"></p> 14 <div id="content" style="display: none"> 15 16 </div> 17 <pre id="test"> 18 <script type="application/javascript"> 19 20 /** Test for Bug 593689 */ 21 function testWidth(w) { 22 var img = new Image(w); 23 is(img.width, w|0, "Unexpected handling of '" + w + "' width"); 24 } 25 26 testWidth(1); 27 testWidth(0); 28 testWidth("xxx"); 29 testWidth(null); 30 testWidth(undefined); 31 testWidth({}); 32 testWidth({ valueOf() { return 10; } }); 33 34 function testHeight(h) { 35 var img = new Image(100, h); 36 is(img.height, h|0, "Unexpected handling of '" + h + "' height"); 37 } 38 39 testHeight(1); 40 testHeight(0); 41 testHeight("xxx"); 42 testHeight(null); 43 testHeight(undefined); 44 testHeight({}); 45 testHeight({ valueOf() { return 10; } }); 46 47 </script> 48 </pre> 49 </body> 50 </html>