Zebediah Figura : user32/tests: Add some tests for WM_CANCELMODE.
Alexandre Julliard
julliard at winehq.org
Thu Jan 7 15:35:59 CST 2021
Module: wine
Branch: master
Commit: 522b230142e22673ac0eabf5fd246abd22098571
URL: https://source.winehq.org/git/wine.git/?a=commit;h=522b230142e22673ac0eabf5fd246abd22098571
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Wed Jan 6 22:49:46 2021 -0600
user32/tests: Add some tests for WM_CANCELMODE.
In particular, test sending WM_CANCELMODE to a parent of the capture window.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/tests/win.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index c9d2819e1a9..47864340e39 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -11850,6 +11850,50 @@ static void test_other_process_window(const char *argv0)
DestroyWindow(hwnd);
}
+static void test_cancel_mode(void)
+{
+ HWND hwnd1, hwnd2, child;
+ LRESULT ret;
+
+ hwnd1 = CreateWindowA("MainWindowClass", "window 1", WS_OVERLAPPEDWINDOW,
+ 100, 200, 500, 300, NULL, NULL, NULL, NULL);
+ hwnd2 = CreateWindowA("MainWindowClass", "window 2", WS_OVERLAPPEDWINDOW,
+ 100, 200, 500, 300, NULL, NULL, NULL, NULL);
+ flush_events(TRUE);
+ SetCapture(hwnd1);
+ ok(GetCapture() == hwnd1, "got capture %p\n", GetCapture());
+
+ ret = SendMessageA(hwnd2, WM_CANCELMODE, 0, 0);
+ ok(!ret, "got %ld\n", ret);
+ ok(GetCapture() == hwnd1, "got capture %p\n", GetCapture());
+
+ ret = SendMessageA(hwnd1, WM_CANCELMODE, 0, 0);
+ ok(!ret, "got %ld\n", ret);
+ ok(!GetCapture(), "got capture %p\n", GetCapture());
+
+ child = CreateWindowA("MainWindowClass", "child", WS_CHILD,
+ 0, 0, 100, 100, hwnd1, NULL, NULL, NULL);
+
+ SetCapture(child);
+ ok(GetCapture() == child, "got capture %p\n", GetCapture());
+
+ ret = SendMessageA(hwnd2, WM_CANCELMODE, 0, 0);
+ ok(!ret, "got %ld\n", ret);
+ ok(GetCapture() == child, "got capture %p\n", GetCapture());
+
+ ret = SendMessageA(hwnd1, WM_CANCELMODE, 0, 0);
+ ok(!ret, "got %ld\n", ret);
+ ok(GetCapture() == child, "got capture %p\n", GetCapture());
+
+ ret = SendMessageA(child, WM_CANCELMODE, 0, 0);
+ ok(!ret, "got %ld\n", ret);
+ ok(!GetCapture(), "got capture %p\n", GetCapture());
+
+ DestroyWindow(child);
+ DestroyWindow(hwnd1);
+ DestroyWindow(hwnd2);
+}
+
START_TEST(win)
{
char **argv;
@@ -12016,6 +12060,7 @@ START_TEST(win)
test_arrange_iconic_windows();
test_other_process_window(argv[0]);
test_SC_SIZE();
+ test_cancel_mode();
/* add the tests above this line */
if (hhook) UnhookWindowsHookEx(hhook);
More information about the wine-cvs
mailing list