Commit 87653d26 authored by Alexandre Julliard's avatar Alexandre Julliard

user32/tests: Fix some assumption about absolute window positions.

parent 1bc6b962
......@@ -10203,14 +10203,16 @@ static void window_from_point_proc(HWND parent)
child_static = CreateWindowExA(0, "static", "static", WS_CHILD | WS_VISIBLE,
0, 0, 100, 100, parent, 0, NULL, NULL);
ok(child_static != 0, "CreateWindowEx failed\n");
pt.x = pt.y = 150;
pt.x = pt.y = 50;
ClientToScreen( child_static, &pt );
win = WindowFromPoint(pt);
ok(win == parent, "WindowFromPoint returned %p, expected %p\n", win, parent);
child_button = CreateWindowExA(0, "button", "button", WS_CHILD | WS_VISIBLE,
100, 0, 100, 100, parent, 0, NULL, NULL);
ok(child_button != 0, "CreateWindowEx failed\n");
pt.x = 250;
pt.x = pt.y = 50;
ClientToScreen( child_button, &pt );
win = WindowFromPoint(pt);
ok(win == child_button, "WindowFromPoint returned %p, expected %p\n", win, child_button);
......@@ -10243,7 +10245,7 @@ static void window_from_point_proc(HWND parent)
CloseHandle(end_event);
}
static void test_window_from_point(const char *argv0)
static void test_window_from_point(HWND main_window, const char *argv0)
{
HWND hwnd, child, win;
POINT pt;
......@@ -10253,12 +10255,15 @@ static void test_window_from_point(const char *argv0)
HANDLE start_event, end_event;
hwnd = CreateWindowExA(0, "MainWindowClass", NULL, WS_POPUP | WS_VISIBLE,
100, 100, 200, 100, 0, 0, NULL, NULL);
100, 100, 200, 100, main_window, 0, NULL, NULL);
ok(hwnd != 0, "CreateWindowEx failed\n");
pt.x = pt.y = 150;
pt.x = pt.y = 50;
ClientToScreen( hwnd, &pt );
win = WindowFromPoint(pt);
pt.x = 250;
pt.x = 150;
pt.y = 50;
ClientToScreen( hwnd, &pt );
if(win == hwnd)
win = WindowFromPoint(pt);
if(win != hwnd) {
......@@ -10270,7 +10275,8 @@ static void test_window_from_point(const char *argv0)
child = CreateWindowExA(0, "static", "static", WS_CHILD | WS_VISIBLE,
0, 0, 100, 100, hwnd, 0, NULL, NULL);
ok(child != 0, "CreateWindowEx failed\n");
pt.x = pt.y = 150;
pt.x = pt.y = 50;
ClientToScreen( hwnd, &pt );
win = WindowFromPoint(pt);
ok(win == hwnd, "WindowFromPoint returned %p, expected %p\n", win, hwnd);
DestroyWindow(child);
......@@ -10298,11 +10304,13 @@ static void test_window_from_point(const char *argv0)
win = WindowFromPoint(pt);
ok(win == child, "WindowFromPoint returned %p, expected %p\n", win, child);
simulate_click(150, 150);
simulate_click(pt.x, pt.y);
flush_events(TRUE);
child = GetWindow(child, GW_HWNDNEXT);
pt.x = 250;
pt.x = 150;
pt.y = 50;
ClientToScreen( hwnd, &pt );
win = WindowFromPoint(pt);
ok(win == child, "WindowFromPoint returned %p, expected %p\n", win, child);
......@@ -13084,7 +13092,7 @@ START_TEST(win)
/* Add the tests below this line */
test_child_window_from_point();
test_window_from_point(argv[0]);
test_window_from_point(hwndMain, argv[0]);
test_thick_child_size(hwndMain);
test_fullscreen();
test_hwnd_message();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment