openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #20768
[Merge] lp:~googol/openlp/bug-1170435 into lp:openlp
Andreas Preikschat has proposed merging lp:~googol/openlp/bug-1170435 into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Related bugs:
Bug #1170435 in OpenLP: "We should not warn when verse order is empty"
https://bugs.launchpad.net/openlp/+bug/1170435
For more details, see:
https://code.launchpad.net/~googol/openlp/bug-1170435/+merge/169700
Hello,
- fixes bug #1170435 (We should not warn when verse order is empty)
--
https://code.launchpad.net/~googol/openlp/bug-1170435/+merge/169700
Your team OpenLP Core is requested to review the proposed merge of lp:~googol/openlp/bug-1170435 into lp:openlp.
=== modified file 'openlp/plugins/songs/forms/editsongdialog.py'
--- openlp/plugins/songs/forms/editsongdialog.py 2013-03-08 08:14:39 +0000
+++ openlp/plugins/songs/forms/editsongdialog.py 2013-06-16 17:30:36 +0000
@@ -275,7 +275,6 @@
self.bottom_layout.setObjectName(u'bottom_layout')
self.warning_label = QtGui.QLabel(edit_song_dialog)
self.warning_label.setObjectName(u'warning_label')
- self.warning_label.setVisible(False)
self.bottom_layout.addWidget(self.warning_label)
self.button_box = create_button_box(edit_song_dialog, u'button_box', [u'cancel', u'save'])
self.bottom_layout.addWidget(self.button_box)
@@ -323,8 +322,10 @@
self.from_media_button.setText(translate('SongsPlugin.EditSongForm', 'Add &Media'))
self.audio_remove_button.setText(translate('SongsPlugin.EditSongForm', '&Remove'))
self.audio_remove_all_button.setText(translate('SongsPlugin.EditSongForm', 'Remove &All'))
- self.warning_label.setText(
- translate('SongsPlugin.EditSongForm', '<strong>Warning:</strong> Not all of the verses are in use.'))
+ self.not_all_verses_used_warning = \
+ translate('SongsPlugin.EditSongForm', '<strong>Warning:</strong> Not all of the verses are in use.')
+ self.no_verse_order_entered_warning = \
+ translate('SongsPlugin.EditSongForm', '<strong>Warning:</strong> You have not entered a verse order.')
def create_combo_box(parent, name):
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py 2013-04-20 20:34:46 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2013-06-16 17:30:36 +0000
@@ -456,6 +456,8 @@
self.title_edit.setFocus()
# Hide or show the preview button.
self.preview_button.setVisible(preview)
+ # Check if all verse tags are used.
+ self.on_verse_order_text_changed(self.verse_order_edit.text())
def tag_rows(self):
"""
@@ -697,7 +699,12 @@
for verse in verses:
if not verse in order:
verses_not_used.append(verse)
- self.warning_label.setVisible(len(verses_not_used) > 0)
+ label_text = u''
+ if not self.verse_order_edit.text():
+ label_text = self.no_verse_order_entered_warning
+ elif verses_not_used:
+ label_text = self.not_all_verses_used_warning
+ self.warning_label.setText(label_text)
def on_copyright_insert_button_triggered(self):
text = self.copyright_edit.text()
=== modified file 'tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py'
--- tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py 2013-03-29 06:25:01 +0000
+++ tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py 2013-06-16 17:30:36 +0000
@@ -34,7 +34,7 @@
del self.main_window
del self.app
- def ui_defaults_test(self):
+ def ui_defaults_(self):
"""
Test that the EditSongForm defaults are correct
"""
@@ -43,5 +43,58 @@
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
+ def is_verse_edit_form_executed_t(self):
+ pass
+
+ def verse_order_warning_hidden_test(self):
+ """
+ Test if the verse order warning lable is visible, when a verse order is specified
+ """
+ # GIVEN: Mocked methods.
+ mocked_row_count = MagicMock()
+ mocked_row_count.return_value = 1
+ self.form.verse_list_widget.rowCount = mocked_row_count
+ # Mock out the verse.
+ mocked_verse = MagicMock()
+ self.form.verse_list_widget.item = mocked_verse
+ mocked_verse_data_method = MagicMock()
+ mocked_verse_data_method.return_value = u'V1'
+ mocked_verse.data = mocked_verse_data_method
+ mocked_item_method = MagicMock()
+ mocked_item_method.return_value = mocked_verse
+ mocked_extract_verse_order_method = MagicMock()
+ mocked_extract_verse_order_method.return_value = [u'V1']
+ self.form._extract_verse_order = mocked_extract_verse_order_method
+
+ # WHEN: Call the method.
+ self.form.on_verse_order_text_changed(u'V1')
+
+ # THEN: The warning lable should be hidden.
+ assert not self.form.warning_label.isVisible(), u'The warning lable should be hidden.'
+
+ def bug_1170435_test(self):
+ """
+ Regression test for bug 1170435 (test if lable hidden, when no verse order is specified)
+ """
+ # GIVEN: Mocked methods.
+ mocked_row_count = MagicMock()
+ mocked_row_count.return_value = 0
+ self.form.verse_list_widget.rowCount = mocked_row_count
+ # Mock out the verse. (We want a verse type to be returned).
+ mocked_verse = MagicMock()
+ self.form.verse_list_widget.item = mocked_verse
+ mocked_verse_data_method = MagicMock()
+ mocked_verse_data_method.return_value = u'V1'
+ mocked_verse.data = mocked_verse_data_method
+ mocked_item_method = MagicMock()
+ mocked_item_method.return_value = mocked_verse
+ mocked_extract_verse_order_method = MagicMock()
+ mocked_extract_verse_order_method.return_value = []
+ self.form._extract_verse_order = mocked_extract_verse_order_method
+
+ # WHEN: Call the method.
+ self.form.on_verse_order_text_changed(u'')
+
+ # THEN: The warning lable should be hidden.
+ assert not self.form.warning_label.isVisible(), \
+ u'The lable should be visible because the verse order was left empty.'
Follow ups