From 612633432ac0acf8d348116454033bf7b1df0cc3 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Thu, 1 Dec 2011 08:08:24 +0000 Subject: [PATCH] add test for bug fixed in r69878 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69879 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- tests/menu/menu.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/menu/menu.cpp b/tests/menu/menu.cpp index 3424af6b50..7c0c3551d8 100644 --- a/tests/menu/menu.cpp +++ b/tests/menu/menu.cpp @@ -85,6 +85,7 @@ private: CPPUNIT_TEST( Count ); CPPUNIT_TEST( Labels ); CPPUNIT_TEST( RadioItems ); + CPPUNIT_TEST( RemoveAdd ); CPPUNIT_TEST_SUITE_END(); void CreateFrame(); @@ -94,6 +95,7 @@ private: void Count(); void Labels(); void RadioItems(); + void RemoveAdd(); wxFrame* m_frame; @@ -359,3 +361,23 @@ void MenuTestCase::RadioItems() menu->Check(MenuTestCase_First + 4, true); CPPUNIT_ASSERT( !menu->IsChecked(MenuTestCase_First + 5) ); } + +void MenuTestCase::RemoveAdd() +{ + wxMenuBar* bar = m_frame->GetMenuBar(); + + wxMenu* menu0 = bar->GetMenu(0); + wxMenu* menu1 = bar->GetMenu(1); + wxMenuItem* item = new wxMenuItem(menu0, MenuTestCase_Foo + 100, "t&ext\tCtrl-E"); + menu0->Insert(0, item); + CPPUNIT_ASSERT( menu0->FindItemByPosition(0) == item ); + menu0->Remove(item); + CPPUNIT_ASSERT( menu0->FindItemByPosition(0) != item ); + menu1->Insert(0, item); + CPPUNIT_ASSERT( menu1->FindItemByPosition(0) == item ); + menu1->Remove(item); + CPPUNIT_ASSERT( menu1->FindItemByPosition(0) != item ); + menu0->Insert(0, item); + CPPUNIT_ASSERT( menu0->FindItemByPosition(0) == item ); + menu0->Delete(item); +}