Move the system menu test into its own test

Dmitry Timoshkov dmitry at codeweavers.com
Thu Nov 2 05:18:32 CST 2006


Hello,

Changelog:
    Move the system menu test into its own test.

--- cvs/hq/wine/dlls/user/tests/msg.c	Tue Oct 31 12:27:54 2006
+++ wine/dlls/user/tests/msg.c	Thu Nov 02 06:59:50 2006
@@ -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 @@ START_TEST(msg)
     test_quit_message();
     test_TrackMouseEvent();
     test_SetWindowRgn();
+    test_sys_menu();
 
     UnhookWindowsHookEx(hCBT_hook);
     if (pUnhookWinEvent)





More information about the wine-patches mailing list