← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~sam92/openlp/bug-1313538 into lp:openlp

 

Samuel Mehrbrodt has proposed merging lp:~sam92/openlp/bug-1313538 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1313538 in OpenLP: "Song duplicates added when using different author types for the same author"
  https://bugs.launchpad.net/openlp/+bug/1313538

For more details, see:
https://code.launchpad.net/~sam92/openlp/bug-1313538/+merge/218602

Song duplicates added when using different author types for the same author

lp:~sam92/openlp/bug-1313538 (revision 2377)
[SUCCESS] http://ci.openlp.org/job/Branch-01-Pull/436/
[SUCCESS] http://ci.openlp.org/job/Branch-02-Functional-Tests/392/
[SUCCESS] http://ci.openlp.org/job/Branch-03-Interface-Tests/337/
[SUCCESS] http://ci.openlp.org/job/Branch-04-Windows_Tests/298/
[SUCCESS] http://ci.openlp.org/job/Branch-05a-Code_Analysis/201/
[SUCCESS] http://ci.openlp.org/job/Branch-05b-Test_Coverage/76/
-- 
https://code.launchpad.net/~sam92/openlp/bug-1313538/+merge/218602
Your team OpenLP Core is requested to review the proposed merge of lp:~sam92/openlp/bug-1313538 into lp:openlp.
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py	2014-05-01 17:06:47 +0000
+++ openlp/plugins/songs/lib/mediaitem.py	2014-05-07 12:11:19 +0000
@@ -524,15 +524,15 @@
         add_song = True
         if search_results:
             for song in search_results:
-                author_list = item.data_string['authors']
+                author_list = item.data_string['authors'].split(', ')
                 same_authors = True
                 for author in song.authors:
                     if author.display_name in author_list:
-                        author_list = author_list.replace(author.display_name, '', 1)
+                        author_list = author_list.remove(author.display_name)
                     else:
                         same_authors = False
                         break
-                if same_authors and author_list.strip(', ') == '':
+                if same_authors and not author_list:
                     add_song = False
                     edit_id = song.id
                     break

=== modified file 'tests/functional/openlp_core_lib/test_ui.py'
--- tests/functional/openlp_core_lib/test_ui.py	2014-04-20 20:19:21 +0000
+++ tests/functional/openlp_core_lib/test_ui.py	2014-05-07 12:11:19 +0000
@@ -146,6 +146,20 @@
         self.assertEqual('combo1', combo.objectName())
         self.assertEqual(QtGui.QComboBox.AdjustToMinimumContentsLength, combo.sizeAdjustPolicy())
 
+    def test_create_widget_action(self):
+        """
+        Test creating an action for a widget
+        """
+        # GIVEN: A button
+        button = QtGui.QPushButton()
+
+        # WHEN: We call the function
+        action = create_widget_action(button, 'some action')
+
+        # THEN: The action should be returned
+        self.assertIsInstance(action, QtGui.QAction)
+        self.assertEqual(action.objectName(), 'some action')
+
     def test_create_action(self):
         """
         Test creating an action


Follow ups