Add a mouse input test case, make the test pass under Wine.
This commit is contained in:
parent
3b1a7a7a23
commit
99fda0a1de
|
@ -2099,6 +2099,66 @@ static void test_keyboard_input(HWND hwnd)
|
||||||
ok(!PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "message %04x available\n", msg.message);
|
ok(!PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "message %04x available\n", msg.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_mouse_input(HWND hwnd)
|
||||||
|
{
|
||||||
|
RECT rc;
|
||||||
|
POINT pt;
|
||||||
|
int x, y;
|
||||||
|
HWND popup;
|
||||||
|
MSG msg;
|
||||||
|
|
||||||
|
ShowWindow(hwnd, SW_SHOW);
|
||||||
|
UpdateWindow(hwnd);
|
||||||
|
|
||||||
|
GetWindowRect(hwnd, &rc);
|
||||||
|
trace("main window %p: (%ld,%ld)-(%ld,%ld)\n", hwnd, rc.left, rc.top, rc.right, rc.bottom);
|
||||||
|
|
||||||
|
popup = CreateWindowExA(0, "MainWindowClass", NULL, WS_POPUP,
|
||||||
|
rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top,
|
||||||
|
hwnd, 0, 0, NULL);
|
||||||
|
assert(popup != 0);
|
||||||
|
ShowWindow(popup, SW_SHOW);
|
||||||
|
UpdateWindow(popup);
|
||||||
|
|
||||||
|
GetWindowRect(popup, &rc);
|
||||||
|
trace("popup window %p: (%ld,%ld)-(%ld,%ld)\n", popup, rc.left, rc.top, rc.right, rc.bottom);
|
||||||
|
|
||||||
|
x = rc.left + (rc.right - rc.left) / 2;
|
||||||
|
y = rc.top + (rc.bottom - rc.top) / 2;
|
||||||
|
trace("setting cursor to (%d,%d)\n", x, y);
|
||||||
|
|
||||||
|
SetCursorPos(x, y);
|
||||||
|
GetCursorPos(&pt);
|
||||||
|
ok(x == pt.x && y == pt.y, "wrong cursor pos (%ld,%ld), expected (%d,%d)\n", pt.x, pt.y, x, y);
|
||||||
|
|
||||||
|
/* force the system to update its internal queue mouse position,
|
||||||
|
* otherwise it won't generate relative mouse movements below.
|
||||||
|
*/
|
||||||
|
mouse_event(MOUSEEVENTF_MOVE, -1, -1, 0, 0);
|
||||||
|
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
|
||||||
|
|
||||||
|
msg.message = 0;
|
||||||
|
mouse_event(MOUSEEVENTF_MOVE, 1, 1, 0, 0);
|
||||||
|
ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
|
||||||
|
ok(msg.hwnd == popup && msg.message == WM_MOUSEMOVE, "hwnd %p message %04x\n", msg.hwnd, msg.message);
|
||||||
|
/* FIXME: SetCursorPos in Wine generates additional WM_MOUSEMOVE message */
|
||||||
|
if (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
|
||||||
|
ok(msg.hwnd == popup && msg.message == WM_MOUSEMOVE, "hwnd %p message %04x\n", msg.hwnd, msg.message);
|
||||||
|
ok(!PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "message %04x available\n", msg.message);
|
||||||
|
|
||||||
|
mouse_event(MOUSEEVENTF_MOVE, -1, -1, 0, 0);
|
||||||
|
ShowWindow(popup, SW_HIDE);
|
||||||
|
ok(PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "no message available\n");
|
||||||
|
ok(msg.hwnd == hwnd && msg.message == WM_MOUSEMOVE, "hwnd %p message %04x\n", msg.hwnd, msg.message);
|
||||||
|
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
|
||||||
|
|
||||||
|
mouse_event(MOUSEEVENTF_MOVE, 1, 1, 0, 0);
|
||||||
|
ShowWindow(hwnd, SW_HIDE);
|
||||||
|
ok(!PeekMessageA(&msg, 0, 0, 0, PM_REMOVE), "message %04x available\n", msg.message);
|
||||||
|
|
||||||
|
DestroyWindow(popup);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(win)
|
START_TEST(win)
|
||||||
{
|
{
|
||||||
pGetAncestor = (void *)GetProcAddress( GetModuleHandleA("user32.dll"), "GetAncestor" );
|
pGetAncestor = (void *)GetProcAddress( GetModuleHandleA("user32.dll"), "GetAncestor" );
|
||||||
|
@ -2153,6 +2213,7 @@ START_TEST(win)
|
||||||
|
|
||||||
test_children_zorder(hwndMain);
|
test_children_zorder(hwndMain);
|
||||||
test_keyboard_input(hwndMain);
|
test_keyboard_input(hwndMain);
|
||||||
|
test_mouse_input(hwndMain);
|
||||||
|
|
||||||
UnhookWindowsHookEx(hhook);
|
UnhookWindowsHookEx(hhook);
|
||||||
}
|
}
|
||||||
|
|
|
@ -605,6 +605,8 @@ void X11DRV_MotionNotify( HWND hwnd, XMotionEvent *event )
|
||||||
{
|
{
|
||||||
POINT pt;
|
POINT pt;
|
||||||
|
|
||||||
|
TRACE("hwnd %p, event->is_hint %d\n", hwnd, event->is_hint);
|
||||||
|
|
||||||
if (!hwnd) return;
|
if (!hwnd) return;
|
||||||
|
|
||||||
update_cursor( hwnd, event->window );
|
update_cursor( hwnd, event->window );
|
||||||
|
@ -622,8 +624,10 @@ void X11DRV_EnterNotify( HWND hwnd, XCrossingEvent *event )
|
||||||
{
|
{
|
||||||
POINT pt;
|
POINT pt;
|
||||||
|
|
||||||
if (event->detail == NotifyVirtual || event->detail == NotifyNonlinearVirtual) return;
|
TRACE("hwnd %p, event->detail %d\n", hwnd, event->detail);
|
||||||
|
|
||||||
if (!hwnd) return;
|
if (!hwnd) return;
|
||||||
|
if (event->detail == NotifyVirtual || event->detail == NotifyNonlinearVirtual) return;
|
||||||
|
|
||||||
/* simulate a mouse motion event */
|
/* simulate a mouse motion event */
|
||||||
update_cursor( hwnd, event->window );
|
update_cursor( hwnd, event->window );
|
||||||
|
|
Loading…
Reference in New Issue