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) 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 000000000..0d24c9eff Binary files /dev/null and b/tests/interfaces/openlp_plugins/__init__.pyc differ diff --git a/tests/interfaces/openlp_plugins_songs_forms/__init__.py b/tests/interfaces/openlp_plugins/custom/__init__.py similarity index 100% rename from tests/interfaces/openlp_plugins_songs_forms/__init__.py rename to tests/interfaces/openlp_plugins/custom/__init__.py diff --git a/tests/interfaces/openlp_plugins/custom/forms/__init__.py b/tests/interfaces/openlp_plugins/custom/forms/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/interfaces/openlp_plugins_custom_forms/test_customform.py b/tests/interfaces/openlp_plugins/custom/forms/test_customform.py similarity index 70% rename from tests/interfaces/openlp_plugins_custom_forms/test_customform.py rename to tests/interfaces/openlp_plugins/custom/forms/test_customform.py index 029244220..ebd12f49d 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. @@ -38,7 +38,7 @@ class TestCustomFrom(TestCase): def load_custom_test(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 added.' diff --git a/tests/interfaces/openlp_plugins/songs/__init__.py b/tests/interfaces/openlp_plugins/songs/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/interfaces/openlp_plugins/songs/forms/__init__.py b/tests/interfaces/openlp_plugins/songs/forms/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/interfaces/openlp_plugins_songs_forms/test_authorsform.py b/tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py similarity index 100% rename from tests/interfaces/openlp_plugins_songs_forms/test_authorsform.py rename to tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py diff --git a/tests/interfaces/openlp_plugins_songs_forms/test_editsongform.py b/tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py similarity index 100% rename from tests/interfaces/openlp_plugins_songs_forms/test_editsongform.py rename to tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py diff --git a/tests/interfaces/openlp_plugins_songs_forms/test_editverseform.py b/tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py similarity index 100% rename from tests/interfaces/openlp_plugins_songs_forms/test_editverseform.py rename to tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py diff --git a/tests/interfaces/openlp_plugins_songs_forms/test_topicsform.py b/tests/interfaces/openlp_plugins/songs/forms/test_topicsform.py similarity index 100% rename from tests/interfaces/openlp_plugins_songs_forms/test_topicsform.py rename to tests/interfaces/openlp_plugins/songs/forms/test_topicsform.py