Module: wine Branch: master Commit: 1ebf1471c0e2036f818d7606bc25296accad2c86 URL: http://source.winehq.org/git/wine.git/?a=commit;h=1ebf1471c0e2036f818d7606bc... Author: Dmitry Timoshkov <dmitry(a)codeweavers.com> Date: Thu Nov 2 19:18:32 2006 +0800 user32/tests: Move the system menu test into its own test. --- dlls/user/tests/msg.c | 22 ++++++++++++++++++---- 1 files changed, 18 insertions(+), 4 deletions(-) diff --git a/dlls/user/tests/msg.c b/dlls/user/tests/msg.c index 6149170..175c5bb 100644 --- a/dlls/user/tests/msg.c +++ b/dlls/user/tests/msg.c @@ -3494,11 +3494,18 @@ static void test_showwindow(void) flush_sequence(); } -static void test_sys_menu(HWND hwnd) +static void test_sys_menu(void) { + HWND hwnd; HMENU hmenu; UINT state; + hwnd = CreateWindowExA(0, "TestWindowClass", NULL, WS_OVERLAPPEDWINDOW, + 100, 100, 200, 200, 0, 0, 0, NULL); + ok (hwnd != 0, "Failed to create overlapped window\n"); + + flush_sequence(); + /* test existing window without CS_NOCLOSE style */ hmenu = GetSystemMenu(hwnd, FALSE); ok(hmenu != 0, "GetSystemMenu error %d\n", GetLastError()); @@ -3521,6 +3528,15 @@ static void test_sys_menu(HWND hwnd) ok(state != 0xffffffff, "wrong SC_CLOSE state %x\n", state); ok(!(state & (MF_DISABLED | MF_GRAYED)), "wrong SC_CLOSE state %x\n", state); + /* test whether removing WS_SYSMENU destroys a system menu */ + SetWindowLongW(hwnd, GWL_STYLE, WS_POPUP); + SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_FRAMECHANGED); + flush_sequence(); + hmenu = GetSystemMenu(hwnd, FALSE); + ok(hmenu != 0, "GetSystemMenu error %d\n", GetLastError()); + + DestroyWindow(hwnd); + /* test new window with CS_NOCLOSE style */ hwnd = CreateWindowExA(0, "NoCloseWindowClass", NULL, WS_OVERLAPPEDWINDOW, 100, 100, 200, 200, 0, 0, 0, NULL); @@ -3610,9 +3626,6 @@ static void test_messages(void) SetWindowPos( hwnd, 0, 0, 0, 200, 200, SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE ); ok_sequence(WmSWP_ResizePopupSeq, "SetWindowPos:ResizePopup", FALSE ); - test_sys_menu(hwnd); - - flush_sequence(); DestroyWindow(hwnd); ok_sequence(WmDestroyOverlappedSeq, "DestroyWindow:overlapped", FALSE); @@ -8128,6 +8141,7 @@ #endif test_quit_message(); test_TrackMouseEvent(); test_SetWindowRgn(); + test_sys_menu(); UnhookWindowsHookEx(hCBT_hook); if (pUnhookWinEvent)