2 <?xml-stylesheet type=
"text/css" href=
"chrome://global/skin"?>
3 <?xml-stylesheet type=
"text/css" href=
"chrome://mochikit/content/tests/SimpleTest/test.css"?>
5 https://bugzilla.mozilla.org/show_bug.cgi?id=835044
7 <window title=
"Mozilla Bug 835044"
9 xmlns=
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
10 <script type=
"application/javascript"
11 src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
13 <panel id=
"thepanel" level=
"parent"
14 onpopupshown=
"sendMouseEvent();"
15 onmousemove=
"checkCoords(event);"
16 width=
"80" height=
"80">
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"
23 target=
"_blank">Mozilla Bug
835044</a>
26 <!-- test code goes here -->
27 <script type=
"application/javascript">
29 SimpleTest.waitForExplicitFinish();
31 let Cc = Components.classes;
32 let Ci = Components.interfaces;
33 let utils = window.QueryInterface(Ci.nsIInterfaceRequestor).
34 getInterface(Ci.nsIDOMWindowUtils);
35 let panel = document.getElementById('thepanel');
39 function startTest() {
40 let widgetToolkit = Cc[
"@mozilla.org/xre/app-info;1"].
41 getService(Ci.nsIXULRuntime).widgetToolkit;
43 if (widgetToolkit ==
"cocoa") {
44 nativeMouseMove =
5; // NSMouseMoved
45 } else if (widgetToolkit ==
"windows") {
46 nativeMouseMove =
1; // MOUSEEVENTF_MOVE
47 } else if (/^gtk/.test(widgetToolkit)) {
48 nativeMouseMove =
3; // GDK_MOTION_NOTIFY
50 todo_is(
"widgetToolkit", widgetToolkit,
"Platform not supported");
54 // This first event is to ensure that the next event will have different
55 // coordinates to the previous mouse position, and so actually generates
56 // mouse events. The mouse is not moved off the window, as that might
57 // move focus to another application.
58 utils.sendNativeMouseEvent(window.mozInnerScreenX, window.mozInnerScreenY,
59 nativeMouseMove,
0, window.documentElement);
61 panel.openPopup(document.getElementById(
"anchor"),
"after_start");
64 function sendMouseEvent() {
65 rect = panel.getBoundingClientRect();
66 let x = window.mozInnerScreenX + rect.left +
1;
67 let y = window.mozInnerScreenY + rect.top +
2;
68 utils.sendNativeMouseEvent(x, y, nativeMouseMove,
0,
69 window.documentElement);
72 function checkCoords(event) {
73 is(event.clientX, rect.left +
1,
"Motion x coordinate");
74 is(event.clientY, rect.top +
2,
"Motion y coordinate");