Commit e42bd179 authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Vitaly Lipatov

user32/tests: Add tests for window region of layered windows.

parent d274f7ad
......@@ -87,6 +87,7 @@ static int (WINAPI *pGetMouseMovePointsEx) (UINT, LPMOUSEMOVEPOINT, LPMOUSEMOVEP
static UINT (WINAPI *pGetRawInputDeviceList) (PRAWINPUTDEVICELIST, PUINT, UINT);
static UINT (WINAPI *pGetRawInputDeviceInfoW) (HANDLE, UINT, void *, UINT *);
static UINT (WINAPI *pGetRawInputDeviceInfoA) (HANDLE, UINT, void *, UINT *);
static int (WINAPI *pGetWindowRgnBox)(HWND, LPRECT);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
#define MAXKEYEVENTS 12
......@@ -154,6 +155,7 @@ static void init_function_pointers(void)
GET_PROC(GetRawInputDeviceList);
GET_PROC(GetRawInputDeviceInfoW);
GET_PROC(GetRawInputDeviceInfoA);
GET_PROC(GetWindowRgnBox);
hdll = GetModuleHandleA("kernel32");
GET_PROC(IsWow64Process);
......@@ -3440,6 +3442,9 @@ static void test_Input_mouse(void)
DWORD thread_id;
WNDCLASSA wclass;
POINT pt, pt_org;
int region_type;
HRGN hregion;
RECT region;
MSG msg;
BOOL ret;
......@@ -3678,6 +3683,12 @@ static void test_Input_mouse(void)
while (wait_for_message(&msg)) DispatchMessageA(&msg);
Sleep(100);
if (pGetWindowRgnBox)
{
region_type = pGetWindowRgnBox(hwnd, &region);
ok(region_type == ERROR, "expected ERROR, got %d\n", region_type);
}
got_button_down = got_button_up = FALSE;
simulate_click(TRUE, 150, 150);
while (wait_for_message(&msg))
......@@ -3704,6 +3715,12 @@ static void test_Input_mouse(void)
while (wait_for_message(&msg)) DispatchMessageA(&msg);
Sleep(100);
if (pGetWindowRgnBox)
{
region_type = pGetWindowRgnBox(hwnd, &region);
ok(region_type == ERROR, "expected ERROR, got %d\n", region_type);
}
got_button_down = got_button_up = FALSE;
simulate_click(TRUE, 150, 150);
while (wait_for_message(&msg))
......@@ -3732,6 +3749,12 @@ static void test_Input_mouse(void)
while (wait_for_message(&msg)) DispatchMessageA(&msg);
Sleep(100);
if (pGetWindowRgnBox)
{
region_type = pGetWindowRgnBox(hwnd, &region);
ok(region_type == ERROR, "expected ERROR, got %d\n", region_type);
}
got_button_down = got_button_up = FALSE;
simulate_click(TRUE, 150, 150);
while (wait_for_message(&msg))
......@@ -3758,6 +3781,12 @@ static void test_Input_mouse(void)
while (wait_for_message(&msg)) DispatchMessageA(&msg);
Sleep(100);
if (pGetWindowRgnBox)
{
region_type = pGetWindowRgnBox(hwnd, &region);
ok(region_type == ERROR, "expected ERROR, got %d\n", region_type);
}
got_button_down = got_button_up = FALSE;
simulate_click(TRUE, 150, 150);
while (wait_for_message(&msg))
......@@ -3785,6 +3814,12 @@ static void test_Input_mouse(void)
while (wait_for_message(&msg)) DispatchMessageA(&msg);
Sleep(100);
if (pGetWindowRgnBox)
{
region_type = pGetWindowRgnBox(hwnd, &region);
ok(region_type == ERROR, "expected ERROR, got %d\n", region_type);
}
got_button_down = got_button_up = FALSE;
simulate_click(TRUE, 150, 150);
while (wait_for_message(&msg))
......@@ -3806,6 +3841,41 @@ static void test_Input_mouse(void)
ok(got_button_down, "expected WM_LBUTTONDOWN message\n");
ok(got_button_up, "expected WM_LBUTTONUP message\n");
hregion = CreateRectRgn(0, 0, 10, 10);
ok(hregion != NULL, "CreateRectRgn failed\n");
ret = SetWindowRgn(hwnd, hregion, TRUE);
ok(ret, "SetWindowRgn failed\n");
DeleteObject(hregion);
while (wait_for_message(&msg)) DispatchMessageA(&msg);
Sleep(1000);
if (pGetWindowRgnBox)
{
region_type = pGetWindowRgnBox(hwnd, &region);
ok(region_type == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", region_type);
}
got_button_down = got_button_up = FALSE;
simulate_click(TRUE, 150, 150);
while (wait_for_message(&msg))
{
DispatchMessageA(&msg);
if (msg.message == WM_LBUTTONDOWN)
{
ok(msg.hwnd == button_win, "msg.hwnd = %p\n", msg.hwnd);
got_button_down = TRUE;
}
else if (msg.message == WM_LBUTTONUP)
{
ok(msg.hwnd == button_win, "msg.hwnd = %p\n", msg.hwnd);
got_button_up = TRUE;
break;
}
}
ok(got_button_down, "expected WM_LBUTTONDOWN message\n");
ok(got_button_up, "expected WM_LBUTTONUP message\n");
DestroyWindow(hwnd);
SetCursorPos(pt_org.x, pt_org.y);
......
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