openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #26350
[Merge] lp:~oliwee/openlp/bug_1424555 into lp:openlp
Oliver Wieland has proposed merging lp:~oliwee/openlp/bug_1424555 into lp:openlp.
Requested reviews:
Raoul Snyman (raoul-snyman)
Related bugs:
Bug #1424555 in OpenLP: "When editing a single verse, the number is always 1"
https://bugs.launchpad.net/openlp/+bug/1424555
For more details, see:
https://code.launchpad.net/~oliwee/openlp/bug_1424555/+merge/251320
fixes bug#1424555
--
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/plugins/songs/forms/editverseform.py'
--- openlp/plugins/songs/forms/editverseform.py 2015-01-18 13:39:21 +0000
+++ openlp/plugins/songs/forms/editverseform.py 2015-02-27 19:36:52 +0000
@@ -98,6 +98,8 @@
"""
Adjusts the verse number SpinBox in regard to the selected verse type and the cursor's position.
"""
+ if self.has_single_verse:
+ return
position = self.verse_text_edit.textCursor().position()
text = self.verse_text_edit.toPlainText()
verse_name = VerseType.translated_names[
=== added file 'tests/functional/openlp_plugins/songs/test_editverseform.py'
--- tests/functional/openlp_plugins/songs/test_editverseform.py 1970-01-01 00:00:00 +0000
+++ tests/functional/openlp_plugins/songs/test_editverseform.py 2015-02-27 19:36:52 +0000
@@ -0,0 +1,49 @@
+"""
+This module contains tests for the editverseform of the Songs plugin.
+"""
+from unittest import TestCase
+
+from PyQt4 import QtCore, QtGui
+
+from openlp.core.common import Registry, Settings
+from openlp.core.lib import ServiceItem
+from openlp.plugins.songs.forms.editverseform import EditVerseForm
+from openlp.plugins.songs.lib.db import AuthorType
+from tests.functional import patch, MagicMock
+from tests.helpers.testmixin import TestMixin
+
+
+class TestEditVerseForm(TestCase, TestMixin):
+ """
+ Test the functions in the :mod:`lib` module.
+ """
+ def setUp(self):
+ """
+ Set up the components need for all tests.
+ """
+ self.edit_verse_form = EditVerseForm(None)
+ self.setup_application()
+ self.build_settings()
+ QtCore.QLocale.setDefault(QtCore.QLocale('en_GB'))
+
+ def tearDown(self):
+ """
+ Delete all the C++ objects at the end so that we don't have a segfault
+ """
+ self.destroy_settings()
+
+ def update_suggested_verse_number_test(self):
+ """
+ Test that update_suggested_verse_number() has no effect when editing a single verse
+ """
+ # GIVEN some input values
+ self.edit_verse_form.has_single_verse = True
+ self.edit_verse_form.verse_type_combo_box.currentIndex = MagicMock(return_value = 0)
+ self.edit_verse_form.verse_text_edit.toPlainText = MagicMock(return_value = 'Text')
+ self.edit_verse_form.verse_number_box.setValue(3)
+
+ # WHEN the method is called
+ self.edit_verse_form.update_suggested_verse_number()
+
+ # THEN the verse number must not be changed
+ self.assertEqual(3, self.edit_verse_form.verse_number_box.value(), 'The verse number should be 3')
Follow ups