Merge from upstream

This commit is contained in:
Raoul Snyman 2013-03-14 15:59:48 +02:00
commit 55ea69295a
8 changed files with 63 additions and 10 deletions

View File

@ -797,7 +797,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
"""
Free up autocompletion memory on dialog exit
"""
log.debug (u'SongEditForm.clearCaches')
log.debug(u'SongEditForm.clearCaches')
self.authors = []
self.themes = []
self.books = []

View File

@ -26,6 +26,9 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
This module contains the song book form
"""
from PyQt4 import QtGui

View File

@ -26,6 +26,9 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
This module contains the topic edit form.
"""
from PyQt4 import QtGui

View File

@ -386,6 +386,8 @@ def clean_song(manager, song):
``song``
The song object.
"""
from xml import SongXML
if isinstance(song.title, buffer):
song.title = unicode(song.title)
if isinstance(song.alternate_title, buffer):

View File

@ -42,7 +42,7 @@ class TestPluginManager(TestCase):
def find_plugins_test(self):
"""
Test the find_plugins() method to ensure it imports the correct plugins.
Test the find_plugins() method to ensure it imports the correct plugins
"""
# GIVEN: A plugin manager
plugin_manager = PluginManager()

View File

@ -8,6 +8,7 @@ from openlp.core.lib import Registry
from openlp.core.ui import filerenameform
from PyQt4 import QtGui, QtTest
class TestStartFileRenameForm(TestCase):
def setUp(self):

View File

@ -39,7 +39,7 @@ class TestAuthorsForm(TestCase):
def get_first_name_property_test(self):
"""
Test that getting the first name property on the AuthorForm works correctly.
Test that getting the first name property on the AuthorForm works correctly
"""
# GIVEN: A first name to set
first_name = u'John'
@ -52,7 +52,7 @@ class TestAuthorsForm(TestCase):
def set_first_name_property_test(self):
"""
Test that setting the first name property on the AuthorForm works correctly.
Test that setting the first name property on the AuthorForm works correctly
"""
# GIVEN: A first name to set
first_name = u'James'
@ -65,7 +65,7 @@ class TestAuthorsForm(TestCase):
def get_last_name_property_test(self):
"""
Test that getting the last name property on the AuthorForm works correctly.
Test that getting the last name property on the AuthorForm works correctly
"""
# GIVEN: A last name to set
last_name = u'Smith'
@ -78,7 +78,7 @@ class TestAuthorsForm(TestCase):
def set_last_name_property_test(self):
"""
Test that setting the last name property on the AuthorForm works correctly.
Test that setting the last name property on the AuthorForm works correctly
"""
# GIVEN: A last name to set
last_name = u'Potter'
@ -91,7 +91,7 @@ class TestAuthorsForm(TestCase):
def get_display_name_property_test(self):
"""
Test that getting the display name property on the AuthorForm works correctly.
Test that getting the display name property on the AuthorForm works correctly
"""
# GIVEN: A display name to set
display_name = u'John'
@ -104,7 +104,7 @@ class TestAuthorsForm(TestCase):
def set_display_name_property_test(self):
"""
Test that setting the display name property on the AuthorForm works correctly.
Test that setting the display name property on the AuthorForm works correctly
"""
# GIVEN: A display name to set
display_name = u'John'

View File

@ -8,6 +8,11 @@ from PyQt4 import QtCore, QtGui, QtTest
from openlp.core.lib import Registry
from openlp.plugins.songs.forms.editverseform import EditVerseForm
VERSE_TEXT = u"""The Lord told Noah to build Him an arky arky,
Lord told Noah to build Him an arky arky,
Build it out of gopher barky barky,
Children of the Lord."""
class TestEditVerseForm(TestCase):
def setUp(self):
@ -37,9 +42,21 @@ class TestEditVerseForm(TestCase):
# 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
# WHEN: Some verse text is typed into the text edit
QtTest.QTest.keyClicks(self.form.verse_text_edit, VERSE_TEXT)
# THEN: The verse text edit should have the verse text in it
self.assertEqual(VERSE_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 inserting a verse works as it should.
Test that clicking the insert button inserts the correct verse marker
"""
# GIVEN: An instance of the EditVerseForm
# WHEN: The Insert button is clicked
@ -47,4 +64,31 @@ class TestEditVerseForm(TestCase):
# 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 identifier')
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')