Exemplo n.º 1
0
 def setUp(self):
     self.gui = GUI()
     self.parent = Window()
     self.parent._create()
     self.parent.open()
     self.addCleanup(self._destroy_parent)
     self.gui.process_events()
Exemplo n.º 2
0
 def test_add_to_toolbar_no_label(self):
     window = Window()
     window.open()
     action_item = ActionItem(action=self.action)
     toolbar_manager = ToolBarManager(name='Test')
     image_cache = ImageCache(height=32, width=32)
     menu = toolbar_manager.create_tool_bar(window.control)
     action_item.add_to_toolbar(window.control, menu, image_cache, None, False)
     window.close()
Exemplo n.º 3
0
 def test_add_to_menu(self):
     window = Window()
     window.open()
     action_item = ActionItem(action=self.action)
     menu_bar_manager = MenuBarManager()
     menu_manager = MenuManager(name='Test')
     menu_bar = menu_bar_manager.create_menu_bar(window.control)
     menu = menu_manager.create_menu(menu_bar)
     action_item.add_to_menu(window.control, menu, None)
     window.close()
Exemplo n.º 4
0
 def test_add_to_toolbar_controller_false(self):
     window = Window()
     window.open()
     action_item = ActionItem(action=self.action)
     toolbar_manager = ToolBarManager(name="Test")
     image_cache = ImageCache(height=32, width=32)
     menu = toolbar_manager.create_tool_bar(window.control)
     controller = FalseActionController()
     action_item.add_to_toolbar(window.control, menu, image_cache,
                                controller, True)
     window.close()
Exemplo n.º 5
0
 def test_add_to_menu_controller_false(self):
     window = Window()
     window.open()
     action_item = ActionItem(action=self.action)
     menu_bar_manager = MenuBarManager()
     menu_manager = MenuManager(name="Test")
     menu_bar = menu_bar_manager.create_menu_bar(window.control)
     menu = menu_manager.create_menu(menu_bar)
     controller = FalseActionController()
     action_item.add_to_menu(window.control, menu, controller)
     window.close()
Exemplo n.º 6
0
    def test_parent(self):
        # test that lifecycle works with a parent
        parent = Window()
        self.dialog.parent = parent.control
        parent.open()
        tester = ModalDialogTester(self.dialog.open)
        tester.open_and_run(when_opened=lambda x: x.close(accept=True))
        with self.event_loop():
            parent.close()

        self.assertEqual(tester.result, OK)
        self.assertEqual(self.dialog.return_code, OK)
Exemplo n.º 7
0
    def test_create_parent(self):
        # test that creation and destruction works as expected with a parent
        parent = Window()
        self.dialog.parent = parent.control
        with self.event_loop():
            parent._create()
            self.dialog._create()

        with self.event_loop():
            self.dialog.destroy()
        with self.event_loop():
            parent.destroy()
Exemplo n.º 8
0
    def test_add_to_toolbar_widget(self):
        self.action.style = "widget"
        self.action.control_factory = self.control_factory

        window = Window()
        window.open()
        action_item = ActionItem(action=self.action)
        toolbar_manager = ToolBarManager(name='Test')
        image_cache = ImageCache(height=32, width=32)
        menu = toolbar_manager.create_tool_bar(window.control)

        try:
            action_item.add_to_toolbar(window.control, menu, image_cache, None, True)
        finally:
            window.close()
Exemplo n.º 9
0
    def setUp(self):
        self.gui = GUI()

        self.parent = Window()
        self.parent._create()
        self.addCleanup(self._destroy_parent)
Exemplo n.º 10
0
 def _create_parent(self):
     return Window()
Exemplo n.º 11
0
 def setUp(self):
     GuiTestAssistant.setUp(self)
     self.window = Window(size=(500, 500))
     self.window._create()
Exemplo n.º 12
0
 def setUp(self):
     GuiTestAssistant.setUp(self)
     self.window = Window()