diff --git a/openlp/plugins/presentations/lib/powerpointmaccontroller.py b/openlp/plugins/presentations/lib/powerpointmaccontroller.py index 0e4ac2450..6de91123c 100644 --- a/openlp/plugins/presentations/lib/powerpointmaccontroller.py +++ b/openlp/plugins/presentations/lib/powerpointmaccontroller.py @@ -345,8 +345,8 @@ class PowerPointMacDocument(AppleScriptBaseDocument): # keep aspect ratio scale = min(640 / src_size.width, 480 / src_size.height) m = fitz.Matrix(scale, scale) - page.getPixmap(m, alpha=False).writeImage(str(self.get_thumbnail_folder() / - 'slide{num}.png'.format(num=i))) + page.getPixmap(matrix=m, alpha=False).writeImage(str(self.get_thumbnail_folder() / + 'slide{num}.png'.format(num=i))) pdf.close() # delete pdf pdf_file.unlink() diff --git a/openlp/plugins/songs/lib/importers/openlyrics.py b/openlp/plugins/songs/lib/importers/openlyrics.py index 9b78e5e2a..0a3f8dacf 100644 --- a/openlp/plugins/songs/lib/importers/openlyrics.py +++ b/openlp/plugins/songs/lib/importers/openlyrics.py @@ -66,7 +66,7 @@ class OpenLyricsImport(SongImport): root = parsed_file.getroot() for elem in root.iter('{*}lines'): self._strip_whitespace(elem) - for subelem in elem.iter('*'): + for subelem in elem.iter('{*}br'): self._strip_whitespace(subelem) xml = etree.tostring(root).decode() diff --git a/openlp/plugins/songs/lib/openlyricsxml.py b/openlp/plugins/songs/lib/openlyricsxml.py index f62999f52..0230b710c 100644 --- a/openlp/plugins/songs/lib/openlyricsxml.py +++ b/openlp/plugins/songs/lib/openlyricsxml.py @@ -649,7 +649,7 @@ class OpenLyrics(object): text += '{{{name}}}'.format(name=element.get('name')) # Some formattings may have only start tag. # Handle this case if element has no children and contains no text. - if not element and not element.text: + if element is None and element.text is None: use_endtag = False # Append text from element. if element.text: diff --git a/tests/functional/openlp_core/display/test_window.py b/tests/functional/openlp_core/display/test_window.py index f77d14925..5c10c9181 100644 --- a/tests/functional/openlp_core/display/test_window.py +++ b/tests/functional/openlp_core/display/test_window.py @@ -34,6 +34,7 @@ from PyQt5 import QtCore sys.modules['PyQt5.QtWebEngineWidgets'] = MagicMock() from openlp.core.display.window import DisplayWindow, DisplayWatcher +from openlp.core.common import is_win from openlp.core.common.enum import ServiceItemType from openlp.core.lib.theme import Theme from openlp.core.ui import HideMode @@ -132,10 +133,17 @@ def test_set_startup_screen(display_window_env, mock_settings): display_window = DisplayWindow() display_window._is_initialised = True display_window.run_javascript = MagicMock() + + if is_win(): + image_path = 'c:/my/image.png' + expect_image_path = '/' + image_path + else: + image_path = '/my/image.png' + expect_image_path = image_path display_window.openlp_splash_screen_path = Path('/default/splash_screen.png') settings = { 'core/logo background color': 'red', - 'core/logo file': Path('/my/image.png'), + 'core/logo file': Path(image_path), 'core/logo hide on startup': False } mock_settings.value.side_effect = lambda key: settings[key] @@ -145,7 +153,7 @@ def test_set_startup_screen(display_window_env, mock_settings): # THEN: javascript should be run display_window.run_javascript.assert_called_once_with( - 'Display.setStartupSplashScreen("red", "file:///my/image.png");') + 'Display.setStartupSplashScreen("red", "file://{path}");'.format(path=expect_image_path)) def test_set_startup_screen_default_image(display_window_env, mock_settings): @@ -156,7 +164,13 @@ def test_set_startup_screen_default_image(display_window_env, mock_settings): display_window = DisplayWindow() display_window._is_initialised = True display_window.run_javascript = MagicMock() - display_window.openlp_splash_screen_path = Path('/default/splash_screen.png') + if is_win(): + splash_screen_path = 'c:/default/splash_screen.png' + expect_splash_screen_path = '/' + splash_screen_path + else: + splash_screen_path = '/default/splash_screen.png' + expect_splash_screen_path = splash_screen_path + display_window.openlp_splash_screen_path = Path(splash_screen_path) settings = { 'core/logo background color': 'blue', 'core/logo file': Path(':/graphics/openlp-splash-screen.png'), @@ -169,7 +183,7 @@ def test_set_startup_screen_default_image(display_window_env, mock_settings): # THEN: javascript should be run display_window.run_javascript.assert_called_with( - 'Display.setStartupSplashScreen("blue", "file:///default/splash_screen.png");') + 'Display.setStartupSplashScreen("blue", "file://{path}");'.format(path=expect_splash_screen_path)) def test_set_startup_screen_missing(display_window_env, mock_settings):