Merge branch 'beta1-fixes' into 'master'

A few beta1 fixes

Closes #760

See merge request openlp/openlp!302
This commit is contained in:
Tim Bentley 2021-02-10 07:51:16 +00:00
commit 0060001b8f
4 changed files with 22 additions and 8 deletions

View File

@ -345,8 +345,8 @@ class PowerPointMacDocument(AppleScriptBaseDocument):
# keep aspect ratio # keep aspect ratio
scale = min(640 / src_size.width, 480 / src_size.height) scale = min(640 / src_size.width, 480 / src_size.height)
m = fitz.Matrix(scale, scale) m = fitz.Matrix(scale, scale)
page.getPixmap(m, alpha=False).writeImage(str(self.get_thumbnail_folder() / page.getPixmap(matrix=m, alpha=False).writeImage(str(self.get_thumbnail_folder() /
'slide{num}.png'.format(num=i))) 'slide{num}.png'.format(num=i)))
pdf.close() pdf.close()
# delete pdf # delete pdf
pdf_file.unlink() pdf_file.unlink()

View File

@ -66,7 +66,7 @@ class OpenLyricsImport(SongImport):
root = parsed_file.getroot() root = parsed_file.getroot()
for elem in root.iter('{*}lines'): for elem in root.iter('{*}lines'):
self._strip_whitespace(elem) self._strip_whitespace(elem)
for subelem in elem.iter('*'): for subelem in elem.iter('{*}br'):
self._strip_whitespace(subelem) self._strip_whitespace(subelem)
xml = etree.tostring(root).decode() xml = etree.tostring(root).decode()

View File

@ -649,7 +649,7 @@ class OpenLyrics(object):
text += '{{{name}}}'.format(name=element.get('name')) text += '{{{name}}}'.format(name=element.get('name'))
# Some formattings may have only start tag. # Some formattings may have only start tag.
# Handle this case if element has no children and contains no text. # 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 use_endtag = False
# Append text from element. # Append text from element.
if element.text: if element.text:

View File

@ -34,6 +34,7 @@ from PyQt5 import QtCore
sys.modules['PyQt5.QtWebEngineWidgets'] = MagicMock() sys.modules['PyQt5.QtWebEngineWidgets'] = MagicMock()
from openlp.core.display.window import DisplayWindow, DisplayWatcher 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.common.enum import ServiceItemType
from openlp.core.lib.theme import Theme from openlp.core.lib.theme import Theme
from openlp.core.ui import HideMode 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 = DisplayWindow()
display_window._is_initialised = True display_window._is_initialised = True
display_window.run_javascript = MagicMock() 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') display_window.openlp_splash_screen_path = Path('/default/splash_screen.png')
settings = { settings = {
'core/logo background color': 'red', 'core/logo background color': 'red',
'core/logo file': Path('/my/image.png'), 'core/logo file': Path(image_path),
'core/logo hide on startup': False 'core/logo hide on startup': False
} }
mock_settings.value.side_effect = lambda key: settings[key] 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 # THEN: javascript should be run
display_window.run_javascript.assert_called_once_with( 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): 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 = DisplayWindow()
display_window._is_initialised = True display_window._is_initialised = True
display_window.run_javascript = MagicMock() 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 = { settings = {
'core/logo background color': 'blue', 'core/logo background color': 'blue',
'core/logo file': Path(':/graphics/openlp-splash-screen.png'), '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 # THEN: javascript should be run
display_window.run_javascript.assert_called_with( 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): def test_set_startup_screen_missing(display_window_env, mock_settings):