Пример #1
0
    def test_widget_connections_exist(self):
        mock_mfp = MockMultiFileInterpreter()
        view = CodeEditorTabWidget(mock_mfp)
        self.assert_widget_created()

        self.assert_object_connected_once(
            view, view.SHOW_IN_EXPLORER_ACTION_OBJECT_NAME, QAction,
            "triggered")
        self.assert_object_connected_once(view, view.ABORT_BUTTON_OBJECT_NAME)
        self.assert_object_connected_once(view,
                                          view.NEW_EDITOR_PLUS_BTN_OBJECT_NAME)
        self.assert_object_connected_once(view, view.RUN_BUTTON_OBJECT_NAME)

        # options button is not connected because it uses the internal Qt triggers
        # to show the popup menu
        self.assert_object_not_connected(view, view.OPTIONS_BUTTON_OBJECT_NAME)

        view.close()

        QApplication.sendPostedEvents()
        self.assert_widget_not_present(CodeEditorTabWidget.__name__)

        # closing our local mock should leave the QApplication without any widgets
        mock_mfp.close()
        QApplication.sendPostedEvents()
        self.assert_no_toplevel_widgets()
Пример #2
0
    def test_deleted_on_close(self):
        mock_mfp = MockMultiFileInterpreter()
        view = CodeEditorTabWidget(mock_mfp)
        self.assert_widget_created()

        view.close()

        QApplication.sendPostedEvents()
        self.assert_widget_not_present(CodeEditorTabWidget.__name__)

        # closing our local mock should leave the QApplication without any widgets
        mock_mfp.close()
        QApplication.sendPostedEvents()
        self.assert_no_toplevel_widgets()
    def test_deleted_on_close(self):
        mock_mfp = MockMultiFileInterpreter()
        view = CodeEditorTabWidget(mock_mfp)
        self.assert_widget_created()

        view.close()

        QApplication.processEvents()
        self.assert_widget_not_present(CodeEditorTabWidget.__name__)

        # closing our local mock should leave the QApplication without any widgets
        mock_mfp.close()
        QApplication.processEvents()
        self.assert_no_toplevel_widgets()
    def test_widget_connections_exist(self):
        mock_mfp = MockMultiFileInterpreter()
        view = CodeEditorTabWidget(mock_mfp)
        self.assert_widget_created()

        self.assert_object_connected_once(view, view.SHOW_IN_EXPLORER_ACTION_OBJECT_NAME, QAction, "triggered")
        self.assert_object_connected_once(view, view.ABORT_BUTTON_OBJECT_NAME)
        self.assert_object_connected_once(view, view.NEW_EDITOR_PLUS_BTN_OBJECT_NAME)
        self.assert_object_connected_once(view, view.RUN_BUTTON_OBJECT_NAME)

        # options button is not connected because it uses the internal Qt triggers
        # to show the popup menu
        self.assert_object_not_connected(view, view.OPTIONS_BUTTON_OBJECT_NAME)

        view.close()

        QApplication.processEvents()
        self.assert_widget_not_present(CodeEditorTabWidget.__name__)

        # closing our local mock should leave the QApplication without any widgets
        mock_mfp.close()
        QApplication.processEvents()
        self.assert_no_toplevel_widgets()