diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /layout/xul/test/test_bug987230.xul | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'layout/xul/test/test_bug987230.xul')
-rw-r--r-- | layout/xul/test/test_bug987230.xul | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/layout/xul/test/test_bug987230.xul b/layout/xul/test/test_bug987230.xul new file mode 100644 index 000000000..b2b47f470 --- /dev/null +++ b/layout/xul/test/test_bug987230.xul @@ -0,0 +1,125 @@ +<?xml version="1.0"?> +<?xml-stylesheet type="text/css" href="chrome://global/skin"?> +<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=987230 +--> +<window title="Mozilla Bug 987230" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + onload="SimpleTest.waitForFocus(nextTest, window)"> + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> + + + <!-- test results are displayed in the html:body --> + <body xmlns="http://www.w3.org/1999/xhtml"> + <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=987230" + target="_blank">Mozilla Bug 987230</a> + </body> + + <vbox> + <toolbar> + <toolbarbutton id="toolbarbutton-anchor" + label="Anchor" + consumeanchor="toolbarbutton-anchor" + onclick="onAnchorClick(event)" + style="padding: 50px !important; list-style-image: url(chrome://branding/content/icon32.png)"/> + </toolbar> + <spacer flex="1"/> + <hbox id="hbox-anchor" + style="padding: 20px" + onclick="onAnchorClick(event)"> + <hbox id="inner-anchor" + consumeanchor="hbox-anchor" + > + Another anchor + </hbox> + </hbox> + <spacer flex="1"/> + </vbox> + + <panel id="mypopup" + type="arrow" + onpopupshown="onMyPopupShown(event)" + onpopuphidden="onMyPopupHidden(event)">This is a test popup</panel> + + <!-- test code goes here --> + <script type="application/javascript"> + <![CDATA[ + /** Test for Bug 987230 **/ + SimpleTest.waitForExplicitFinish(); + + SimpleTest.requestCompleteLog(); + + const Ci = Components.interfaces; + const Cc = Components.classes; + + let platform = navigator.platform.toLowerCase(); + let isWindows = platform.startsWith("win"); + let mouseDown = isWindows ? 2 : 1; + let mouseUp = isWindows ? 4 : 2; + let mouseMove = isWindows ? 1 : 5; + let utils = window.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDOMWindowUtils); + let scale = utils.screenPixelsPerCSSPixel; + + + function synthesizeNativeMouseClick(aElement, aOffsetX, aOffsetY) { + let rect = aElement.getBoundingClientRect(); + let win = aElement.ownerDocument.defaultView; + let x = aOffsetX + win.mozInnerScreenX + rect.left; + let y = aOffsetY + win.mozInnerScreenY + rect.top; + + info("Sending mousedown+up for offsets: " + aOffsetX + ", " + aOffsetY + + "; innerscreen: " + win.mozInnerScreenX + ", " + win.mozInnerScreenY + + "; rect: " + rect.left + ", " + rect.top + "."); + info("Resulting x, y, scale: " + x + ", " + y + ", " + scale); + info("Final params: " + (x * scale) + ", " + (y * scale)); + utils.sendNativeMouseEvent(x * scale, y * scale, mouseDown, 0, null); + utils.sendNativeMouseEvent(x * scale, y * scale, mouseUp, 0, null); + } + + function onMyPopupHidden(e) { + ok(true, "Popup hidden"); + if (outerAnchor.id == "toolbarbutton-anchor") { + popupHasShown = false; + outerAnchor = document.getElementById("hbox-anchor"); + anchor = document.getElementById("inner-anchor"); + nextTest(); + } else { + //XXXgijs set mouse position back outside the iframe: + let frameRect = window.frameElement.getBoundingClientRect(); + let outsideOfFrameX = (window.mozInnerScreenX + frameRect.width + 100) * scale; + let outsideOfFrameY = Math.max(0, window.mozInnerScreenY - 100) * scale; + + info("Mousemove: " + outsideOfFrameX + ", " + outsideOfFrameY + + " (from innerscreen " + window.mozInnerScreenX + ", " + window.mozInnerScreenY + + " and rect width " + frameRect.width + " and scale " + scale + ")"); + utils.sendNativeMouseEvent(outsideOfFrameX, outsideOfFrameY, mouseMove, 0, null); + SimpleTest.finish(); + } + } + + let popupHasShown = false; + function onMyPopupShown(e) { + popupHasShown = true; + synthesizeNativeMouseClick(outerAnchor, 5, 5); + } + + function onAnchorClick(e) { + info("click: " + e.target.id); + ok(!popupHasShown, "Popup should only be shown once"); + popup.openPopup(anchor, "bottomcenter topright"); + } + + let popup = document.getElementById("mypopup"); + let outerAnchor = document.getElementById("toolbarbutton-anchor"); + let anchor = document.getAnonymousElementByAttribute(outerAnchor, "class", "toolbarbutton-icon"); + + function nextTest(e) { + synthesizeMouse(outerAnchor, 5, 5, {}); + } + + ]]> + </script> +</window> |