From cec5cdfa8d7b8c40601212e4967576e74419f844 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Sun, 25 Oct 2009 20:32:13 +0000 Subject: [PATCH] -sync user32_winetest with wine 1.1.32 svn path=/trunk/; revision=43752 --- rostests/winetests/user32/class.c | 32 +++++++++++++++++ rostests/winetests/user32/dde.c | 2 +- rostests/winetests/user32/input.c | 7 +++- rostests/winetests/user32/listbox.c | 1 + rostests/winetests/user32/menu.c | 7 ++++ rostests/winetests/user32/msg.c | 38 ++++++++++++++++++++ rostests/winetests/user32/win.c | 55 +++++++++++++++++++++++++++++ 7 files changed, 140 insertions(+), 2 deletions(-) diff --git a/rostests/winetests/user32/class.c b/rostests/winetests/user32/class.c index 0e7b0e4bed7..7b42ce36851 100755 --- a/rostests/winetests/user32/class.c +++ b/rostests/winetests/user32/class.c @@ -831,10 +831,42 @@ static void CreateDialogParamTest(HINSTANCE hInstance) } } +static const struct +{ + const char name[9]; + int value; + int badvalue; +} extra_values[] = +{ + {"#32770",30,30}, /* Dialog */ +#ifdef _WIN64 + {"Edit",8,8}, +#else + {"Edit",6,8}, /* Windows XP 64-bit returns 8 also to 32-bit applications */ +#endif +}; + +static void test_extra_values(void) +{ + int i; + for(i=0; i< sizeof(extra_values)/sizeof(extra_values[0]); i++) + { + WNDCLASSEX wcx; + BOOL ret = GetClassInfoEx(NULL,extra_values[i].name,&wcx); + + ok( ret, "GetClassInfo (0) failed for global class %s\n", extra_values[i].name); + if (!ret) continue; + ok(extra_values[i].value == wcx.cbWndExtra || broken(extra_values[i].badvalue == wcx.cbWndExtra), + "expected %d, got %d\n", extra_values[i].value, wcx.cbWndExtra); + } +} + START_TEST(class) { HANDLE hInstance = GetModuleHandleA( NULL ); + test_extra_values(); + if (!GetModuleHandleW(0)) { trace("Class test is incompatible with Win9x implementation, skipping\n"); diff --git a/rostests/winetests/user32/dde.c b/rostests/winetests/user32/dde.c index 9e1da709c37..202bb41af9d 100755 --- a/rostests/winetests/user32/dde.c +++ b/rostests/winetests/user32/dde.c @@ -211,7 +211,7 @@ static LRESULT WINAPI dde_server_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPA executed = TRUE; - lparam = ReuseDDElParam(lparam, WM_DDE_EXECUTE, WM_DDE_ACK, DDE_FACK, HIWORD(lparam)); + lparam = ReuseDDElParam(lparam, WM_DDE_EXECUTE, WM_DDE_ACK, DDE_FACK, lparam); PostMessageA(client, WM_DDE_ACK, (WPARAM)hwnd, lparam); break; diff --git a/rostests/winetests/user32/input.c b/rostests/winetests/user32/input.c index aaeefb21768..6c1a0fb2721 100755 --- a/rostests/winetests/user32/input.c +++ b/rostests/winetests/user32/input.c @@ -904,7 +904,12 @@ static void test_Input_blackbox(void) SetWindowPos( window, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE ); SetForegroundWindow( window ); - hook = SetWindowsHookExA(WH_KEYBOARD_LL, hook_proc, GetModuleHandleA( NULL ), 0); + if (!(hook = SetWindowsHookExA(WH_KEYBOARD_LL, hook_proc, GetModuleHandleA( NULL ), 0))) + { + DestroyWindow(window); + win_skip("WH_KEYBOARD_LL is not supported\n"); + return; + } /* must process all initial messages, otherwise X11DRV_KeymapNotify unsets * key state set by SendInput(). */ diff --git a/rostests/winetests/user32/listbox.c b/rostests/winetests/user32/listbox.c index 0aef698dbf5..942c7800f67 100644 --- a/rostests/winetests/user32/listbox.c +++ b/rostests/winetests/user32/listbox.c @@ -303,6 +303,7 @@ static void test_ownerdraw(void) hLB = create_listbox(LBS_OWNERDRAWFIXED | WS_CHILD | WS_VISIBLE, parent); assert(hLB); + SetForegroundWindow(hLB); UpdateWindow(hLB); /* make height short enough */ diff --git a/rostests/winetests/user32/menu.c b/rostests/winetests/user32/menu.c index a3881039bd6..56535ae40dd 100755 --- a/rostests/winetests/user32/menu.c +++ b/rostests/winetests/user32/menu.c @@ -150,10 +150,12 @@ static int gflag_initmenupopup, static LRESULT WINAPI menu_ownerdraw_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { + static HMENU hmenupopup; switch (msg) { case WM_INITMENUPOPUP: gflag_initmenupopup++; + hmenupopup = (HMENU) wparam; break; case WM_ENTERMENULOOP: gflag_entermenuloop++; @@ -229,6 +231,11 @@ static LRESULT WINAPI menu_ownerdraw_wnd_proc(HWND hwnd, UINT msg, { ok( lparam || broken(!lparam), /* win9x, nt4 */ "Menu window handle is NULL!\n"); + if( lparam) { + HMENU hmenu = (HMENU)SendMessageA( (HWND)lparam, MN_GETHMENU, 0, 0); + ok( hmenupopup == hmenu, "MN_GETHMENU returns %p expected %p\n", + hmenu, hmenupopup); + } PostMessage(hwnd, WM_CANCELMODE, 0, 0); return TRUE; } diff --git a/rostests/winetests/user32/msg.c b/rostests/winetests/user32/msg.c index 761f3aa8ddc..bfc81dcf5e9 100755 --- a/rostests/winetests/user32/msg.c +++ b/rostests/winetests/user32/msg.c @@ -6870,6 +6870,36 @@ static const struct message WmVkAppsSeq[] = { { WM_CONTEXTMENU, sent|lparam, /*hwnd*/0, (LPARAM)-1 }, { 0 } }; +static const struct message WmVkF10Seq[] = { + { HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_F10, 1 }, /* XP */ + { WM_SYSKEYDOWN, wparam|lparam, VK_F10, 1 }, + { WM_SYSKEYDOWN, sent|wparam|lparam, VK_F10, 0x00000001 }, + { HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_F10, 0xc0000001 }, /* XP */ + { WM_SYSKEYUP, wparam|lparam, VK_F10, 0xc0000001 }, + { WM_SYSKEYUP, sent|wparam|lparam, VK_F10, 0xc0000001 }, + { WM_SYSCOMMAND, sent|defwinproc|wparam, SC_KEYMENU }, + { HCBT_SYSCOMMAND, hook }, + { WM_ENTERMENULOOP, sent|defwinproc|wparam|lparam, 0, 0 }, + { EVENT_SYSTEM_CAPTURESTART, winevent_hook|wparam|lparam, 0, 0 }, + { WM_INITMENU, sent|defwinproc }, + { EVENT_SYSTEM_MENUSTART, winevent_hook|wparam|lparam, OBJID_SYSMENU, 0 }, + { WM_MENUSELECT, sent|defwinproc|wparam, MAKEWPARAM(0,MF_SYSMENU|MF_POPUP|MF_HILITE) }, + { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_SYSMENU, 1 }, + + { HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_F10, 0x10000001 }, /* XP */ + + { HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_F10, 1 }, /* XP */ + { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_SYSMENU, 0 }, + { EVENT_SYSTEM_CAPTUREEND, winevent_hook|wparam|lparam, 0, 0, }, + { WM_CAPTURECHANGED, sent|defwinproc }, + { WM_MENUSELECT, sent|defwinproc|wparam|optional, MAKEWPARAM(0,0xffff) }, + { EVENT_SYSTEM_MENUEND, winevent_hook|wparam|lparam, OBJID_SYSMENU, 0 }, + { WM_EXITMENULOOP, sent|defwinproc }, + { HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_F10, 0xc0000001 }, /* XP */ + { WM_SYSKEYUP, wparam|lparam, VK_F10, 0xc0000001 }, + { WM_SYSKEYUP, sent|wparam|lparam, VK_F10, 0xc0000001 }, + { 0 } +}; static void pump_msg_loop(HWND hwnd, HACCEL hAccel) { @@ -7082,6 +7112,14 @@ static void test_accelerators(void) pump_msg_loop(hwnd, 0); ok_sequence(WmVkAppsSeq, "VK_APPS press/release", FALSE); + trace("testing VK_F10 press/release\n"); + keybd_event(VK_F10, 0, 0, 0); + keybd_event(VK_F10, 0, KEYEVENTF_KEYUP, 0); + keybd_event(VK_F10, 0, 0, 0); + keybd_event(VK_F10, 0, KEYEVENTF_KEYUP, 0); + pump_msg_loop(hwnd, 0); + ok_sequence(WmVkF10Seq, "VK_F10 press/release", TRUE); + trace("testing Shift+MouseButton press/release\n"); /* first, move mouse pointer inside of the window client area */ GetClientRect(hwnd, &rc); diff --git a/rostests/winetests/user32/win.c b/rostests/winetests/user32/win.c index 63f25bcc99e..0bd6fbf069f 100644 --- a/rostests/winetests/user32/win.c +++ b/rostests/winetests/user32/win.c @@ -569,6 +569,60 @@ static void test_parent_owner(void) DestroyWindow( owner ); } +static BOOL CALLBACK enum_proc( HWND hwnd, LPARAM lParam) +{ + (*(LPINT)lParam)++; + if (*(LPINT)lParam > 2) return FALSE; + return TRUE; +} +static DWORD CALLBACK enum_thread( void *arg ) +{ + INT count; + HWND hwnd[3]; + BOOL ret; + MSG msg; + + PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE ); /* make sure we have a message queue */ + + count = 0; + ret = EnumThreadWindows( GetCurrentThreadId(), enum_proc, (LPARAM)&count ); + ok( ret, "EnumThreadWindows should have returned TRUE\n" ); + ok( count == 0, "count should be 0 got %d\n", count ); + + hwnd[0] = CreateWindowExA(0, "ToolWindowClass", "Tool window 1", WS_POPUP, + 0, 0, 100, 100, 0, 0, 0, NULL ); + count = 0; + ret = EnumThreadWindows( GetCurrentThreadId(), enum_proc, (LPARAM)&count ); + ok( ret, "EnumThreadWindows should have returned TRUE\n" ); + if (count != 2) /* Vista gives us two windows for the price of one */ + { + ok( count == 1, "count should be 1 got %d\n", count ); + hwnd[2] = CreateWindowExA(0, "ToolWindowClass", "Tool window 2", WS_POPUP, + 0, 0, 100, 100, 0, 0, 0, NULL ); + } + else hwnd[2] = 0; + + hwnd[1] = CreateWindowExA(0, "ToolWindowClass", "Tool window 3", WS_POPUP, + 0, 0, 100, 100, 0, 0, 0, NULL ); + count = 0; + ret = EnumThreadWindows( GetCurrentThreadId(), enum_proc, (LPARAM)&count ); + ok( !ret, "EnumThreadWindows should have returned FALSE\n" ); + ok( count == 3, "count should be 3 got %d\n", count ); + + if (hwnd[2]) DestroyWindow(hwnd[2]); + DestroyWindow(hwnd[1]); + DestroyWindow(hwnd[0]); + return 0; +} + +/* test EnumThreadWindows in a separate thread */ +static void test_enum_thread_windows(void) +{ + DWORD id; + HANDLE handle = CreateThread( NULL, 0, enum_thread, 0, 0, &id ); + ok( !WaitForSingleObject( handle, 10000 ), "wait failed\n" ); + CloseHandle( handle ); +} static LRESULT WINAPI main_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { @@ -5762,6 +5816,7 @@ START_TEST(win) test_CreateWindow(); test_parent_owner(); test_SetParent(); + test_enum_thread_windows(); test_mdi(); test_icons(); -- 2.17.1