Small fixes

This commit is contained in:
Tomas Groth 2014-09-08 22:48:49 +01:00
parent dab4ad7080
commit 3769a01682
4 changed files with 18 additions and 13 deletions

View File

@ -505,7 +505,7 @@ class HttpRouter(RegistryProperties):
item['text'] = str(frame['text'])
item['html'] = str(frame['html'])
# Handle images, unless a custom thumbnail is given or if thumbnails is disabled
elif current_item.is_image() and not frame['image'] and Settings().value('remotes/thumbnails'):
elif current_item.is_image() and not frame.get('image', None) and Settings().value('remotes/thumbnails'):
item['tag'] = str(index + 1)
thumbnail_path = os.path.sep + os.path.join('images', 'thumbnails', frame['title'])
item['img'] = urllib.request.pathname2url(thumbnail_path)

View File

@ -180,7 +180,8 @@ class RemoteTab(SettingsTab):
self.stage_url_label.setText(translate('RemotePlugin.RemoteTab', 'Stage view URL:'))
self.live_url_label.setText(translate('RemotePlugin.RemoteTab', 'Live view URL:'))
self.twelve_hour_check_box.setText(translate('RemotePlugin.RemoteTab', 'Display stage time in 12h format'))
self.thumbnails_check_box.setText(translate('RemotePlugin.RemoteTab', 'Show thumbnails of non-text slides in remote and stage view.'))
self.thumbnails_check_box.setText(translate('RemotePlugin.RemoteTab',
'Show thumbnails of non-text slides in remote and stage view.'))
self.android_app_group_box.setTitle(translate('RemotePlugin.RemoteTab', 'Android App'))
self.qr_description_label.setText(
translate('RemotePlugin.RemoteTab', 'Scan the QR code or click <a href="https://play.google.com/store/'

View File

@ -30,8 +30,6 @@
Functional tests to test the PowerPointController class and related methods.
"""
import os
if os.name == 'nt':
import pywintypes
import shutil
from unittest import TestCase
from tempfile import mkdtemp
@ -42,6 +40,10 @@ from tests.utils.constants import TEST_RESOURCES_PATH
from openlp.plugins.presentations.lib.powerpointcontroller import PowerpointController, PowerpointDocument,\
_get_text_from_shapes
from openlp.core.common import is_win
if is_win():
import pywintypes
class TestPowerpointController(TestCase, TestMixin):
@ -124,7 +126,7 @@ class TestPowerpointDocument(TestCase, TestMixin):
"""
Test the PowerpointDocument.show_error_msg() method gets called on com exception
"""
if os.name == 'nt':
if is_win():
# GIVEN: A PowerpointDocument with mocked controller and presentation
with patch('openlp.plugins.presentations.lib.powerpointcontroller.critical_error_message_box') as \
mocked_critical_error_message_box:
@ -146,7 +148,7 @@ class TestPowerpointDocument(TestCase, TestMixin):
"""
Test loading a document in PowerPoint
"""
if os.name == 'nt' and self.real_controller.check_available():
if is_win() and self.real_controller.check_available():
# GIVEN: A PowerpointDocument and a presentation
doc = PowerpointDocument(self.real_controller, self.file_name)
@ -163,7 +165,7 @@ class TestPowerpointDocument(TestCase, TestMixin):
"""
Test creating the titles from PowerPoint
"""
if os.name == 'nt' and self.real_controller.check_available():
if is_win() and self.real_controller.check_available():
# GIVEN: mocked save_titles_and_notes, _get_text_from_shapes and two mocked slides
self.doc = PowerpointDocument(self.real_controller, self.file_name)
self.doc.save_titles_and_notes = MagicMock()
@ -186,7 +188,7 @@ class TestPowerpointDocument(TestCase, TestMixin):
"""
Test creating the titles from PowerPoint when it returns no slides
"""
if os.name == 'nt' and self.real_controller.check_available():
if is_win() and self.real_controller.check_available():
# GIVEN: mocked save_titles_and_notes, _get_text_from_shapes and two mocked slides
doc = PowerpointDocument(self.real_controller, self.file_name)
doc.save_titles_and_notes = MagicMock()

View File

@ -31,8 +31,6 @@ This module contains tests for the pptviewcontroller module of the Presentations
"""
import os
import shutil
if os.name == 'nt':
from ctypes import cdll
from tempfile import mkdtemp
from unittest import TestCase
@ -42,6 +40,10 @@ from tests.helpers.testmixin import TestMixin
from tests.utils.constants import TEST_RESOURCES_PATH
from openlp.plugins.presentations.lib.pptviewcontroller import PptviewDocument, PptviewController
from openlp.core.common import is_win
if is_win():
from ctypes import cdll
class TestPptviewController(TestCase, TestMixin):
@ -99,7 +101,7 @@ class TestPptviewController(TestCase, TestMixin):
available = controller.check_available()
# THEN: On windows it should return True, on other platforms False
if os.name == 'nt':
if is_win():
self.assertTrue(available, 'check_available should return True on windows.')
else:
self.assertFalse(available, 'check_available should return False when not on windows.')
@ -180,7 +182,7 @@ class TestPptviewDocument(TestCase):
instance = PptviewDocument(self.mock_controller, self.mock_presentation)
instance.file_path = 'test\path.ppt'
if os.name == 'nt':
if is_win():
result = instance.load_presentation()
# THEN: PptviewDocument.load_presentation should return True
@ -200,7 +202,7 @@ class TestPptviewDocument(TestCase):
self.mock_controller.process.OpenPPT.return_value = -1
instance = PptviewDocument(self.mock_controller, self.mock_presentation)
instance.file_path = 'test\path.ppt'
if os.name == 'nt':
if is_win():
result = instance.load_presentation()
# THEN: The temp folder should be created and PptviewDocument.load_presentation should return False