browser/base/content/test/general/browser_menuButtonFitts.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/base/content/test/general/browser_menuButtonFitts.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,32 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 + * http://creativecommons.org/publicdomain/zero/1.0/
     1.6 + */
     1.7 +
     1.8 +function test () {
     1.9 +  waitForExplicitFinish();
    1.10 +  window.maximize();
    1.11 +
    1.12 +  // Find where the nav-bar is vertically.
    1.13 +  var navBar = document.getElementById("nav-bar");
    1.14 +  var boundingRect = navBar.getBoundingClientRect();
    1.15 +  var yPixel = boundingRect.top + Math.floor(boundingRect.height / 2);
    1.16 +  var xPixel = boundingRect.width - 1; // Use the last pixel of the screen since it is maximized.
    1.17 +
    1.18 +  function onPopupHidden() {
    1.19 +    PanelUI.panel.removeEventListener("popuphidden", onPopupHidden);
    1.20 +    window.restore();
    1.21 +    finish();
    1.22 +  }
    1.23 +  function onPopupShown() {
    1.24 +    PanelUI.panel.removeEventListener("popupshown", onPopupShown);
    1.25 +    ok(true, "Clicking at the far edge of the window opened the menu popup.");
    1.26 +    PanelUI.panel.addEventListener("popuphidden", onPopupHidden);
    1.27 +    PanelUI.hide();
    1.28 +  }
    1.29 +  registerCleanupFunction(function() {
    1.30 +    PanelUI.panel.removeEventListener("popupshown", onPopupShown);
    1.31 +    PanelUI.panel.removeEventListener("popuphidden", onPopupHidden);
    1.32 +  });
    1.33 +  PanelUI.panel.addEventListener("popupshown", onPopupShown);
    1.34 +  EventUtils.synthesizeMouseAtPoint(xPixel, yPixel, {}, window);
    1.35 +}

mercurial