Test whether we can destroy a menu assigned to a window

Dmitry Timoshkov dmitry at baikal.ru
Tue Jun 1 07:44:05 CDT 2004


Hello,

I was debugging an MDI related problem and at some point had a wild
guess why frame menu didn't get changed. My guess was wrong, but
here is a test I wrote for that purpose.

This test passes under Wine.

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    Test whether we can destroy a menu assigned to a window.

--- cvs/hq/wine/dlls/user/tests/win.c	Tue May 25 01:46:30 2004
+++ wine/dlls/user/tests/win.c	Tue Jun 01 07:13:29 2004
@@ -1472,6 +1472,19 @@ static void test_SetMenu(HWND parent)
     hMenu = CreateMenu();
     assert(hMenu);
 
+    ok(SetMenu(parent, hMenu), "SetMenu on a top level window should not fail\n");
+    ret = GetMenu(parent);
+    ok(ret == (HMENU)hMenu, "unexpected menu id %p\n", ret);
+    /* test whether we can destroy a menu assigned to a window */
+    ok(DestroyMenu(hMenu), "DestroyMenu error %ld\n", GetLastError());
+    ok(!IsMenu(hMenu), "menu handle should be not valid after DestroyMenu\n");
+    ret = GetMenu(parent);
+    ok(ret == (HMENU)hMenu, "unexpected menu id %p\n", ret);
+    ok(SetMenu(parent, 0), "SetMenu(0) on a top level window should not fail\n");
+
+    hMenu = CreateMenu();
+    assert(hMenu);
+
     /* parent */
     ret = GetMenu(parent);
     ok(ret == 0, "unexpected menu id %p\n", ret);






More information about the wine-patches mailing list