From 20c200cf0733be8a96b7a10e744ef4b20405c285 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 12 May 2013 11:38:25 +0200 Subject: [PATCH] added test --- .../openlp_core_ui/test_mainwindow.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/interfaces/openlp_core_ui/test_mainwindow.py b/tests/interfaces/openlp_core_ui/test_mainwindow.py index 837919d85..a484133f6 100644 --- a/tests/interfaces/openlp_core_ui/test_mainwindow.py +++ b/tests/interfaces/openlp_core_ui/test_mainwindow.py @@ -25,7 +25,8 @@ class TestMainWindow(TestCase): self.app.args =[] Registry().register(u'application', self.app) # Mock classes and methods used by mainwindow. - with patch(u'openlp.core.ui.mainwindow.ImageManager') as mocked_image_manager, \ + with patch(u'openlp.core.ui.mainwindow.SettingsForm') as mocked_settings_form, \ + patch(u'openlp.core.ui.mainwindow.ImageManager') as mocked_image_manager, \ patch(u'openlp.core.ui.mainwindow.SlideController') as mocked_slide_controller, \ patch(u'openlp.core.ui.mainwindow.OpenLPDockWidget') as mocked_dock_widget, \ patch(u'openlp.core.ui.mainwindow.QtGui.QToolBox') as mocked_q_tool_box_class, \ @@ -42,6 +43,21 @@ class TestMainWindow(TestCase): del self.main_window del self.app + def restore_current_media_manager_item_test(self): + """ + Regression test for bug #1152509. + """ + # GIVEN: Mocked Settings().value method. + with patch(u'openlp.core.ui.mainwindow.Settings.value') as mocked_value: + # save current plugin: True; current media plugin: 2 + mocked_value.side_effect = [True, 2] + + # WHEN: Call the restore method. + Registry().execute(u'bootstrap_post_set_up') + + # THEN: The current widget should have been set. + self.main_window.media_tool_box.setCurrentIndex.assert_called_with(2) + def on_search_shortcut_triggered_test(self): """ Test if the search edit has focus after CTRL+F has been pressed.