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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial