← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol/openlp/random-regression-bugs into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol/openlp/random-regression-bugs into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~googol/openlp/random-regression-bugs/+merge/156269

Hello,

- fixed auto preview of next service item
- added test

http://ci.openlp.org/view/Specific%20Branch/job/OpenLP-Pull_and_Run_Interface_Tests/20/console
http://ci.openlp.org/view/Specific%20Branch/job/OpenLP-Pull_and_Run_Functional_Tests/74/console
-- 
https://code.launchpad.net/~googol/openlp/random-regression-bugs/+merge/156269
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/random-regression-bugs into lp:openlp.
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2013-03-29 12:53:07 +0000
+++ openlp/core/ui/servicemanager.py	2013-03-30 15:50:42 +0000
@@ -1375,7 +1375,7 @@
                     self.preview_controller.addServiceManagerItem(self.service_items[item][u'service_item'], 0)
                     next_item = self.service_manager_list.topLevelItem(item)
                     self.service_manager_list.setCurrentItem(next_item)
-                    self.live_controller.previewListWidget.setFocus()
+                    self.live_controller.preview_list_widget.setFocus()
         else:
             critical_error_message_box(translate('OpenLP.ServiceManager', 'Missing Display Handler'),
                 translate('OpenLP.ServiceManager',

=== removed file 'tests/interfaces/openlp_plugins/__init__.pyc'
Binary files tests/interfaces/openlp_plugins/__init__.pyc	2013-03-29 06:25:01 +0000 and tests/interfaces/openlp_plugins/__init__.pyc	1970-01-01 00:00:00 +0000 differ
=== modified file 'tests/interfaces/openlp_plugins/custom/forms/test_customform.py'
--- tests/interfaces/openlp_plugins/custom/forms/test_customform.py	2013-03-29 06:25:01 +0000
+++ tests/interfaces/openlp_plugins/custom/forms/test_customform.py	2013-03-30 15:50:42 +0000
@@ -1,5 +1,5 @@
 """
-Module to test the custom edit form.
+Module to test the EditCustomForm.
 """
 from unittest import TestCase
 from mock import MagicMock, patch
@@ -12,7 +12,7 @@
 from openlp.plugins.custom.forms.editcustomform import EditCustomForm
 
 
-class TestCustomFrom(TestCase):
+class TestEditCustomForm(TestCase):
     """
     Test the EditCustomForm.
     """

=== added file 'tests/interfaces/openlp_plugins/custom/forms/test_customslideform.py'
--- tests/interfaces/openlp_plugins/custom/forms/test_customslideform.py	1970-01-01 00:00:00 +0000
+++ tests/interfaces/openlp_plugins/custom/forms/test_customslideform.py	2013-03-30 15:50:42 +0000
@@ -0,0 +1,67 @@
+"""
+Module to test the EditCustomSlideForm.
+"""
+from unittest import TestCase
+from mock import MagicMock, patch
+
+from PyQt4 import QtGui
+
+from openlp.core.lib import Registry
+from openlp.plugins.custom.forms.editcustomslideform import EditCustomSlideForm
+
+
+class TestEditCustomSlideForm(TestCase):
+    """
+    Test the EditCustomSlideForm.
+    """
+    def setUp(self):
+        """
+        Create the UI
+        """
+        Registry.create()
+        self.app = QtGui.QApplication([])
+        self.main_window = QtGui.QMainWindow()
+        Registry().register(u'main_window', self.main_window)
+        self.form = EditCustomSlideForm()
+
+    def tearDown(self):
+        """
+        Delete all the C++ objects at the end so that we don't have a segfault
+        """
+        del self.form
+        del self.main_window
+        del self.app
+
+    def basic_test(self):
+        """
+        Test if the dialog is correctly set up.
+        """
+        # GIVEN: A mocked QDialog.exec_() method
+        with patch(u'PyQt4.QtGui.QDialog.exec_') as mocked_exec:
+            # WHEN: Show the dialog.
+            self.form.exec_()
+
+            # THEN: The dialog should be empty.
+            assert self.form.slide_text_edit.toPlainText() == u'', u'There should not be any text in the text editor.'
+
+    def set_text_test(self):
+        """
+        Test the set_text() method.
+        """
+        # GIVEN: A mocked QDialog.exec_() method
+        with patch(u'PyQt4.QtGui.QDialog.exec_') as mocked_exec:
+            mocked_set_focus = MagicMock()
+            self.form.slide_text_edit.setFocus = mocked_set_focus
+            wanted_text = u'THIS TEXT SHOULD BE SHOWN.'
+
+            # WHEN: Show the dialog and set the text.
+            self.form.exec_()
+            self.form.set_text(wanted_text)
+
+            # THEN: The dialog should show the text.
+            assert self.form.slide_text_edit.toPlainText() == wanted_text, \
+                u'The text editor should show the correct text.'
+
+            # THEN: The dialog should have focus.
+            mocked_set_focus.assert_called_with()
+


Follow ups