Vincent Povirk : user32/tests: Add test calling EndMenu from WM_ENTERMENULOOP.

Alexandre Julliard julliard at winehq.org
Fri Apr 25 14:15:24 CDT 2014


Module: wine
Branch: master
Commit: 412222609f69ac72690fe5ae122bcf85ec864eb7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=412222609f69ac72690fe5ae122bcf85ec864eb7

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Wed Apr 16 12:23:01 2014 -0500

user32/tests: Add test calling EndMenu from WM_ENTERMENULOOP.

---

 dlls/user32/tests/msg.c |   37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 684347d..fdc882d 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -1762,6 +1762,22 @@ static const struct message WmTrackPopupMenuEmpty[] = {
     { 0 }
 };
 
+static const struct message WmTrackPopupMenuAbort[] = {
+    { HCBT_CREATEWND, hook },
+    { WM_ENTERMENULOOP, sent|wparam|lparam, TRUE, 0 },
+    { WM_INITMENU, sent|lparam, 0, 0 },
+    { WM_INITMENUPOPUP, sent|lparam, 0, 0 },
+    { 0x0093, sent|optional },
+    { 0x0094, sent|optional },
+    { 0x0094, sent|optional },
+    { WM_CAPTURECHANGED, sent },
+    { HCBT_DESTROYWND, hook },
+    { WM_UNINITMENUPOPUP, sent|lparam, 0, 0 },
+    { WM_MENUSELECT, sent|wparam|lparam, 0xffff0000, 0 },
+    { WM_EXITMENULOOP, sent|wparam|lparam, 1, 0 },
+    { 0 }
+};
+
 static BOOL after_end_dialog, test_def_id, paint_loop_done;
 static int sequence_cnt, sequence_size;
 static struct recvd_message* sequence;
@@ -14342,6 +14358,19 @@ static LRESULT WINAPI cancel_popup_proc(HWND hwnd, UINT message, WPARAM wParam,
     return MsgCheckProc (FALSE, hwnd, message, wParam, lParam);
 }
 
+static LRESULT WINAPI cancel_init_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    if (ignore_message( message )) return 0;
+
+    switch (message) {
+    case WM_ENTERMENULOOP:
+        ok(EndMenu() == TRUE, "EndMenu() failed\n");
+        break;
+    }
+
+    return MsgCheckProc (FALSE, hwnd, message, wParam, lParam);
+}
+
 static void test_TrackPopupMenu(void)
 {
     HWND hwnd;
@@ -14366,6 +14395,14 @@ static void test_TrackPopupMenu(void)
     ok_sequence(WmTrackPopupMenu, "TrackPopupMenu", TRUE);
     ok(ret == 1, "TrackPopupMenu failed with error %i\n", GetLastError());
 
+    SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)cancel_init_proc);
+
+    flush_events();
+    flush_sequence();
+    ret = TrackPopupMenu(hpopupmenu, 0, 100,100, 0, hwnd, NULL);
+    ok_sequence(WmTrackPopupMenuAbort, "WmTrackPopupMenuAbort", TRUE);
+    ok(ret == TRUE, "TrackPopupMenu failed\n");
+
     DestroyMenu(hpopupmenu);
     DestroyWindow(hwnd);
 }




More information about the wine-cvs mailing list