toolkit/content/tests/chrome/test_screenPersistence.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/content/tests/chrome/test_screenPersistence.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,63 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
     1.7 +
     1.8 +<window title="Window Open Test"
     1.9 +        onload="runTest()"
    1.10 +        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    1.11 +
    1.12 +  <script type="application/javascript"
    1.13 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
    1.14 +  <script type="application/javascript"
    1.15 +          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
    1.16 +
    1.17 +<script class="testbody" type="application/javascript"><![CDATA[
    1.18 +  SimpleTest.waitForExplicitFinish();
    1.19 +  let win;
    1.20 +  var left = 60 + screen.availLeft;
    1.21 +  var upper = 60 + screen.availTop;
    1.22 +
    1.23 +  function runTest() {
    1.24 +    win = window.openDialog("window_screenPosSize.xul",
    1.25 +                            null,
    1.26 +                            "chrome,dialog=no,all,screenX=" + left + ",screenY=" + upper + ",outerHeight=200,outerWidth=200");
    1.27 +    SimpleTest.waitForFocus(checkTest, win);
    1.28 +  }
    1.29 +  function checkTest() {
    1.30 +    is(win.screenX, left, "The window should be placed now at x=" + left + "px");
    1.31 +    is(win.screenY, upper, "The window should be placed now at y=" + upper + "px");
    1.32 +    is(win.outerHeight, 200, "The window size should be height=200px");
    1.33 +    is(win.outerWidth, 200, "The window size should be width=200px");
    1.34 +    runTest2();
    1.35 +  }
    1.36 +  function runTest2() {
    1.37 +    win.close();
    1.38 +    win = window.openDialog("window_screenPosSize.xul",
    1.39 +                            null,
    1.40 +                            "chrome,dialog=no,all");
    1.41 +    SimpleTest.waitForFocus(checkTest2, win);
    1.42 +  }
    1.43 +  function checkTest2() {
    1.44 +    let runTime = Components.classes["@mozilla.org/xre/app-info;1"]
    1.45 +                            .getService(Components.interfaces.nsIXULRuntime);
    1.46 +    if (runTime.OS != "Linux") {
    1.47 +      is(win.screenX, 80, "The window should be placed now at x=80px");
    1.48 +      is(win.screenY, 80, "The window should be placed now at y=80px");
    1.49 +    }
    1.50 +    is(win.outerHeight, 300, "The window size should be height=300px");
    1.51 +    is(win.outerWidth, 300, "The window size should be width=300px");
    1.52 +    win.close();
    1.53 +    SimpleTest.finish();
    1.54 +  }
    1.55 +]]></script>
    1.56 +
    1.57 +<body xmlns="http://www.w3.org/1999/xhtml">
    1.58 +<p id="display">
    1.59 +</p>
    1.60 +<div id="content" style="display: none">
    1.61 +</div>
    1.62 +<pre id="test">
    1.63 +</pre>
    1.64 +</body>
    1.65 +
    1.66 +</window>

mercurial