openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #20175
[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:
Tim Bentley (trb143)
For more details, see:
https://code.launchpad.net/~googol/openlp/random-regression-bugs/+merge/156110
Hello,
- fixed customs regression
- moved tests
Fixed regression I have caused with my last proposal. A test has been added to verify the fix :)
--
https://code.launchpad.net/~googol/openlp/random-regression-bugs/+merge/156110
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/plugins/custom/forms/editcustomform.py'
--- openlp/plugins/custom/forms/editcustomform.py 2013-03-28 20:25:35 +0000
+++ openlp/plugins/custom/forms/editcustomform.py 2013-03-29 06:28:24 +0000
@@ -158,7 +158,7 @@
"""
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 @@
"""
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 @@
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)
=== added directory 'tests/interfaces/openlp_plugins'
=== added file 'tests/interfaces/openlp_plugins/__init__.py'
=== added file 'tests/interfaces/openlp_plugins/__init__.pyc'
Binary files tests/interfaces/openlp_plugins/__init__.pyc 1970-01-01 00:00:00 +0000 and tests/interfaces/openlp_plugins/__init__.pyc 2013-03-29 06:28:24 +0000 differ
=== added directory 'tests/interfaces/openlp_plugins/custom'
=== added file 'tests/interfaces/openlp_plugins/custom/__init__.py'
=== added directory 'tests/interfaces/openlp_plugins/custom/forms'
=== added file 'tests/interfaces/openlp_plugins/custom/forms/__init__.py'
=== added file 'tests/interfaces/openlp_plugins/custom/forms/test_customform.py'
--- tests/interfaces/openlp_plugins/custom/forms/test_customform.py 1970-01-01 00:00:00 +0000
+++ tests/interfaces/openlp_plugins/custom/forms/test_customform.py 2013-03-29 06:28:24 +0000
@@ -0,0 +1,64 @@
+"""
+Module to test the custom edit form.
+"""
+from unittest import TestCase
+from mock import MagicMock, patch
+
+from PyQt4 import QtGui, QtTest, QtCore
+
+from openlp.core.lib import Registry
+# Import needed due to import problems.
+from openlp.plugins.custom.lib.mediaitem import CustomMediaItem
+from openlp.plugins.custom.forms.editcustomform import EditCustomForm
+
+
+class TestCustomFrom(TestCase):
+ """
+ Test the EditCustomForm.
+ """
+ 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)
+ media_item = MagicMock()
+ manager = MagicMock()
+ self.form = EditCustomForm(media_item, self.main_window, manager)
+
+ 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 load_custom_test(self):
+ """
+ Test the load_custom() method.
+ """
+ # GIVEN: A mocked QDialog.exec_() method
+ with patch(u'PyQt4.QtGui.QDialog.exec_') as mocked_exec:
+ # WHEN: Show the dialog and create a new custom item.
+ self.form.exec_()
+ self.form.load_custom(0)
+
+ #THEN: The line edits should not contain any text.
+ 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.'
=== added directory 'tests/interfaces/openlp_plugins/songs'
=== added file 'tests/interfaces/openlp_plugins/songs/__init__.py'
=== added directory 'tests/interfaces/openlp_plugins/songs/forms'
=== added file 'tests/interfaces/openlp_plugins/songs/forms/__init__.py'
=== added file 'tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py'
--- tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py 1970-01-01 00:00:00 +0000
+++ tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py 2013-03-29 06:28:24 +0000
@@ -0,0 +1,120 @@
+"""
+Package to test the openlp.plugins.songs.forms.authorsform package.
+"""
+from unittest import TestCase
+
+from PyQt4 import QtGui
+
+from openlp.core.lib import Registry
+from openlp.plugins.songs.forms.authorsform import AuthorsForm
+
+
+class TestAuthorsForm(TestCase):
+ """
+ Test the AuthorsForm class
+ """
+
+ 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 = AuthorsForm()
+
+ 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 ui_defaults_test(self):
+ """
+ Test the AuthorForm defaults are correct
+ """
+ self.assertEqual(self.form.first_name_edit.text(), u'', u'The first name edit should be empty')
+ self.assertEqual(self.form.last_name_edit.text(), u'', u'The last name edit should be empty')
+ self.assertEqual(self.form.display_edit.text(), u'', u'The display name edit should be empty')
+
+ def get_first_name_property_test(self):
+ """
+ Test that getting the first name property on the AuthorForm works correctly
+ """
+ # GIVEN: A first name to set
+ first_name = u'John'
+
+ # WHEN: The first_name_edit's text is set
+ self.form.first_name_edit.setText(first_name)
+
+ # THEN: The first_name property should have the correct value
+ self.assertEqual(self.form.first_name, first_name, u'The first name property should be correct')
+
+ def set_first_name_property_test(self):
+ """
+ Test that setting the first name property on the AuthorForm works correctly
+ """
+ # GIVEN: A first name to set
+ first_name = u'James'
+
+ # WHEN: The first_name property is set
+ self.form.first_name = first_name
+
+ # THEN: The first_name_edit should have the correct value
+ self.assertEqual(self.form.first_name_edit.text(), first_name, u'The first name should be set correctly')
+
+ def get_last_name_property_test(self):
+ """
+ Test that getting the last name property on the AuthorForm works correctly
+ """
+ # GIVEN: A last name to set
+ last_name = u'Smith'
+
+ # WHEN: The last_name_edit's text is set
+ self.form.last_name_edit.setText(last_name)
+
+ # THEN: The last_name property should have the correct value
+ self.assertEqual(self.form.last_name, last_name, u'The last name property should be correct')
+
+ def set_last_name_property_test(self):
+ """
+ Test that setting the last name property on the AuthorForm works correctly
+ """
+ # GIVEN: A last name to set
+ last_name = u'Potter'
+
+ # WHEN: The last_name property is set
+ self.form.last_name = last_name
+
+ # THEN: The last_name_edit should have the correct value
+ self.assertEqual(self.form.last_name_edit.text(), last_name, u'The last name should be set correctly')
+
+ def get_display_name_property_test(self):
+ """
+ Test that getting the display name property on the AuthorForm works correctly
+ """
+ # GIVEN: A display name to set
+ display_name = u'John'
+
+ # WHEN: The display_name_edit's text is set
+ self.form.display_edit.setText(display_name)
+
+ # THEN: The display_name property should have the correct value
+ self.assertEqual(self.form.display_name, display_name, u'The display name property should be correct')
+
+ def set_display_name_property_test(self):
+ """
+ Test that setting the display name property on the AuthorForm works correctly
+ """
+ # GIVEN: A display name to set
+ display_name = u'John'
+
+ # WHEN: The display_name property is set
+ self.form.display_name = display_name
+
+ # THEN: The display_name_edit should have the correct value
+ self.assertEqual(self.form.display_edit.text(), display_name, u'The display name should be set correctly')
+
=== added file 'tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py'
--- tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py 1970-01-01 00:00:00 +0000
+++ tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py 2013-03-29 06:28:24 +0000
@@ -0,0 +1,47 @@
+"""
+Package to test the openlp.plugins.songs.forms.editsongform package.
+"""
+from mock import MagicMock
+from unittest import TestCase
+
+from PyQt4 import QtGui
+
+from openlp.core.lib import Registry
+from openlp.plugins.songs.forms.editsongform import EditSongForm
+
+
+class TestEditSongForm(TestCase):
+ """
+ Test the EditSongForm class
+ """
+
+ 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)
+ Registry().register(u'theme_manager', MagicMock())
+ self.form = EditSongForm(MagicMock(), self.main_window, MagicMock())
+
+ 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 ui_defaults_test(self):
+ """
+ Test that the EditSongForm defaults are correct
+ """
+ self.assertFalse(self.form.verse_edit_button.isEnabled(), u'The verse edit button should not be enabled')
+ self.assertFalse(self.form.verse_delete_button.isEnabled(), u'The verse delete button should not be enabled')
+ self.assertFalse(self.form.author_remove_button.isEnabled(), u'The author remove button should not be enabled')
+ self.assertFalse(self.form.topic_remove_button.isEnabled(), u'The topic remove button should not be enabled')
+
+ def is_verse_edit_form_executed_test(self):
+ pass
\ No newline at end of file
=== added file 'tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py'
--- tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py 1970-01-01 00:00:00 +0000
+++ tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py 2013-03-29 06:28:24 +0000
@@ -0,0 +1,95 @@
+"""
+Package to test the openlp.plugins.songs.forms.editverseform package.
+"""
+from unittest import TestCase
+
+from PyQt4 import QtCore, QtGui, QtTest
+
+from openlp.core.lib import Registry
+from openlp.plugins.songs.forms.editverseform import EditVerseForm
+
+
+class TestEditVerseForm(TestCase):
+ """
+ Test the EditVerseForm class
+ """
+
+ 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 = EditVerseForm()
+
+ 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 ui_defaults_test(self):
+ """
+ Test the EditVerseForm defaults are correct
+ """
+ # GIVEN: An EditVerseForm instance
+ # WHEN: The form is shown
+ # THEN: The default value is correct
+ self.assertEqual(self.form.verse_text_edit.toPlainText(), u'', u'The verse edit box is empty.')
+
+ def type_verse_text_tests(self):
+ """
+ Test that typing into the verse text edit box returns the correct text
+ """
+ # GIVEN: An instance of the EditVerseForm and some text to type
+ text = 'Amazing Grace, how sweet the sound!'
+
+ # WHEN: Some verse text is typed into the text edit
+ QtTest.QTest.keyClicks(self.form.verse_text_edit, text)
+
+ # THEN: The verse text edit should have the verse text in it
+ self.assertEqual(text, self.form.verse_text_edit.toPlainText(),
+ u'The verse text edit should have the typed out verse')
+
+ def insert_verse_test(self):
+ """
+ Test that clicking the insert button inserts the correct verse marker
+ """
+ # GIVEN: An instance of the EditVerseForm
+ # WHEN: The Insert button is clicked
+ QtTest.QTest.mouseClick(self.form.insert_button, QtCore.Qt.LeftButton)
+
+ # THEN: The verse text edit should have a Verse:1 in it
+ self.assertIn(u'---[Verse:1]---', self.form.verse_text_edit.toPlainText(),
+ u'The verse text edit should have a verse marker')
+
+ def insert_verse_2_test(self):
+ """
+ Test that clicking the up button on the spin box and then clicking the insert button inserts the correct marker
+ """
+ # GIVEN: An instance of the EditVerseForm
+ # WHEN: The spin button and then the Insert button are clicked
+ QtTest.QTest.keyClick(self.form.verse_number_box, QtCore.Qt.Key_Up)
+ QtTest.QTest.mouseClick(self.form.insert_button, QtCore.Qt.LeftButton)
+
+ # THEN: The verse text edit should have a Verse:1 in it
+ self.assertIn(u'---[Verse:2]---', self.form.verse_text_edit.toPlainText(),
+ u'The verse text edit should have a "Verse 2" marker')
+
+ def insert_chorus_test(self):
+ """
+ Test that clicking the verse type combo box and then clicking the insert button inserts the correct marker
+ """
+ # GIVEN: An instance of the EditVerseForm
+ # WHEN: The verse type combo box and then the Insert button are clicked
+ QtTest.QTest.keyClick(self.form.verse_type_combo_box, QtCore.Qt.Key_Down)
+ QtTest.QTest.mouseClick(self.form.insert_button, QtCore.Qt.LeftButton)
+
+ # THEN: The verse text edit should have a Chorus:1 in it
+ self.assertIn(u'---[Chorus:1]---', self.form.verse_text_edit.toPlainText(),
+ u'The verse text edit should have a "Chorus 1" marker')
+
=== added file 'tests/interfaces/openlp_plugins/songs/forms/test_topicsform.py'
--- tests/interfaces/openlp_plugins/songs/forms/test_topicsform.py 1970-01-01 00:00:00 +0000
+++ tests/interfaces/openlp_plugins/songs/forms/test_topicsform.py 2013-03-29 06:28:24 +0000
@@ -0,0 +1,65 @@
+"""
+Package to test the openlp.plugins.songs.forms.topicsform package.
+"""
+from unittest import TestCase
+
+from PyQt4 import QtGui
+
+from openlp.core.lib import Registry
+from openlp.plugins.songs.forms.topicsform import TopicsForm
+
+
+class TestTopicsForm(TestCase):
+ """
+ Test the TopicsForm class
+ """
+
+ 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 = TopicsForm()
+
+ 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 ui_defaults_test(self):
+ """
+ Test the TopicsForm defaults are correct
+ """
+ self.assertEqual(self.form.name_edit.text(), u'', u'The first name edit should be empty')
+
+ def get_name_property_test(self):
+ """
+ Test that getting the name property on the TopicsForm works correctly
+ """
+ # GIVEN: A topic name to set
+ topic_name = u'Salvation'
+
+ # WHEN: The name_edit's text is set
+ self.form.name_edit.setText(topic_name)
+
+ # THEN: The name property should have the correct value
+ self.assertEqual(self.form.name, topic_name, u'The name property should be correct')
+
+ def set_name_property_test(self):
+ """
+ Test that setting the name property on the TopicsForm works correctly
+ """
+ # GIVEN: A topic name to set
+ topic_name = u'James'
+
+ # WHEN: The name property is set
+ self.form.name = topic_name
+
+ # THEN: The name_edit should have the correct value
+ self.assertEqual(self.form.name_edit.text(), topic_name, u'The topic name should be set correctly')
=== removed directory 'tests/interfaces/openlp_plugins_custom_forms'
=== removed file 'tests/interfaces/openlp_plugins_custom_forms/__init__.py'
=== removed file 'tests/interfaces/openlp_plugins_custom_forms/test_customform.py'
--- tests/interfaces/openlp_plugins_custom_forms/test_customform.py 2013-03-28 21:24:19 +0000
+++ tests/interfaces/openlp_plugins_custom_forms/test_customform.py 1970-01-01 00:00:00 +0000
@@ -1,52 +0,0 @@
-"""
-Module to test the custom edit form.
-"""
-from unittest import TestCase
-from mock import MagicMock, patch
-
-from PyQt4 import QtGui
-
-from openlp.core.lib import Registry
-# Import needed due to import problems.
-from openlp.plugins.custom.lib.mediaitem import CustomMediaItem
-from openlp.plugins.custom.forms.editcustomform import EditCustomForm
-
-
-class TestCustomFrom(TestCase):
- """
- Test the EditCustomForm.
- """
- 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)
- media_item = MagicMock()
- manager = MagicMock()
- self.form = EditCustomForm(media_item, self.main_window, manager)
-
- 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 load_custom_test(self):
- """
- Test the EditCustomForm defaults are correct
- """
- # GIVEN: A mocked QDialog.exec_() method
- with patch(u'PyQt4.QtGui.QDialog.exec_') as mocked_exec:
- # WHEN: Show the dialog and create a new custom item.
- self.form.exec_()
- self.form.load_custom(0)
-
- #THEN: The line edits should not contain any text.
- 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')
-
=== removed directory 'tests/interfaces/openlp_plugins_songs_forms'
=== removed file 'tests/interfaces/openlp_plugins_songs_forms/__init__.py'
=== removed file 'tests/interfaces/openlp_plugins_songs_forms/test_authorsform.py'
--- tests/interfaces/openlp_plugins_songs_forms/test_authorsform.py 2013-03-14 22:22:18 +0000
+++ tests/interfaces/openlp_plugins_songs_forms/test_authorsform.py 1970-01-01 00:00:00 +0000
@@ -1,120 +0,0 @@
-"""
-Package to test the openlp.plugins.songs.forms.authorsform package.
-"""
-from unittest import TestCase
-
-from PyQt4 import QtGui
-
-from openlp.core.lib import Registry
-from openlp.plugins.songs.forms.authorsform import AuthorsForm
-
-
-class TestAuthorsForm(TestCase):
- """
- Test the AuthorsForm class
- """
-
- 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 = AuthorsForm()
-
- 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 ui_defaults_test(self):
- """
- Test the AuthorForm defaults are correct
- """
- self.assertEqual(self.form.first_name_edit.text(), u'', u'The first name edit should be empty')
- self.assertEqual(self.form.last_name_edit.text(), u'', u'The last name edit should be empty')
- self.assertEqual(self.form.display_edit.text(), u'', u'The display name edit should be empty')
-
- def get_first_name_property_test(self):
- """
- Test that getting the first name property on the AuthorForm works correctly
- """
- # GIVEN: A first name to set
- first_name = u'John'
-
- # WHEN: The first_name_edit's text is set
- self.form.first_name_edit.setText(first_name)
-
- # THEN: The first_name property should have the correct value
- self.assertEqual(self.form.first_name, first_name, u'The first name property should be correct')
-
- def set_first_name_property_test(self):
- """
- Test that setting the first name property on the AuthorForm works correctly
- """
- # GIVEN: A first name to set
- first_name = u'James'
-
- # WHEN: The first_name property is set
- self.form.first_name = first_name
-
- # THEN: The first_name_edit should have the correct value
- self.assertEqual(self.form.first_name_edit.text(), first_name, u'The first name should be set correctly')
-
- def get_last_name_property_test(self):
- """
- Test that getting the last name property on the AuthorForm works correctly
- """
- # GIVEN: A last name to set
- last_name = u'Smith'
-
- # WHEN: The last_name_edit's text is set
- self.form.last_name_edit.setText(last_name)
-
- # THEN: The last_name property should have the correct value
- self.assertEqual(self.form.last_name, last_name, u'The last name property should be correct')
-
- def set_last_name_property_test(self):
- """
- Test that setting the last name property on the AuthorForm works correctly
- """
- # GIVEN: A last name to set
- last_name = u'Potter'
-
- # WHEN: The last_name property is set
- self.form.last_name = last_name
-
- # THEN: The last_name_edit should have the correct value
- self.assertEqual(self.form.last_name_edit.text(), last_name, u'The last name should be set correctly')
-
- def get_display_name_property_test(self):
- """
- Test that getting the display name property on the AuthorForm works correctly
- """
- # GIVEN: A display name to set
- display_name = u'John'
-
- # WHEN: The display_name_edit's text is set
- self.form.display_edit.setText(display_name)
-
- # THEN: The display_name property should have the correct value
- self.assertEqual(self.form.display_name, display_name, u'The display name property should be correct')
-
- def set_display_name_property_test(self):
- """
- Test that setting the display name property on the AuthorForm works correctly
- """
- # GIVEN: A display name to set
- display_name = u'John'
-
- # WHEN: The display_name property is set
- self.form.display_name = display_name
-
- # THEN: The display_name_edit should have the correct value
- self.assertEqual(self.form.display_edit.text(), display_name, u'The display name should be set correctly')
-
=== removed file 'tests/interfaces/openlp_plugins_songs_forms/test_editsongform.py'
--- tests/interfaces/openlp_plugins_songs_forms/test_editsongform.py 2013-03-18 10:16:50 +0000
+++ tests/interfaces/openlp_plugins_songs_forms/test_editsongform.py 1970-01-01 00:00:00 +0000
@@ -1,47 +0,0 @@
-"""
-Package to test the openlp.plugins.songs.forms.editsongform package.
-"""
-from mock import MagicMock
-from unittest import TestCase
-
-from PyQt4 import QtGui
-
-from openlp.core.lib import Registry
-from openlp.plugins.songs.forms.editsongform import EditSongForm
-
-
-class TestEditSongForm(TestCase):
- """
- Test the EditSongForm class
- """
-
- 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)
- Registry().register(u'theme_manager', MagicMock())
- self.form = EditSongForm(MagicMock(), self.main_window, MagicMock())
-
- 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 ui_defaults_test(self):
- """
- Test that the EditSongForm defaults are correct
- """
- self.assertFalse(self.form.verse_edit_button.isEnabled(), u'The verse edit button should not be enabled')
- self.assertFalse(self.form.verse_delete_button.isEnabled(), u'The verse delete button should not be enabled')
- self.assertFalse(self.form.author_remove_button.isEnabled(), u'The author remove button should not be enabled')
- self.assertFalse(self.form.topic_remove_button.isEnabled(), u'The topic remove button should not be enabled')
-
- def is_verse_edit_form_executed_test(self):
- pass
\ No newline at end of file
=== removed file 'tests/interfaces/openlp_plugins_songs_forms/test_editverseform.py'
--- tests/interfaces/openlp_plugins_songs_forms/test_editverseform.py 2013-03-14 22:22:18 +0000
+++ tests/interfaces/openlp_plugins_songs_forms/test_editverseform.py 1970-01-01 00:00:00 +0000
@@ -1,95 +0,0 @@
-"""
-Package to test the openlp.plugins.songs.forms.editverseform package.
-"""
-from unittest import TestCase
-
-from PyQt4 import QtCore, QtGui, QtTest
-
-from openlp.core.lib import Registry
-from openlp.plugins.songs.forms.editverseform import EditVerseForm
-
-
-class TestEditVerseForm(TestCase):
- """
- Test the EditVerseForm class
- """
-
- 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 = EditVerseForm()
-
- 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 ui_defaults_test(self):
- """
- Test the EditVerseForm defaults are correct
- """
- # GIVEN: An EditVerseForm instance
- # WHEN: The form is shown
- # THEN: The default value is correct
- self.assertEqual(self.form.verse_text_edit.toPlainText(), u'', u'The verse edit box is empty.')
-
- def type_verse_text_tests(self):
- """
- Test that typing into the verse text edit box returns the correct text
- """
- # GIVEN: An instance of the EditVerseForm and some text to type
- text = 'Amazing Grace, how sweet the sound!'
-
- # WHEN: Some verse text is typed into the text edit
- QtTest.QTest.keyClicks(self.form.verse_text_edit, text)
-
- # THEN: The verse text edit should have the verse text in it
- self.assertEqual(text, self.form.verse_text_edit.toPlainText(),
- u'The verse text edit should have the typed out verse')
-
- def insert_verse_test(self):
- """
- Test that clicking the insert button inserts the correct verse marker
- """
- # GIVEN: An instance of the EditVerseForm
- # WHEN: The Insert button is clicked
- QtTest.QTest.mouseClick(self.form.insert_button, QtCore.Qt.LeftButton)
-
- # THEN: The verse text edit should have a Verse:1 in it
- self.assertIn(u'---[Verse:1]---', self.form.verse_text_edit.toPlainText(),
- u'The verse text edit should have a verse marker')
-
- def insert_verse_2_test(self):
- """
- Test that clicking the up button on the spin box and then clicking the insert button inserts the correct marker
- """
- # GIVEN: An instance of the EditVerseForm
- # WHEN: The spin button and then the Insert button are clicked
- QtTest.QTest.keyClick(self.form.verse_number_box, QtCore.Qt.Key_Up)
- QtTest.QTest.mouseClick(self.form.insert_button, QtCore.Qt.LeftButton)
-
- # THEN: The verse text edit should have a Verse:1 in it
- self.assertIn(u'---[Verse:2]---', self.form.verse_text_edit.toPlainText(),
- u'The verse text edit should have a "Verse 2" marker')
-
- def insert_chorus_test(self):
- """
- Test that clicking the verse type combo box and then clicking the insert button inserts the correct marker
- """
- # GIVEN: An instance of the EditVerseForm
- # WHEN: The verse type combo box and then the Insert button are clicked
- QtTest.QTest.keyClick(self.form.verse_type_combo_box, QtCore.Qt.Key_Down)
- QtTest.QTest.mouseClick(self.form.insert_button, QtCore.Qt.LeftButton)
-
- # THEN: The verse text edit should have a Chorus:1 in it
- self.assertIn(u'---[Chorus:1]---', self.form.verse_text_edit.toPlainText(),
- u'The verse text edit should have a "Chorus 1" marker')
-
=== removed file 'tests/interfaces/openlp_plugins_songs_forms/test_topicsform.py'
--- tests/interfaces/openlp_plugins_songs_forms/test_topicsform.py 2013-03-14 22:22:18 +0000
+++ tests/interfaces/openlp_plugins_songs_forms/test_topicsform.py 1970-01-01 00:00:00 +0000
@@ -1,65 +0,0 @@
-"""
-Package to test the openlp.plugins.songs.forms.topicsform package.
-"""
-from unittest import TestCase
-
-from PyQt4 import QtGui
-
-from openlp.core.lib import Registry
-from openlp.plugins.songs.forms.topicsform import TopicsForm
-
-
-class TestTopicsForm(TestCase):
- """
- Test the TopicsForm class
- """
-
- 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 = TopicsForm()
-
- 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 ui_defaults_test(self):
- """
- Test the TopicsForm defaults are correct
- """
- self.assertEqual(self.form.name_edit.text(), u'', u'The first name edit should be empty')
-
- def get_name_property_test(self):
- """
- Test that getting the name property on the TopicsForm works correctly
- """
- # GIVEN: A topic name to set
- topic_name = u'Salvation'
-
- # WHEN: The name_edit's text is set
- self.form.name_edit.setText(topic_name)
-
- # THEN: The name property should have the correct value
- self.assertEqual(self.form.name, topic_name, u'The name property should be correct')
-
- def set_name_property_test(self):
- """
- Test that setting the name property on the TopicsForm works correctly
- """
- # GIVEN: A topic name to set
- topic_name = u'James'
-
- # WHEN: The name property is set
- self.form.name = topic_name
-
- # THEN: The name_edit should have the correct value
- self.assertEqual(self.form.name_edit.text(), topic_name, u'The topic name should be set correctly')
Follow ups