Module: wine Branch: master Commit: 3d133beccec552291303ac6d052dcc5289bd6316 URL: http://source.winehq.org/git/wine.git/?a=commit;h=3d133beccec552291303ac6d05...
Author: Zebediah Figura z.figura12@gmail.com Date: Mon Mar 27 14:01:39 2017 -0500
user32/tests: Add tests for EnableWindow().
Signed-off-by: Zebediah Figura z.figura12@gmail.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/user32/tests/win.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 915012c..f0ea182 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -6554,6 +6554,58 @@ static void test_ShowWindow(void) ok(!IsWindow(hwnd), "window should not exist\n"); }
+static DWORD CALLBACK enablewindow_thread(LPVOID arg) +{ + HWND hwnd = arg; + EnableWindow(hwnd, FALSE); + return 0; +} + +static void test_EnableWindow(void) +{ + HWND hwnd; + HANDLE hthread; + DWORD tid; + MSG msg; + + hwnd = CreateWindowExA(0, "MainWindowClass", NULL, WS_OVERLAPPEDWINDOW, + 0, 0, 100, 100, 0, 0, 0, NULL); + assert(hwnd); + ok(IsWindowEnabled(hwnd), "window should be enabled\n"); + SetFocus(hwnd); + SetCapture(hwnd); + + EnableWindow(hwnd, FALSE); + check_wnd_state(hwnd, hwnd, 0, 0); + ok(!IsWindowEnabled(hwnd), "window should not be enabled\n"); + + SetFocus(hwnd); + SetCapture(hwnd); + check_wnd_state(hwnd, hwnd, 0, hwnd); + + EnableWindow(hwnd, TRUE); + SetFocus(hwnd); + check_wnd_state(hwnd, hwnd, hwnd, hwnd); + ok(IsWindowEnabled(hwnd), "window should be enabled\n"); + + /* test disabling from thread */ + hthread = CreateThread(NULL, 0, enablewindow_thread, hwnd, 0, &tid); + + while (MsgWaitForMultipleObjects(1, &hthread, FALSE, INFINITE, QS_SENDMESSAGE) != WAIT_OBJECT_0) + { + while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE | PM_QS_SENDMESSAGE)) + DispatchMessageA(&msg); + } + + ok(!IsWindowEnabled(hwnd), "window should not be enabled\n"); + todo_wine + check_active_state(hwnd, hwnd, hwnd); + ok(0 == GetCapture(), "GetCapture() = %p\n", GetCapture()); + + CloseHandle(hthread); + DestroyWindow(hwnd); +} + static DWORD CALLBACK gettext_msg_thread( LPVOID arg ) { HWND hwnd = arg; @@ -9778,6 +9830,7 @@ START_TEST(win) test_SetWindowLong(); test_set_window_style(); test_ShowWindow(); + test_EnableWindow(); test_gettext(); test_GetUpdateRect(); test_Expose();