openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #28536
[Merge] lp:~sam92/openlp/bug-1537212 into lp:openlp
Samuel Mehrbrodt has proposed merging lp:~sam92/openlp/bug-1537212 into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Related bugs:
Bug #1537212 in OpenLP: "Song book number input box - not clearing and unexpected 'Enter' action"
https://bugs.launchpad.net/openlp/+bug/1537212
For more details, see:
https://code.launchpad.net/~sam92/openlp/bug-1537212/+merge/284516
Fix entering Songbooks with keyboard
Also clear songbook entry field when editing another song
lp:~sam92/openlp/bug-1537212 (revision 2611)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/1273/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/1197/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1136/
[FAILURE] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/972/
Stopping after failure
--
Your team OpenLP Core is requested to review the proposed merge of lp:~sam92/openlp/bug-1537212 into lp:openlp.
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py 2016-01-22 21:30:26 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2016-01-30 14:20:14 +0000
@@ -324,7 +324,7 @@
if self.topics_combo_box.hasFocus() and self.topics_combo_box.currentText():
self.on_topic_add_button_clicked()
return
- if self.songbooks_combo_box.hasFocus() and self.songbooks_combo_box.currentText():
+ if self.songbooks_combo_box.hasFocus() or self.songbook_entry_edit.hasFocus():
self.on_songbook_add_button_clicked()
return
QtWidgets.QDialog.keyPressEvent(self, event)
@@ -514,6 +514,7 @@
topic_name.setData(QtCore.Qt.UserRole, topic.id)
self.topics_list_view.addItem(topic_name)
self.songbooks_list_view.clear()
+ self.songbook_entry_edit.clear()
for songbook_entry in self.song.songbook_entries:
self.add_songbook_entry_to_list(songbook_entry.songbook.id, songbook_entry.songbook.name,
songbook_entry.entry)
=== modified file 'tests/functional/openlp_plugins/songs/test_openlyricsimport.py'
--- tests/functional/openlp_plugins/songs/test_openlyricsimport.py 2015-12-31 22:46:06 +0000
+++ tests/functional/openlp_plugins/songs/test_openlyricsimport.py 2016-01-30 14:20:14 +0000
@@ -74,6 +74,13 @@
</authors>\
</properties>'
+songbook_xml = '<properties>\
+ <songbooks>\
+ <songbook name="Collection 1" entry="48"/>\
+ <songbook name="Collection 2" entry="445 A"/>\
+ </songbooks>\
+ </properties>'
+
class TestOpenLyricsImport(TestCase, TestMixin):
"""
@@ -166,3 +173,22 @@
# THEN: add_author should have been called twice
self.assertEquals(mocked_song.method_calls[0][1][1], 'words+music')
self.assertEquals(mocked_song.method_calls[1][1][1], 'words')
+
+ def process_songbooks_test(self):
+ """
+ Test that _process_songbooks works
+ """
+ # GIVEN: A OpenLyric XML with songbooks and a mocked out manager
+ with patch('openlp.plugins.songs.lib.openlyricsxml.Book'):
+ mocked_manager = MagicMock()
+ mocked_manager.get_object_filtered.return_value = None
+ ol = OpenLyrics(mocked_manager)
+ properties_xml = objectify.fromstring(songbook_xml)
+ mocked_song = MagicMock()
+
+ # WHEN: processing the songbook xml
+ ol._process_songbooks(properties_xml, mocked_song)
+
+ # THEN: add_songbook_entry should have been called twice
+ self.assertEquals(mocked_song.method_calls[0][1][1], '48')
+ self.assertEquals(mocked_song.method_calls[1][1][1], '445 A')
Follow ups