X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6eca840cc922e69cf6e94295edc0bf8ccf367b57..1ec4e9c2b72a01a7ba7da569e0f8d04a81aaba10:/tests/menu/menu.cpp diff --git a/tests/menu/menu.cpp b/tests/menu/menu.cpp index 79b1e3ec49..abc4db0b0d 100644 --- a/tests/menu/menu.cpp +++ b/tests/menu/menu.cpp @@ -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 @@ -464,5 +468,13 @@ void MenuTestCase::Events() const wxCommandEvent& ev = handler.GetEvent(); CPPUNIT_ASSERT_EQUAL( static_cast(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(m_menuWithBar), + src ); #endif // wxUSE_UIACTIONSIMULATOR }