forked from openlp/openlp
fix up tests
This commit is contained in:
parent
e62cfc64b8
commit
4547b7b4eb
@ -30,6 +30,7 @@ from openlp.core.state import State
|
||||
# sys.modules['PyQt5.QtWebEngineWidgets'] = MagicMock()
|
||||
|
||||
from openlp.core.api.endpoint.controller import controller_direction, controller_text
|
||||
from openlp.core.display.render import Renderer
|
||||
from openlp.core.common.registry import Registry
|
||||
from openlp.core.display.screens import ScreenList
|
||||
from openlp.core.lib.serviceitem import ServiceItem
|
||||
@ -67,6 +68,8 @@ class TestController(TestCase):
|
||||
MagicMock(**{'geometry.return_value': SCREEN['size']})
|
||||
]
|
||||
self.screens = ScreenList.create(self.desktop)
|
||||
renderer = Renderer()
|
||||
renderer.empty_height = 1000
|
||||
Registry().register('live_controller', self.mocked_live_controller)
|
||||
|
||||
def test_controller_text_empty(self):
|
||||
@ -98,9 +101,9 @@ class TestController(TestCase):
|
||||
State().update_pre_conditions("media", True)
|
||||
State().flush_preconditions()
|
||||
self.mocked_live_controller.service_item.set_from_service(line)
|
||||
|
||||
self.mocked_live_controller.service_item.render(True)
|
||||
# WHEN: I trigger the method
|
||||
ret = controller_text(MagicMock())
|
||||
ret = controller_text("SomeText")
|
||||
|
||||
# THEN: I get a basic set of results
|
||||
results = ret['results']
|
||||
|
@ -124,11 +124,13 @@ class TestServiceItem(TestCase, TestMixin):
|
||||
|
||||
# THEN: The frames should also be valid
|
||||
assert 'Test Custom' == service_item.get_display_title(), 'The title should be "Test Custom"'
|
||||
assert service_item.get_frames()[0]['text'] == 'Slide 1'
|
||||
assert service_item.get_frames()[1]['text'] == 'Slide 2'
|
||||
assert service_item.get_frame_title(0) == 'Slide 1', '"Slide 1" has been returned as the title'
|
||||
assert service_item.get_frame_title(1) == 'Slide 2', '"Slide 2" has been returned as the title'
|
||||
assert service_item.get_frame_title(2) == '', 'Blank has been returned as the title of slide 3'
|
||||
assert CLEANED_VERSE[:-1] == service_item.get_frames()[0]['text'], \
|
||||
'The returned text matches the input, except the last line feed'
|
||||
assert RENDERED_VERSE.split('\n', 1)[0] == service_item.get_rendered_frame(1), \
|
||||
'The first line has been returned'
|
||||
assert 'Slide 1' == service_item.get_frame_title(0), '"Slide 1" has been returned as the title'
|
||||
assert 'Slide 2' == service_item.get_frame_title(1), '"Slide 2" has been returned as the title'
|
||||
assert '' == service_item.get_frame_title(2), 'Blank has been returned as the title of slide 3'
|
||||
|
||||
def test_service_item_load_image_from_service(self):
|
||||
"""
|
||||
|
@ -164,7 +164,8 @@ class TestMainWindow(TestCase, TestMixin):
|
||||
# WHEN: you check the started functions
|
||||
|
||||
# THEN: the following registry functions should have been registered
|
||||
expected_service_list = ['application', 'main_window', 'http_server', 'settings_form']
|
||||
expected_service_list = ['application', 'main_window', 'http_server', 'settings_form', 'service_manager',
|
||||
'theme_manager', 'projection_manager']
|
||||
expected_functions_list = ['bootstrap_initialise', 'bootstrap_post_set_up', 'playbackPlay', 'playbackPause',
|
||||
'playbackStop', 'playbackLoop', 'seek_slider', 'volume_slider', 'media_hide',
|
||||
'media_blank', 'media_unblank', 'songs_hide', 'songs_blank', 'songs_unblank',
|
||||
|
Loading…
Reference in New Issue
Block a user