CPPUNIT_TEST_SUITE( MenuTestCase );
CPPUNIT_TEST( FindInMenubar );
CPPUNIT_TEST( FindInMenu );
+ CPPUNIT_TEST( EnableTop );
CPPUNIT_TEST( Count );
CPPUNIT_TEST( Labels );
CPPUNIT_TEST( RadioItems );
+ CPPUNIT_TEST( RemoveAdd );
CPPUNIT_TEST_SUITE_END();
void CreateFrame();
void FindInMenubar();
void FindInMenu();
+ void EnableTop();
void Count();
void Labels();
void RadioItems();
+ void RemoveAdd();
wxFrame* m_frame;
}
}
+void MenuTestCase::EnableTop()
+{
+ wxMenuBar* const bar = m_frame->GetMenuBar();
+ CPPUNIT_ASSERT( bar->IsEnabledTop(0) );
+ bar->EnableTop( 0, false );
+ CPPUNIT_ASSERT( !bar->IsEnabledTop(0) );
+ bar->EnableTop( 0, true );
+ CPPUNIT_ASSERT( bar->IsEnabledTop(0) );
+}
+
void MenuTestCase::Count()
{
wxMenuBar* bar = m_frame->GetMenuBar();
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);
+}