diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index b8c1e0d6f..dc3fb58b5 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -169,7 +169,7 @@ class SongsPlugin(Plugin): triggers=self.on_tools_find_duplicates_triggered, can_shortcuts=True) self.tools_report_song_list = create_action( tools_menu, 'ReportSongList', - text=translate('SongsPlugin', 'Export List on Songs'), + text=translate('SongsPlugin', 'Export List of Songs'), statustip=translate('SongsPlugin', 'Produce a CSV file of all the songs in the database.'), triggers=self.on_tools_report_song_list_triggered) @@ -345,13 +345,13 @@ class SongsPlugin(Plugin): self.manager.finalise() self.song_import_item.setVisible(False) self.song_export_item.setVisible(False) - self.tools_reindex_item.setVisible(False) - self.tools_find_duplicates.setVisible(False) action_list = ActionList.get_instance() action_list.remove_action(self.song_import_item, UiStrings().Import) action_list.remove_action(self.song_export_item, UiStrings().Export) action_list.remove_action(self.tools_reindex_item, UiStrings().Tools) action_list.remove_action(self.tools_find_duplicates, UiStrings().Tools) + action_list.add_action(self.tools_report_song_list, UiStrings().Tools) + self.song_tools_menu.menuAction().setVisible(False) super(SongsPlugin, self).finalise() def new_service_created(self): diff --git a/tests/functional/openlp_core_ui/test_servicemanager.py b/tests/functional/openlp_core_ui/test_servicemanager.py index 3e4af8c97..9b80134f9 100644 --- a/tests/functional/openlp_core_ui/test_servicemanager.py +++ b/tests/functional/openlp_core_ui/test_servicemanager.py @@ -28,6 +28,7 @@ from unittest import TestCase import PyQt5 from openlp.core.common import Registry, ThemeLevel +from openlp.core.ui.lib.toolbar import OpenLPToolbar from openlp.core.lib import ServiceItem, ServiceItemType, ItemCapabilities from openlp.core.ui import ServiceManager @@ -679,3 +680,72 @@ class TestServiceManager(TestCase): # THEN: The "save_as" method is called to save the service self.assertTrue(result) mocked_save_file_as.assert_called_with() + + @patch(u'openlp.core.ui.servicemanager.ServiceManager.regenerate_service_items') + def test_theme_change_global(self, mocked_regenerate_service_items): + """ + Test that when a Toolbar theme combobox displays correctly + """ + + # GIVEN: A service manager, a service to save with a theme level of the renderer + mocked_renderer = MagicMock() + service_manager = ServiceManager(None) + Registry().register('renderer', mocked_renderer) + service_manager.toolbar = OpenLPToolbar(None) + service_manager.toolbar.add_toolbar_action('theme_combo_box', triggers=MagicMock()) + service_manager.toolbar.add_toolbar_action('theme_label', triggers=MagicMock()) + + # WHEN: The service manager has a Global theme + mocked_renderer.theme_level = ThemeLevel.Global + result = service_manager.theme_change() + + # THEN: The the theme toolbar should not be visible + + self.assertFalse(service_manager.toolbar.actions['theme_combo_box'].isVisible(), + 'The visibility should be False') + + @patch(u'openlp.core.ui.servicemanager.ServiceManager.regenerate_service_items') + def test_theme_change_service(self, mocked_regenerate_service_items): + """ + Test that when a Toolbar theme combobox displays correctly + """ + + # GIVEN: A service manager, a service to save with a theme level of the renderer + mocked_renderer = MagicMock() + service_manager = ServiceManager(None) + Registry().register('renderer', mocked_renderer) + service_manager.toolbar = OpenLPToolbar(None) + service_manager.toolbar.add_toolbar_action('theme_combo_box', triggers=MagicMock()) + service_manager.toolbar.add_toolbar_action('theme_label', triggers=MagicMock()) + + # WHEN: The service manager has a Global theme + mocked_renderer.theme_level = ThemeLevel.Service + result = service_manager.theme_change() + + # THEN: The the theme toolbar should not be visible + + self.assertTrue(service_manager.toolbar.actions['theme_combo_box'].isVisible(), + 'The visibility should be True') + + @patch(u'openlp.core.ui.servicemanager.ServiceManager.regenerate_service_items') + def test_theme_change_song(self, mocked_regenerate_service_items): + """ + Test that when a Toolbar theme combobox displays correctly + """ + + # GIVEN: A service manager, a service to save with a theme level of the renderer + mocked_renderer = MagicMock() + service_manager = ServiceManager(None) + Registry().register('renderer', mocked_renderer) + service_manager.toolbar = OpenLPToolbar(None) + service_manager.toolbar.add_toolbar_action('theme_combo_box', triggers=MagicMock()) + service_manager.toolbar.add_toolbar_action('theme_label', triggers=MagicMock()) + + # WHEN: The service manager has a Global theme + mocked_renderer.theme_level = ThemeLevel.Song + result = service_manager.theme_change() + + # THEN: The the theme toolbar should not be visible + + self.assertTrue(service_manager.toolbar.actions['theme_combo_box'].isVisible(), + 'The visibility should be True')