Bug 1708422: part 16) Rename `mozInlineSpellChecker::SpellCheckerTimeSlice` to `mozIn...
[gecko.git] / widget / tests / test_panel_mouse_coords.xhtml
blob7ac02da0115be1f6f5ff850bcf8e912ea10873c1
1 <?xml version="1.0"?>
2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
4 <!--
5 https://bugzilla.mozilla.org/show_bug.cgi?id=835044
6 -->
7 <window title="Mozilla Bug 835044"
8 onload="startTest()"
9 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
10 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
11 <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
13 <panel id="thepanel" level="parent"
14 onpopupshown="sendMouseEvent();"
15 onmousemove="checkCoords(event);"
16 width="80" height="80">
17 </panel>
19 <!-- test results are displayed in the html:body -->
20 <body xmlns="http://www.w3.org/1999/xhtml">
21 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=835044"
22 id="anchor"
23 target="_blank">Mozilla Bug 835044</a>
24 </body>
26 <!-- test code goes here -->
27 <script type="application/javascript">
28 <![CDATA[
29 SimpleTest.waitForExplicitFinish();
31 let utils = window.windowUtils;
32 let panel = document.getElementById('thepanel');
33 let rect;
35 function startTest() {
36 // This first event is to ensure that the next event will have different
37 // coordinates to the previous mouse position, and so actually generates
38 // mouse events. The mouse is not moved off the window, as that might
39 // move focus to another application.
40 synthesizeNativeMouseEvent({
41 type: "mousemove",
42 screenX: window.mozInnerScreenX,
43 screenY: window.mozInnerScreenY,
44 scale: "screenPixelsPerCSSPixelNoOverride",
45 elementOnWidget: window.documentElement,
46 });
48 panel.openPopup(document.getElementById("anchor"), "after_start");
51 function sendMouseEvent() {
52 rect = panel.getBoundingClientRect();
53 synthesizeNativeMouseEvent({
54 type: "mousemove",
55 target: panel,
56 offsetX: 1,
57 offsetY: 2,
58 });
61 function checkCoords(event) {
62 isfuzzy(event.clientX, rect.left + 1, window.windowUtils.screenPixelsPerCSSPixel, "Motion x coordinate");
63 isfuzzy(event.clientY, rect.top + 2, window.windowUtils.screenPixelsPerCSSPixel, "Motion y coordinate");
64 done();
67 function done() {
68 SimpleTest.finish();
70 ]]>
71 </script>
72 </window>