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

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:96356d0664b3
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/
3 */
4
5 function test () {
6 waitForExplicitFinish();
7 window.maximize();
8
9 // Find where the nav-bar is vertically.
10 var navBar = document.getElementById("nav-bar");
11 var boundingRect = navBar.getBoundingClientRect();
12 var yPixel = boundingRect.top + Math.floor(boundingRect.height / 2);
13 var xPixel = boundingRect.width - 1; // Use the last pixel of the screen since it is maximized.
14
15 function onPopupHidden() {
16 PanelUI.panel.removeEventListener("popuphidden", onPopupHidden);
17 window.restore();
18 finish();
19 }
20 function onPopupShown() {
21 PanelUI.panel.removeEventListener("popupshown", onPopupShown);
22 ok(true, "Clicking at the far edge of the window opened the menu popup.");
23 PanelUI.panel.addEventListener("popuphidden", onPopupHidden);
24 PanelUI.hide();
25 }
26 registerCleanupFunction(function() {
27 PanelUI.panel.removeEventListener("popupshown", onPopupShown);
28 PanelUI.panel.removeEventListener("popuphidden", onPopupHidden);
29 });
30 PanelUI.panel.addEventListener("popupshown", onPopupShown);
31 EventUtils.synthesizeMouseAtPoint(xPixel, yPixel, {}, window);
32 }

mercurial