Merge lp:~sam92/openlp/bug-1537212 into lp:openlp

Proposed by Samuel Mehrbrodt
Status: Merged
Approved by: Tim Bentley
Approved revision: 2611
Merged at revision: 2612
Proposed branch: lp:~sam92/openlp/bug-1537212
Merge into: lp:openlp
Diff against target: 61 lines (+28/-1)
2 files modified
openlp/plugins/songs/forms/editsongform.py (+2/-1)
tests/functional/openlp_plugins/songs/test_openlyricsimport.py (+26/-0)
To merge this branch: bzr merge lp:~sam92/openlp/bug-1537212
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Raoul Snyman Approve
Review via email: mp+284516@code.launchpad.net

Description of the change

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

To post a comment you must log in.
Revision history for this message
Raoul Snyman (raoul-snyman) :
review: Approve
Revision history for this message
Tim Bentley (trb143) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/plugins/songs/forms/editsongform.py'
2--- openlp/plugins/songs/forms/editsongform.py 2016-01-22 21:30:26 +0000
3+++ openlp/plugins/songs/forms/editsongform.py 2016-01-30 14:20:14 +0000
4@@ -324,7 +324,7 @@
5 if self.topics_combo_box.hasFocus() and self.topics_combo_box.currentText():
6 self.on_topic_add_button_clicked()
7 return
8- if self.songbooks_combo_box.hasFocus() and self.songbooks_combo_box.currentText():
9+ if self.songbooks_combo_box.hasFocus() or self.songbook_entry_edit.hasFocus():
10 self.on_songbook_add_button_clicked()
11 return
12 QtWidgets.QDialog.keyPressEvent(self, event)
13@@ -514,6 +514,7 @@
14 topic_name.setData(QtCore.Qt.UserRole, topic.id)
15 self.topics_list_view.addItem(topic_name)
16 self.songbooks_list_view.clear()
17+ self.songbook_entry_edit.clear()
18 for songbook_entry in self.song.songbook_entries:
19 self.add_songbook_entry_to_list(songbook_entry.songbook.id, songbook_entry.songbook.name,
20 songbook_entry.entry)
21
22=== modified file 'tests/functional/openlp_plugins/songs/test_openlyricsimport.py'
23--- tests/functional/openlp_plugins/songs/test_openlyricsimport.py 2015-12-31 22:46:06 +0000
24+++ tests/functional/openlp_plugins/songs/test_openlyricsimport.py 2016-01-30 14:20:14 +0000
25@@ -74,6 +74,13 @@
26 </authors>\
27 </properties>'
28
29+songbook_xml = '<properties>\
30+ <songbooks>\
31+ <songbook name="Collection 1" entry="48"/>\
32+ <songbook name="Collection 2" entry="445 A"/>\
33+ </songbooks>\
34+ </properties>'
35+
36
37 class TestOpenLyricsImport(TestCase, TestMixin):
38 """
39@@ -166,3 +173,22 @@
40 # THEN: add_author should have been called twice
41 self.assertEquals(mocked_song.method_calls[0][1][1], 'words+music')
42 self.assertEquals(mocked_song.method_calls[1][1][1], 'words')
43+
44+ def process_songbooks_test(self):
45+ """
46+ Test that _process_songbooks works
47+ """
48+ # GIVEN: A OpenLyric XML with songbooks and a mocked out manager
49+ with patch('openlp.plugins.songs.lib.openlyricsxml.Book'):
50+ mocked_manager = MagicMock()
51+ mocked_manager.get_object_filtered.return_value = None
52+ ol = OpenLyrics(mocked_manager)
53+ properties_xml = objectify.fromstring(songbook_xml)
54+ mocked_song = MagicMock()
55+
56+ # WHEN: processing the songbook xml
57+ ol._process_songbooks(properties_xml, mocked_song)
58+
59+ # THEN: add_songbook_entry should have been called twice
60+ self.assertEquals(mocked_song.method_calls[0][1][1], '48')
61+ self.assertEquals(mocked_song.method_calls[1][1][1], '445 A')