forked from openlp/openlp
Fix tests
This commit is contained in:
parent
36fd65f98c
commit
a64036c8c1
@ -222,7 +222,7 @@ class TestServiceItem(TestCase, TestMixin):
|
|||||||
assert frame_array2 == service_item2.get_frames()[0], 'The return should match the frame array2'
|
assert frame_array2 == service_item2.get_frames()[0], 'The return should match the frame array2'
|
||||||
assert test_file1 == str(service_item.get_frame_path(0)), \
|
assert test_file1 == str(service_item.get_frame_path(0)), \
|
||||||
'The frame path should match the full path to the image'
|
'The frame path should match the full path to the image'
|
||||||
assert test_file2 == service_item2.get_frame_path(0), \
|
assert test_file2 == str(service_item2.get_frame_path(0)), \
|
||||||
'The frame path should match the full path to the image'
|
'The frame path should match the full path to the image'
|
||||||
assert image_name1 == service_item.get_frame_title(0), 'The 1st frame title should match the image name'
|
assert image_name1 == service_item.get_frame_title(0), 'The 1st frame title should match the image name'
|
||||||
assert image_name2 == service_item2.get_frame_title(0), 'The 2nd frame title should match the image name'
|
assert image_name2 == service_item2.get_frame_title(0), 'The 2nd frame title should match the image name'
|
||||||
|
@ -60,14 +60,11 @@ class TestMainDisplay(TestCase, TestMixin):
|
|||||||
self.registry = Registry()
|
self.registry = Registry()
|
||||||
self.setup_application()
|
self.setup_application()
|
||||||
Registry().register('application', self.app)
|
Registry().register('application', self.app)
|
||||||
self.mocked_audio_player = patch('openlp.core.ui.maindisplay.AudioPlayer')
|
|
||||||
self.mocked_audio_player.start()
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
"""
|
"""
|
||||||
Delete QApplication.
|
Delete QApplication.
|
||||||
"""
|
"""
|
||||||
self.mocked_audio_player.stop()
|
|
||||||
del self.screens
|
del self.screens
|
||||||
|
|
||||||
def test_initial_main_display(self):
|
def test_initial_main_display(self):
|
||||||
|
@ -32,6 +32,7 @@ from PyQt5 import QtCore, QtWidgets
|
|||||||
from openlp.core.common.i18n import UiStrings
|
from openlp.core.common.i18n import UiStrings
|
||||||
from openlp.core.common.registry import Registry
|
from openlp.core.common.registry import Registry
|
||||||
from openlp.core.display.screens import ScreenList
|
from openlp.core.display.screens import ScreenList
|
||||||
|
from openlp.core.lib.plugin import PluginStatus
|
||||||
from openlp.core.ui.mainwindow import MainWindow
|
from openlp.core.ui.mainwindow import MainWindow
|
||||||
from tests.helpers.testmixin import TestMixin
|
from tests.helpers.testmixin import TestMixin
|
||||||
from tests.utils.constants import TEST_RESOURCES_PATH
|
from tests.utils.constants import TEST_RESOURCES_PATH
|
||||||
@ -68,6 +69,10 @@ class TestMainWindow(TestCase, TestMixin):
|
|||||||
self.add_toolbar_action_patcher = patch('openlp.core.ui.mainwindow.create_action')
|
self.add_toolbar_action_patcher = patch('openlp.core.ui.mainwindow.create_action')
|
||||||
self.mocked_add_toolbar_action = self.add_toolbar_action_patcher.start()
|
self.mocked_add_toolbar_action = self.add_toolbar_action_patcher.start()
|
||||||
self.mocked_add_toolbar_action.side_effect = self._create_mock_action
|
self.mocked_add_toolbar_action.side_effect = self._create_mock_action
|
||||||
|
mocked_plugin = MagicMock()
|
||||||
|
mocked_plugin.status = PluginStatus.Active
|
||||||
|
Registry().register('mock_plugin', mocked_plugin)
|
||||||
|
State().add_service("mock", 1, is_plugin=True, status=PluginStatus.Active)
|
||||||
with patch('openlp.core.display.screens.ScreenList.__instance__', spec=ScreenList) as mocked_screen_list:
|
with patch('openlp.core.display.screens.ScreenList.__instance__', spec=ScreenList) as mocked_screen_list:
|
||||||
mocked_screen_list.current = {'number': 0, 'size': QtCore.QSize(600, 800), 'primary': True}
|
mocked_screen_list.current = {'number': 0, 'size': QtCore.QSize(600, 800), 'primary': True}
|
||||||
self.main_window = MainWindow()
|
self.main_window = MainWindow()
|
||||||
|
Loading…
Reference in New Issue
Block a user