Ejemplo n.º 1
0
    def test_create_03_error_menu(self):
        root = wx.Menu()
        controller = MenuController(root)

        title = 'Menu title'
        menu_id = 'menu_id'

        controller.createSubMenu(menu_id, title)

        self.assertRaises(KeyError, controller.createSubMenu, menu_id, title)
Ejemplo n.º 2
0
    def test_create_01_menu(self):
        root = wx.Menu()
        controller = MenuController(root)

        title = 'Menu title'
        menu_id = 'menu_id'

        controller.createSubMenu(menu_id, title)
        self.assertIn(menu_id, controller)
        self.assertTrue(isinstance(controller[menu_id], wx.Menu))
Ejemplo n.º 3
0
    def test_create_05_menu(self):
        root = wx.Menu()
        controller = MenuController(root)

        title_01 = 'Menu title_01'
        menu_id_01 = 'menu_id_01'

        title_02 = 'Menu title_02'
        menu_id_02 = 'menu_id_02'

        menu_01 = controller.createSubMenu(menu_id_01, title_01)
        menu_02 = controller.createSubMenu(menu_id_02, title_02, menu_id_01)

        self.assertIn(menu_id_02, controller)
        self.assertEqual(controller[menu_id_01], menu_01)
        self.assertEqual(controller[menu_id_02], menu_02)
Ejemplo n.º 4
0
    def test_remove_04_menu(self):
        root = wx.Menu()
        controller = MenuController(root)

        title_01 = 'Menu title_01'
        menu_id_01 = 'menu_id_01'

        title_02 = 'Menu title_02'
        menu_id_02 = 'menu_id_02'

        controller.createSubMenu(menu_id_01, title_01)
        controller.createSubMenu(menu_id_02, title_02, menu_id_01)

        controller.removeMenu(menu_id_01)

        self.assertNotIn(menu_id_01, controller)
        self.assertNotIn(menu_id_02, controller)
        self.assertEqual(len(controller[ROOT_MENU_ID].GetMenuItems()), 0)
Ejemplo n.º 5
0
    def test_remove_07_menu(self):
        root = wx.Menu()
        controller = MenuController(root)

        title_01 = 'Menu title_01'
        menu_id_01 = 'menu_id_01'

        title_02 = 'Menu title_02'
        menu_id_02 = 'menu_id_02'

        title_03 = 'Menu title_03'
        menu_id_03 = 'menu_id_03'

        controller.createSubMenu(menu_id_01, title_01)
        controller.createSubMenu(menu_id_02, title_02, menu_id_01)
        controller.createSubMenu(menu_id_03, title_03, menu_id_02)

        controller.removeMenu(menu_id_03)
        controller.removeMenu(menu_id_02)
        controller.removeMenu(menu_id_01)