]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/menu/menu.cpp
Disable more wxAny tests under OS X to try to find the buildbot crash.
[wxWidgets.git] / tests / menu / menu.cpp
index 79b1e3ec498304eb85149776fbd3da5201480f80..08667ef704c0f686f216b5793ca3230e7b449be3 100644 (file)
@@ -116,6 +116,9 @@ private:
 
     wxArrayString m_menuLabels;
 
+    // The menu containing the item with MenuTestCase_Bar id.
+    wxMenu* m_menuWithBar;
+
     DECLARE_NO_COPY_CLASS(MenuTestCase)
 };
 
@@ -155,6 +158,7 @@ void MenuTestCase::CreateFrame()
 
     PopulateMenu(helpMenu, "Helpmenu item ", itemcount);
     helpMenu->Append(MenuTestCase_Bar, "Bar\tF1");
+    m_menuWithBar = helpMenu;
     helpMenu->AppendSubMenu(subMenu, "Sub&menu", "Test a submenu");
 
     // +2 for "Foo" and "Bar", +2 for the 2 submenus
@@ -407,7 +411,7 @@ void MenuTestCase::Events()
         MenuEventHandler(wxWindow* win)
             : m_win(win)
         {
-            m_win->Connect(wxEVT_COMMAND_MENU_SELECTED,
+            m_win->Connect(wxEVT_MENU,
                            wxCommandEventHandler(MenuEventHandler::OnMenu),
                            NULL,
                            this);
@@ -418,7 +422,7 @@ void MenuTestCase::Events()
 
         virtual ~MenuEventHandler()
         {
-            m_win->Disconnect(wxEVT_COMMAND_MENU_SELECTED,
+            m_win->Disconnect(wxEVT_MENU,
                               wxCommandEventHandler(MenuEventHandler::OnMenu),
                               NULL,
                               this);
@@ -464,5 +468,13 @@ void MenuTestCase::Events()
 
     const wxCommandEvent& ev = handler.GetEvent();
     CPPUNIT_ASSERT_EQUAL( static_cast<int>(MenuTestCase_Bar), ev.GetId() );
+
+    wxObject* const src = ev.GetEventObject();
+    CPPUNIT_ASSERT( src );
+
+    CPPUNIT_ASSERT_EQUAL( "wxMenu",
+                          wxString(src->GetClassInfo()->GetClassName()) );
+    CPPUNIT_ASSERT_EQUAL( static_cast<wxObject*>(m_menuWithBar),
+                          src );
 #endif // wxUSE_UIACTIONSIMULATOR
 }