def test_action_current_row_changed(self):
        mock_view = MockSettingsView()
        p = SettingsPresenter(None, view=mock_view, general_settings=mock_view.general_settings)

        p.action_section_changed(0)

        # Currently this is not called, because we only have 1 view.
        # When more views are added this test WILL BREAK, and should be adapted
        # to check if the views are being switched correctly
        self.assertEqual(0, mock_view.container.replaceWidget.call_count)
Ejemplo n.º 2
0
    def test_action_current_row_changed(self):
        mock_view = MockSettingsView()
        p = SettingsPresenter(None,
                              view=mock_view,
                              general_settings=mock_view.general_settings)

        p.action_section_changed(0)

        # Currently this is not called, because we only have 1 view.
        # When more views are added this test WILL BREAK, and should be adapted
        # to check if the views are being switched correctly
        self.assertEqual(0, mock_view.container.replaceWidget.call_count)
Ejemplo n.º 3
0
    def test_action_current_row_changed(self):
        mock_view = MockSettingsView()
        presenter = SettingsPresenter(None, view=mock_view,
                                      general_settings=mock_view.general_settings,
                                      categories_settings=mock_view.categories_settings,
                                      plot_settings=mock_view.plot_settings,
                                      fitting_settings=mock_view.fitting_settings)

        mock_view.sections.item = Mock()
        mock_view.sections.item().text = Mock(return_value = presenter.SETTINGS_TABS['categories_settings'])
        presenter.action_section_changed(1)

        self.assertEqual(1, mock_view.container.replaceWidget.call_count)
        self.assertEqual(mock_view.categories_settings.view, presenter.current)