← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~trb143/openlp/gen1 into lp:openlp

 

Tim Bentley has proposed merging lp:~trb143/openlp/gen1 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~trb143/openlp/gen1/+merge/222228

Fix a validation bug with presentations being loaded from services
Fix range bug stopping service items being triggered unless it was the first!
-- 
https://code.launchpad.net/~trb143/openlp/gen1/+merge/222228
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/gen1 into lp:openlp.
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2014-04-19 05:29:00 +0000
+++ openlp/core/ui/servicemanager.py	2014-06-05 16:29:20 +0000
@@ -401,9 +401,12 @@
 
         :param suffix_list: New Suffix's to be supported
         """
-        for suffix in suffix_list:
-            if suffix not in self.suffixes:
-                self.suffixes.append(suffix)
+        if isinstance(suffix_list, str):
+            self.suffixes.append(suffix_list)
+        else:
+            for suffix in suffix_list:
+                if suffix not in self.suffixes:
+                    self.suffixes.append(suffix)
 
     def on_new_service_clicked(self, field=None):
         """
@@ -1081,6 +1084,7 @@
         :param field:
         :param message: The data passed in from a remove message
         """
+        self.log_debug(message)
         self.set_item(int(message))
 
     def set_item(self, index):
@@ -1089,7 +1093,7 @@
 
         :param index: The index of the service item list to be actioned.
         """
-        if 0 >= index < self.service_manager_list.topLevelItemCount():
+        if 0 <= index < self.service_manager_list.topLevelItemCount():
             item = self.service_manager_list.topLevelItem(index)
             self.service_manager_list.setCurrentItem(item)
             self.make_live()

=== modified file 'tests/functional/openlp_core_ui/test_servicemanager.py'
--- tests/functional/openlp_core_ui/test_servicemanager.py	2014-04-02 19:35:09 +0000
+++ tests/functional/openlp_core_ui/test_servicemanager.py	2014-06-05 16:29:20 +0000
@@ -71,7 +71,21 @@
         service_manager._save_lite = False
         service_manager.service_theme = 'test_theme'
         service = service_manager.create_basic_service()[0]
-        # THEN: The the controller should be registered in the registry.
+        # THEN: The controller should be registered in the registry.
         self.assertNotEqual(service, None, 'The base service should be created')
         self.assertEqual(service['openlp_core']['service-theme'], 'test_theme', 'The test theme should be saved')
         self.assertEqual(service['openlp_core']['lite-service'], False, 'The lite service should be saved')
+
+    def supported_suffixes_test(self):
+        """
+        Test the create basic service array
+        """
+        # GIVEN: A new service manager instance.
+        service_manager = ServiceManager(None)
+        # WHEN: a suffix is added.
+        service_manager.supported_suffixes('txt')
+        service_manager.supported_suffixes(['pptx', 'ppt'])
+        # THEN: The the controller should be registered in the registry.
+        self.assertEqual('txt' in service_manager.suffixes, True, 'The suffix txt should be in the list')
+        self.assertEqual('ppt' in service_manager.suffixes, True, 'The suffix ppt should be in the list')
+        self.assertEqual('pptx' in service_manager.suffixes, True, 'The suffix pptx should be in the list')