add test for bug fixed in r69878

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69879 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett 2011-12-01 08:08:24 +00:00
parent 0f29501b66
commit 612633432a

View File

@ -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);
}