layout/base/tests/test_bug449781.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/base/tests/test_bug449781.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,69 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=449781
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 449781</title>
    1.11 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=449781">Mozilla Bug 449781</a>
    1.17 +<p id="display">Canary</p>
    1.18 +<iframe src="about:blank" id="ourFrame" style="visibility: hidden">
    1.19 +</iframe>
    1.20 +</div>
    1.21 +<pre id="test">
    1.22 +<script class="testbody" type="text/javascript">
    1.23 +var s1, s2, s3, s4;
    1.24 +
    1.25 +/** Test for Bug 449781 **/
    1.26 +SimpleTest.waitForExplicitFinish();
    1.27 +addLoadEvent(function() {
    1.28 +  s1 = snapshotWindow(window);
    1.29 +
    1.30 +  $("ourFrame").style.display = "none";
    1.31 +  is($("ourFrame").offsetWidth, 0, "Unexpected width after hiding");
    1.32 +  $("ourFrame").style.display = "";
    1.33 +  is($("ourFrame").clientWidth, 300, "Unexpected width after showing");
    1.34 +
    1.35 +  s2 = snapshotWindow(window);
    1.36 +
    1.37 +  var equal, str1, str2;
    1.38 +  [equal, str1, str2] = compareSnapshots(s1, s2, true);
    1.39 +  ok(equal, "Show/hide should have no effect",
    1.40 +     "got " + str1 + " but expected " + str2);
    1.41 +
    1.42 +  var viewer =
    1.43 +    SpecialPowers.wrap($("ourFrame")).contentWindow
    1.44 +                 .QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
    1.45 +                 .getInterface(SpecialPowers.Ci.nsIWebNavigation)
    1.46 +                 .QueryInterface(SpecialPowers.Ci.nsIDocShell)
    1.47 +                 .contentViewer
    1.48 +                 .QueryInterface(SpecialPowers.Ci.nsIMarkupDocumentViewer);
    1.49 +  viewer.fullZoom = 2;
    1.50 +  
    1.51 +  s3 = snapshotWindow(window);
    1.52 +
    1.53 +  [equal, str1, str2] = compareSnapshots(s1, s3, true);
    1.54 +  ok(equal, "Zoom should have no effect",
    1.55 +     "got " + str1 + " but expected " + str2);
    1.56 +
    1.57 +  $("display").style.display = "none";
    1.58 +
    1.59 +  s4 = snapshotWindow(window);
    1.60 +  [equal, str1, str2] = compareSnapshots(s3, s4, true);
    1.61 +  ok(!equal, "Should be able to see the canary");
    1.62 +
    1.63 +  SimpleTest.finish();
    1.64 +});
    1.65 +
    1.66 +
    1.67 +
    1.68 +</script>
    1.69 +</pre>
    1.70 +</body>
    1.71 +</html>
    1.72 +

mercurial