From: Ivan Ivlev <iviv@etersoft.ru> Signed-off-by: Ivan Ivlev <iviv@etersoft.ru> --- dlls/comctl32/tests/edit.c | 69 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/dlls/comctl32/tests/edit.c b/dlls/comctl32/tests/edit.c index 45c2a243b70..f9dfd3b98e4 100644 --- a/dlls/comctl32/tests/edit.c +++ b/dlls/comctl32/tests/edit.c @@ -3937,6 +3937,74 @@ static void test_PASSWORDCHAR(void) DestroyWindow (hwEdit); } +BOOL capture_changed = FALSE; + +LRESULT CALLBACK CaptureEditProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) +{ + WNDPROC origEditProc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA); + if (msg == WM_CAPTURECHANGED) + capture_changed = TRUE; + return CallWindowProcA(origEditProc, hwnd, msg, wp, lp); +} + +int CheckCapture(void) +{ + if(capture_changed){ + capture_changed = FALSE; + return 1; + } + return 0; +} + +static void test_WM_LBUTTONDOWN(void) +{ + HWND hwEdit; + WNDPROC origEditProc; + + hwEdit = CreateWindowExA(0, "EDIT", "Test", ES_LEFT, + 0, 0, 100, 100, NULL, NULL, NULL, NULL); + origEditProc = (WNDPROC)SetWindowLongPtrA(hwEdit, GWLP_WNDPROC, (LONG_PTR)CaptureEditProc); + SetWindowLongPtrA(hwEdit, GWLP_USERDATA, (LONG_PTR)origEditProc); + // test single WM_LBUTTONDOWN processing + ok(!CheckCapture(), "Unexpected WM_CAPTURECHANGED recieved\n"); + todo_wine ok(SendMessageA(hwEdit, WM_LBUTTONDOWN, 1, 0), + "WM_LBUTTONDOWN was not processed. LastError=%ld\n", GetLastError()); + ok(!CheckCapture(), "Unexpected WM_CAPTURECHANGED recieved after WM_LBUTTONDOWN\n"); + ok(GetFocus() == hwEdit, + "Focus is not on Edit Control, instead on %p\n", GetFocus()); + ok(GetCapture() == hwEdit, + "Capture not on Edit Control, instead on %p\n", GetCapture()); + + todo_wine ok(SendMessageA(hwEdit, WM_LBUTTONUP, 0, 0), + "WM_LBUTTONUP was not processed. LastError=%ld\n", GetLastError()); + ok(CheckCapture(), "Expected WM_CAPTURECHANGED was not recieved after WM_LBUTTONUP\n"); + ok(GetFocus() == hwEdit, + "Focus is not on Edit Control, instead on %p\n", GetFocus()); + ok(GetCapture() != hwEdit, + "Capture is on Edit Control %p, expected to be released\n", GetCapture()); + + // test double WM_LBUTTONDOWN processing + ok(!CheckCapture(), "Unexpected WM_CAPTURECHANGED recieved\n"); + todo_wine ok(SendMessageA(hwEdit, WM_LBUTTONDOWN, 1, 0), + "1/2 WM_LBUTTONDOWN was not processed. LastError=%ld\n", GetLastError()); + ok(!CheckCapture(), "Unexpected WM_CAPTURECHANGED recieved after 1/2 WM_LBUTTONDOWN\n"); + todo_wine ok(SendMessageA(hwEdit, WM_LBUTTONDOWN, 1, 0), + "2/2 WM_LBUTTONDOWN was not processed. LastError=%ld\n", GetLastError()); + ok(CheckCapture(), "Expected WM_CAPTURECHANGED was not recieved after 2/2 WM_LBUTTONDOWN\n"); + ok(GetCapture() == hwEdit, + "Capture is not on Edit Control, instead on %p\n", GetCapture()); + + todo_wine ok(SendMessageA(hwEdit, WM_LBUTTONUP, 0, 0), + "WM_LBUTTONUP was not processed. LastError=%ld\n", GetLastError()); + ok(CheckCapture(), "Expected WM_CAPTURECHANGED was not recieved after WM_LBUTTONUP\n"); + ok(GetFocus() == hwEdit, + "Focus is not on Edit Control, instead on %p\n", GetFocus()); + ok(GetCapture() != hwEdit, + "Capture is on Edit Control %p, expected to be released\n", GetCapture()); + + DestroyWindow(hwEdit); +} + START_TEST(edit) { ULONG_PTR ctx_cookie; @@ -3988,6 +4056,7 @@ START_TEST(edit) test_ime(); test_format_rect(); test_PASSWORDCHAR(); + test_WM_LBUTTONDOWN(); UnregisterWindowClasses(); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10104