A few beta1 fixes

This commit is contained in:
Tomas Groth 2021-02-10 07:51:16 +00:00 committed by Tim Bentley
parent b0d8d6fd85
commit 520362a469
4 changed files with 22 additions and 8 deletions

View File

@ -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()

View File

@ -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()

View File

@ -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:

View File

@ -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):