test_wpt_pointerevent_movementxy-manual.html (2641B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1399740 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 1399740</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <script src="/tests/SimpleTest/EventUtils.js"></script> 11 <script type="text/javascript" src="mochitest_support_external.js"></script> 12 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 13 <script type="text/javascript"> 14 SimpleTest.waitForExplicitFinish(); 15 function startTest() { 16 runTestInNewWindow("wpt/pointerlock/pointerevent_movementxy-manual.html"); 17 } 18 function executeTest(int_win) { 19 let box1 = int_win.document.getElementById("box1"); 20 let box2 = int_win.document.getElementById("box2"); 21 let rect1 = box1.getBoundingClientRect(); 22 let rect2 = box2.getBoundingClientRect(); 23 let offsetX = rect1.left + rect1.width / 2; 24 let offsetY = rect1.top + rect1.height / 2; 25 let stepX = (rect2.left + rect2.width / 2 - offsetX) / 10; 26 let stepY = (rect2.top + rect2.height / 2 - offsetY) / 10; 27 sendMouseEventAtPoint(int_win, offsetX, offsetY, "mousemove", {inputSource:MouseEvent.MOZ_SOURCE_MOUSE}); 28 sendMouseEventAtPoint(int_win, offsetX, offsetY, "mousedown", {inputSource:MouseEvent.MOZ_SOURCE_MOUSE}); 29 sendMouseEventAtPoint(int_win, offsetX, offsetY, "mousemove", {inputSource:MouseEvent.MOZ_SOURCE_MOUSE}); 30 for (var i = 0; i < 10; ++i) { 31 offsetX += stepX; 32 offsetY += stepY; 33 sendMouseEventAtPoint(int_win, offsetX, offsetY, "mousemove", {inputSource:MouseEvent.MOZ_SOURCE_MOUSE}); 34 } 35 sendMouseEventAtPoint(int_win, offsetX, offsetY, "mouseup", {inputSource:MouseEvent.MOZ_SOURCE_MOUSE}); 36 37 offsetX = rect1.left + rect1.width / 2; 38 offsetY = rect1.top + rect1.height / 2; 39 sendMouseEventAtPoint(int_win, offsetX, offsetY, "mousemove", {inputSource:MouseEvent.MOZ_SOURCE_TOUCH}); 40 sendMouseEventAtPoint(int_win, offsetX, offsetY, "mousedown", {inputSource:MouseEvent.MOZ_SOURCE_TOUCH}); 41 sendMouseEventAtPoint(int_win, offsetX, offsetY, "mousemove", {inputSource:MouseEvent.MOZ_SOURCE_TOUCH}); 42 for (var i = 0; i < 10; ++i) { 43 offsetX += stepX; 44 offsetY += stepY; 45 sendMouseEventAtPoint(int_win, offsetX, offsetY, "mousemove", {inputSource:MouseEvent.MOZ_SOURCE_TOUCH}); 46 } 47 sendMouseEventAtPoint(int_win, offsetX, offsetY, "mouseup", {inputSource:MouseEvent.MOZ_SOURCE_TOUCH}); 48 } 49 </script> 50 </head> 51 <body> 52 </body> 53 </html>