[PATCH] user32: Add tests showing that MapWindowPoints, ClientToScreen and ScreenToClient never fail.
Christian Costa
titan.costa at gmail.com
Tue Oct 16 13:12:42 CDT 2012
---
dlls/user32/tests/win.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index e84824d..298ea07 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -7104,6 +7104,54 @@ todo_wine
ok(ret, "UnregisterClass(my_window) failed\n");
}
+static void test_client_screen(void)
+{
+ BOOL ret;
+ RECT rect;
+ POINT point;
+ HWND wnd;
+
+ ret = GetWindowRect(GetDesktopWindow(), &rect);
+ ok(ret, "GetWindowRect failed with %#x\n", GetLastError());
+
+ wnd = CreateWindowA("static", NULL, 0, 0, 0, rect.right / 2, rect.bottom / 2, 0, 0, 0, 0);
+ //SetWindowPos(wnd, NULL, 0, 0, rect.right / 2, rect.bottom / 2, 0);
+
+ /* Choose point inside the client area */
+ point.x = rect.right / 2 - 50;
+ point.y = rect.bottom / 2 - 50;
+ ret = ClientToScreen(wnd, &point);
+ ok(ret, "ClientToScreen failed with %#x\n", GetLastError());
+ ret = MapWindowPoints(wnd, NULL, &point, 1);
+ ok(ret, "MapWindowPoints failed with %#x\n", GetLastError());
+
+ /* Choose point outside the client area */
+ point.x = rect.right / 2 + 50;
+ point.y = rect.bottom / 2 + 50;
+ ret = ClientToScreen(wnd, &point);
+ ok(ret, "ClientToScreen failed with %#x\n", GetLastError());
+ ret = MapWindowPoints(wnd, NULL, &point, 1);
+ ok(ret, "MapWindowPoints failed with %#x\n", GetLastError());
+
+ /* Choose point inside the client area */
+ point.x = rect.right / 2 - 50;
+ point.y = rect.bottom / 2 - 50;
+ ret = ScreenToClient(wnd, &point);
+ ok(ret, "ScreenToClient failed with %#x\n", GetLastError());
+ ret = MapWindowPoints(NULL, wnd, &point, 1);
+ ok(ret, "MapWindowPoints failed with %#x\n", GetLastError());
+
+ /* Choose point outside the client area */
+ point.x = rect.right / 2 + 50;
+ point.y = rect.bottom / 2 + 50;
+ ret = ScreenToClient(wnd, &point);
+ ok(ret, "ScreenToClient failed with %#x\n", GetLastError());
+ ret = MapWindowPoints(NULL, wnd, &point, 1);
+ ok(ret, "MapWindowPoints failed with %#x\n", GetLastError());
+
+ DestroyWindow(wnd);
+}
+
START_TEST(win)
{
HMODULE user32 = GetModuleHandleA( "user32.dll" );
@@ -7212,6 +7260,7 @@ START_TEST(win)
test_shell_window();
test_handles( hwndMain );
test_winregion();
+ test_client_screen();
/* add the tests above this line */
if (hhook) UnhookWindowsHookEx(hhook);
More information about the wine-patches
mailing list