From 2b61353ce285bcb7296c817976f5613fafbeee22 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Sun, 7 Mar 2010 07:32:14 +0000 Subject: [PATCH] [USER32_WINETEST] sync user32_winetest to wine 1.1.40 svn path=/trunk/; revision=45976 --- rostests/winetests/user32/dialog.c | 72 +++++++++++++++++++++++++++++- rostests/winetests/user32/edit.c | 52 +++++++++++++++++++++ rostests/winetests/user32/msg.c | 42 +++++++++++++++++ rostests/winetests/user32/scroll.c | 4 +- rostests/winetests/user32/win.c | 8 ++++ 5 files changed, 174 insertions(+), 4 deletions(-) diff --git a/rostests/winetests/user32/dialog.c b/rostests/winetests/user32/dialog.c index 204d854364b..1b36c5368c9 100755 --- a/rostests/winetests/user32/dialog.c +++ b/rostests/winetests/user32/dialog.c @@ -852,8 +852,8 @@ static void InitialFocusTest (void) ok ((g_hwndInitialFocusT1 == g_hwndButton2), "Error in initial focus when WM_INITDIALOG returned TRUE: " "Expected the second button (%p), got %s (%p).\n", - g_hwndButton2, GetHwndString(g_hwndInitialFocusT2), - g_hwndInitialFocusT2); + g_hwndButton2, GetHwndString(g_hwndInitialFocusT1), + g_hwndInitialFocusT1); ok ((g_hwndInitialFocusT2 == g_hwndButton2), "Error after first SetFocus() when WM_INITDIALOG returned TRUE: " @@ -926,6 +926,21 @@ static INT_PTR CALLBACK DestroyOnCloseDlgWinProc (HWND hDlg, UINT uiMsg, return FALSE; } +static INT_PTR CALLBACK TestInitDialogHandleProc (HWND hDlg, UINT uiMsg, + WPARAM wParam, LPARAM lParam) +{ + if (uiMsg == WM_INITDIALOG) + { + HWND expected = GetNextDlgTabItem(hDlg, NULL, FALSE); + ok(expected == (HWND)wParam, + "Expected wParam to be the handle to the first tabstop control (%p), got %p\n", + expected, (HWND)wParam); + + EndDialog(hDlg, LOWORD(SendMessage(hDlg, DM_GETDEFID, 0, 0))); + return TRUE; + } + return FALSE; +} static INT_PTR CALLBACK TestDefButtonDlgProc (HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam) @@ -978,6 +993,9 @@ static void test_DialogBoxParamA(void) broken(GetLastError() == 0xdeadbeef), "got %d, expected ERROR_INVALID_WINDOW_HANDLE\n", GetLastError()); + ret = DialogBoxParamA(GetModuleHandle(NULL), "TEST_EMPTY_DIALOG", 0, TestInitDialogHandleProc, 0); + ok(ret == IDOK, "Expected IDOK\n"); + ret = DialogBoxParamA(GetModuleHandle(NULL), "TEST_EMPTY_DIALOG", 0, TestDefButtonDlgProc, 0); ok(ret == IDOK, "Expected IDOK\n"); } @@ -1139,6 +1157,55 @@ static void test_SaveRestoreFocus(void) DestroyWindow(hDlg); } +static INT_PTR CALLBACK timer_message_dlg_proc(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + static int count; + BOOL visible; + + switch (msg) + { + case WM_INITDIALOG: + visible = GetWindowLong(wnd, GWL_STYLE) & WS_VISIBLE; + ok(!visible, "Dialog should not be visible.\n"); + SetTimer(wnd, 1, 100, NULL); + Sleep(200); + return FALSE; + + case WM_COMMAND: + if (LOWORD(wparam) != IDCANCEL) return FALSE; + EndDialog(wnd, LOWORD(wparam)); + return TRUE; + + case WM_TIMER: + if (wparam != 1) return FALSE; + visible = GetWindowLong(wnd, GWL_STYLE) & WS_VISIBLE; + if (!count++) + { + ok(!visible, "Dialog should not be visible.\n"); + PostMessage(wnd, WM_USER, 0, 0); + } + else + { + ok(visible, "Dialog should be visible.\n"); + PostMessage(wnd, WM_COMMAND, IDCANCEL, 0); + } + return TRUE; + + case WM_USER: + visible = GetWindowLong(wnd, GWL_STYLE) & WS_VISIBLE; + ok(visible, "Dialog should be visible.\n"); + return TRUE; + + default: + return FALSE; + } +} + +static void test_timer_message(void) +{ + DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, timer_message_dlg_proc); +} + START_TEST(dialog) { g_hinst = GetModuleHandleA (0); @@ -1154,4 +1221,5 @@ START_TEST(dialog) test_DisabledDialogTest(); test_MessageBoxFontTest(); test_SaveRestoreFocus(); + test_timer_message(); } diff --git a/rostests/winetests/user32/edit.c b/rostests/winetests/user32/edit.c index 7ecee13b80a..ee181f21f6a 100755 --- a/rostests/winetests/user32/edit.c +++ b/rostests/winetests/user32/edit.c @@ -1316,6 +1316,57 @@ static void test_edit_control_limittext(void) DestroyWindow(hwEdit); } +/* Test EM_SCROLL */ +static void test_edit_control_scroll(void) +{ + static const char *single_line_str = "a"; + static const char *multiline_str = "Test\r\nText"; + HWND hwEdit; + LONG ret; + + /* Check the return value when EM_SCROLL doesn't scroll + * anything. Should not return true unless any lines were actually + * scrolled. */ + hwEdit = CreateWindow( + "EDIT", + single_line_str, + WS_VSCROLL | ES_MULTILINE, + 1, 1, 100, 100, + NULL, NULL, hinst, NULL); + + assert(hwEdit); + + ret = SendMessage(hwEdit, EM_SCROLL, SB_PAGEDOWN, 0); + ok(!ret, "Returned %x, expected 0.\n", ret); + + ret = SendMessage(hwEdit, EM_SCROLL, SB_PAGEUP, 0); + ok(!ret, "Returned %x, expected 0.\n", ret); + + ret = SendMessage(hwEdit, EM_SCROLL, SB_LINEUP, 0); + ok(!ret, "Returned %x, expected 0.\n", ret); + + ret = SendMessage(hwEdit, EM_SCROLL, SB_LINEDOWN, 0); + ok(!ret, "Returned %x, expected 0.\n", ret); + + DestroyWindow (hwEdit); + + /* SB_PAGEDOWN while at the beginning of a buffer with few lines + should not cause EM_SCROLL to return a negative value of + scrolled lines that would put us "before" the beginning. */ + hwEdit = CreateWindow( + "EDIT", + multiline_str, + WS_VSCROLL | ES_MULTILINE, + 0, 0, 100, 100, + NULL, NULL, hinst, NULL); + assert(hwEdit); + + ret = SendMessage(hwEdit, EM_SCROLL, SB_PAGEDOWN, 0); + ok(!ret, "Returned %x, expected 0.\n", ret); + + DestroyWindow (hwEdit); +} + static void test_margins(void) { HWND hwEdit; @@ -2319,6 +2370,7 @@ START_TEST(edit) test_edit_control_5(); test_edit_control_6(); test_edit_control_limittext(); + test_edit_control_scroll(); test_margins(); test_margins_font_change(); test_text_position(); diff --git a/rostests/winetests/user32/msg.c b/rostests/winetests/user32/msg.c index 492de627f11..714e57f4bcb 100755 --- a/rostests/winetests/user32/msg.c +++ b/rostests/winetests/user32/msg.c @@ -12080,6 +12080,13 @@ static const struct { 0, 0, FALSE }, { 0, WAIT_TIMEOUT, FALSE }, { 0, 0, FALSE }, + { 0, 0, FALSE }, +/* 15 */ { 0, 0, FALSE }, + { WAIT_TIMEOUT, 0, FALSE }, + { WAIT_TIMEOUT, 0, FALSE }, + { WAIT_TIMEOUT, 0, FALSE }, + { WAIT_TIMEOUT, 0, FALSE }, +/* 20 */ { WAIT_TIMEOUT, 0, FALSE }, }; static DWORD CALLBACK do_wait_idle_child_thread( void *arg ) @@ -12205,6 +12212,41 @@ static void do_wait_idle_child( int arg ) WaitForSingleObject( thread, 10000 ); CloseHandle( thread ); break; + case 14: + SetEvent( start_event ); + Sleep( 200 ); + PeekMessage( &msg, HWND_TOPMOST, 0, 0, PM_NOREMOVE ); + break; + case 15: + SetEvent( start_event ); + Sleep( 200 ); + PeekMessage( &msg, HWND_BROADCAST, 0, 0, PM_NOREMOVE ); + break; + case 16: + SetEvent( start_event ); + Sleep( 200 ); + PeekMessage( &msg, HWND_BOTTOM, 0, 0, PM_NOREMOVE ); + break; + case 17: + SetEvent( start_event ); + Sleep( 200 ); + PeekMessage( &msg, (HWND)0xdeadbeef, 0, 0, PM_NOREMOVE ); + break; + case 18: + SetEvent( start_event ); + Sleep( 200 ); + PeekMessage( &msg, HWND_NOTOPMOST, 0, 0, PM_NOREMOVE ); + break; + case 19: + SetEvent( start_event ); + Sleep( 200 ); + PeekMessage( &msg, HWND_MESSAGE, 0, 0, PM_NOREMOVE ); + break; + case 20: + SetEvent( start_event ); + Sleep( 200 ); + PeekMessage( &msg, GetDesktopWindow(), 0, 0, PM_NOREMOVE ); + break; } WaitForSingleObject( end_event, 2000 ); CloseHandle( start_event ); diff --git a/rostests/winetests/user32/scroll.c b/rostests/winetests/user32/scroll.c index 03725b92f48..0695639a458 100644 --- a/rostests/winetests/user32/scroll.c +++ b/rostests/winetests/user32/scroll.c @@ -411,8 +411,8 @@ START_TEST ( scroll ) WS_OVERLAPPEDWINDOW|WS_VSCROLL|WS_HSCROLL, CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0 ); - if ( !ok( hMainWnd != NULL, "Failed to create parent window. Tests aborted.\n" ) ) - return; + ok(hMainWnd != NULL, "Failed to create parent window. Tests aborted.\n"); + if (!hMainWnd) return; assert( hScroll ); diff --git a/rostests/winetests/user32/win.c b/rostests/winetests/user32/win.c index 66387573c8d..ddfddb1e9fe 100644 --- a/rostests/winetests/user32/win.c +++ b/rostests/winetests/user32/win.c @@ -3424,6 +3424,14 @@ static void test_window_styles(void) check_window_style(WS_CHILD, WS_EX_DLGMODALFRAME|WS_EX_STATICEDGE, WS_CHILD, WS_EX_STATICEDGE|WS_EX_WINDOWEDGE|WS_EX_DLGMODALFRAME); check_window_style(WS_CAPTION, WS_EX_STATICEDGE, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_STATICEDGE|WS_EX_WINDOWEDGE); check_window_style(0, WS_EX_APPWINDOW, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_APPWINDOW|WS_EX_WINDOWEDGE); + + if (pGetLayeredWindowAttributes) + { + check_window_style(0, WS_EX_LAYERED, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_LAYERED|WS_EX_WINDOWEDGE); + check_window_style(0, WS_EX_LAYERED|WS_EX_TRANSPARENT, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_LAYERED|WS_EX_TRANSPARENT|WS_EX_WINDOWEDGE); + check_window_style(0, WS_EX_LAYERED|WS_EX_TRANSPARENT|WS_EX_TOOLWINDOW, WS_CLIPSIBLINGS|WS_CAPTION, + WS_EX_LAYERED|WS_EX_TRANSPARENT|WS_EX_TOOLWINDOW|WS_EX_WINDOWEDGE); + } } static void test_scrollwindow( HWND hwnd) -- 2.17.1