[PATCH v2] comctl32/tests: Prevent some test failures by moving the cursor away from the window.

Sven Baars sven.wine at gmail.com
Mon Oct 7 04:19:40 CDT 2019


Signed-off-by: Sven Baars <sven.wine at gmail.com>
---
v2: Restore the original cursor position after the test.

 dlls/comctl32/tests/edit.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/dlls/comctl32/tests/edit.c b/dlls/comctl32/tests/edit.c
index f454434a0c..6013cafb59 100644
--- a/dlls/comctl32/tests/edit.c
+++ b/dlls/comctl32/tests/edit.c
@@ -3315,6 +3315,9 @@ static void test_change_focus(void)
     HWND hwnd, parent_wnd;
     WNDPROC oldproc;
     MSG msg;
+    POINT orig_pos;
+
+    GetCursorPos(&orig_pos);
 
     parent_wnd = CreateWindowA("ParentWnd", "", WS_OVERLAPPEDWINDOW,
             0, 0, 200, 200, NULL, NULL, GetModuleHandleA(NULL), NULL);
@@ -3329,6 +3332,8 @@ static void test_change_focus(void)
     oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC, (LONG_PTR)edit_subclass_proc);
     SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)oldproc);
 
+    SetCursorPos(400, 400);
+
     SetFocus(parent_wnd);
     flush_sequences(sequences, NUM_MSG_SEQUENCES);
     SetFocus(hwnd);
@@ -3340,6 +3345,8 @@ static void test_change_focus(void)
     while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
     ok_sequence(sequences, COMBINED_SEQ_INDEX, killfocus_combined_seq, "Kill focus", TRUE);
 
+    SetCursorPos(orig_pos.x, orig_pos.y);
+
     DestroyWindow(hwnd);
 }
 
-- 
2.17.1




More information about the wine-devel mailing list