From b139b6a4ebc77a8665f969a5566ce7133710b58a Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 28 Mar 2013 22:49:11 +0100 Subject: [PATCH 1/5] fixed regression :/ --- openlp/plugins/custom/forms/editcustomform.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index 3c2b06f86..c78baa974 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -158,7 +158,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): """ Add a new blank slide. """ - self.edit_slide_form.setText(u'') + self.edit_slide_form.set_text(u'') if self.edit_slide_form.exec_(): self.slide_list_view.addItems(self.edit_slide_form.get_text()) @@ -166,7 +166,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): """ Edit the currently selected slide. """ - self.edit_slide_form.setText(self.slide_list_view.currentItem().text()) + self.edit_slide_form.set_text(self.slide_list_view.currentItem().text()) if self.edit_slide_form.exec_(): self.update_slide_list(self.edit_slide_form.get_text()) @@ -180,7 +180,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): slide_text += item.text() if row != self.slide_list_view.count() - 1: slide_text += u'\n[===]\n' - self.edit_slide_form.setText(slide_text) + self.edit_slide_form.set_text(slide_text) if self.edit_slide_form.exec_(): self.update_slide_list(self.edit_slide_form.get_text(), True) From 94b926d273849faa7fbde46f15039fc3a69a9816 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 28 Mar 2013 23:08:14 +0100 Subject: [PATCH 2/5] added test --- .../test_customform.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/interfaces/openlp_plugins_custom_forms/test_customform.py b/tests/interfaces/openlp_plugins_custom_forms/test_customform.py index 029244220..166ccd672 100644 --- a/tests/interfaces/openlp_plugins_custom_forms/test_customform.py +++ b/tests/interfaces/openlp_plugins_custom_forms/test_customform.py @@ -4,7 +4,7 @@ Module to test the custom edit form. from unittest import TestCase from mock import MagicMock, patch -from PyQt4 import QtGui +from PyQt4 import QtGui, QtTest, QtCore from openlp.core.lib import Registry # Import needed due to import problems. @@ -36,9 +36,9 @@ class TestCustomFrom(TestCase): del self.main_window del self.app - def load_custom_test(self): + def load_custom(self): """ - Test the EditCustomForm defaults are correct + Test the load_custom() method. """ # GIVEN: A mocked QDialog.exec_() method with patch(u'PyQt4.QtGui.QDialog.exec_') as mocked_exec: @@ -50,3 +50,15 @@ class TestCustomFrom(TestCase): self.assertEqual(self.form.title_edit.text(), u'', u'The title edit should be empty') self.assertEqual(self.form.credit_edit.text(), u'', u'The credit edit should be empty') + + def on_add_button_clicked_test(self): + """ + Test the on_add_button_clicked_test method / add_button button. + """ + # GIVEN: A mocked QDialog.exec_() method + with patch(u'PyQt4.QtGui.QDialog.exec_') as mocked_exec: + # WHEN: Show the dialog and add a new slide. + self.form.exec_() + QtTest.QTest.mouseClick(self.form.add_button, QtCore.Qt.LeftButton) + #THEN: One slide should be added. + assert self.form.slide_list_view.count() == 1, u'There should be one slide be added.' From 219ab48277594bf1aaa7cca33a832ac5aafbccfe Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 28 Mar 2013 23:10:24 +0100 Subject: [PATCH 3/5] enabled test again --- tests/interfaces/openlp_plugins_custom_forms/test_customform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/interfaces/openlp_plugins_custom_forms/test_customform.py b/tests/interfaces/openlp_plugins_custom_forms/test_customform.py index 166ccd672..ee0eb4137 100644 --- a/tests/interfaces/openlp_plugins_custom_forms/test_customform.py +++ b/tests/interfaces/openlp_plugins_custom_forms/test_customform.py @@ -36,7 +36,7 @@ class TestCustomFrom(TestCase): del self.main_window del self.app - def load_custom(self): + def load_custom_test(self): """ Test the load_custom() method. """ From ffd409d24ea55f2b7a0cfecce0a84e67d0140a75 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 28 Mar 2013 23:12:09 +0100 Subject: [PATCH 4/5] wording --- tests/interfaces/openlp_plugins_custom_forms/test_customform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/interfaces/openlp_plugins_custom_forms/test_customform.py b/tests/interfaces/openlp_plugins_custom_forms/test_customform.py index ee0eb4137..ebd12f49d 100644 --- a/tests/interfaces/openlp_plugins_custom_forms/test_customform.py +++ b/tests/interfaces/openlp_plugins_custom_forms/test_customform.py @@ -61,4 +61,4 @@ class TestCustomFrom(TestCase): self.form.exec_() QtTest.QTest.mouseClick(self.form.add_button, QtCore.Qt.LeftButton) #THEN: One slide should be added. - assert self.form.slide_list_view.count() == 1, u'There should be one slide be added.' + assert self.form.slide_list_view.count() == 1, u'There should be one slide added.' From 48ffb04f5d1fede7cc64d5d2c7bd1612196c055e Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Fri, 29 Mar 2013 07:25:01 +0100 Subject: [PATCH 5/5] moved tests --- .../__init__.py | 0 tests/interfaces/openlp_plugins/__init__.pyc | Bin 0 -> 184 bytes .../custom}/__init__.py | 0 .../openlp_plugins/custom/forms/__init__.py | 0 .../custom/forms}/test_customform.py | 0 tests/interfaces/openlp_plugins/songs/__init__.py | 0 .../openlp_plugins/songs/forms/__init__.py | 0 .../songs/forms}/test_authorsform.py | 0 .../songs/forms}/test_editsongform.py | 0 .../songs/forms}/test_editverseform.py | 0 .../songs/forms}/test_topicsform.py | 0 11 files changed, 0 insertions(+), 0 deletions(-) rename tests/interfaces/{openlp_plugins_custom_forms => openlp_plugins}/__init__.py (100%) create mode 100644 tests/interfaces/openlp_plugins/__init__.pyc rename tests/interfaces/{openlp_plugins_songs_forms => openlp_plugins/custom}/__init__.py (100%) create mode 100644 tests/interfaces/openlp_plugins/custom/forms/__init__.py rename tests/interfaces/{openlp_plugins_custom_forms => openlp_plugins/custom/forms}/test_customform.py (100%) create mode 100644 tests/interfaces/openlp_plugins/songs/__init__.py create mode 100644 tests/interfaces/openlp_plugins/songs/forms/__init__.py rename tests/interfaces/{openlp_plugins_songs_forms => openlp_plugins/songs/forms}/test_authorsform.py (100%) rename tests/interfaces/{openlp_plugins_songs_forms => openlp_plugins/songs/forms}/test_editsongform.py (100%) rename tests/interfaces/{openlp_plugins_songs_forms => openlp_plugins/songs/forms}/test_editverseform.py (100%) rename tests/interfaces/{openlp_plugins_songs_forms => openlp_plugins/songs/forms}/test_topicsform.py (100%) diff --git a/tests/interfaces/openlp_plugins_custom_forms/__init__.py b/tests/interfaces/openlp_plugins/__init__.py similarity index 100% rename from tests/interfaces/openlp_plugins_custom_forms/__init__.py rename to tests/interfaces/openlp_plugins/__init__.py diff --git a/tests/interfaces/openlp_plugins/__init__.pyc b/tests/interfaces/openlp_plugins/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0d24c9eff54ac7d86f14523ef46194c4bbc24cad GIT binary patch literal 184 zcmZ9GO$q`r423JY5W#!QX3Pa-@BpGC9-x#qGe-JH(*ZrLhY(zw0apgz3w(L-vV3nh zpI3LW>NgA72NAEtoKn|jCZ|SB{TUl!a7zKfL|4!-^d;TVR)%xNc