forked from openlp/openlp
fix tests
This commit is contained in:
parent
7a345d5770
commit
e0341ab3eb
@ -151,7 +151,7 @@ class Registry(object):
|
||||
trace_error_handler(log)
|
||||
log.exception('Exception for function {function}'.format(function=function))
|
||||
else:
|
||||
if self._logger.getEffectiveLevel() == logging.DEBUG:
|
||||
if log.getEffectiveLevel() == logging.DEBUG:
|
||||
trace_error_handler(log)
|
||||
log.exception('Event {event} called but not registered'.format(event=event))
|
||||
return results
|
||||
|
@ -208,6 +208,33 @@ class TestSlideController(TestCase):
|
||||
mocked_on_theme_display.assert_called_once_with(False)
|
||||
mocked_on_hide_display.assert_called_once_with(False)
|
||||
|
||||
def test_on_go_live_preview_controller(self):
|
||||
"""
|
||||
Test that when the on_go_preview() method is called the message is sent to the preview controller and focus is
|
||||
set correctly.
|
||||
"""
|
||||
# GIVEN: A new SlideController instance and plugin preview then pressing go live should respond
|
||||
mocked_display = MagicMock()
|
||||
mocked_preview_controller = MagicMock()
|
||||
mocked_preview_widget = MagicMock()
|
||||
mocked_service_item = MagicMock()
|
||||
mocked_service_item.from_service = False
|
||||
mocked_preview_widget.current_slide_number.return_value = 1
|
||||
mocked_preview_widget.slide_count = MagicMock(return_value=2)
|
||||
mocked_preview_controller.preview_widget = MagicMock()
|
||||
Registry.create()
|
||||
Registry().register('preview_controller', mocked_preview_controller)
|
||||
slide_controller = SlideController(None)
|
||||
slide_controller.service_item = mocked_service_item
|
||||
slide_controller.preview_widget = mocked_preview_widget
|
||||
slide_controller.display = mocked_display
|
||||
|
||||
# WHEN: on_go_live() is called
|
||||
slide_controller.on_go_preview()
|
||||
|
||||
# THEN: the preview controller should have the service item and the focus set to live
|
||||
mocked_preview_controller.preview_widget.setFocus.assert_called_once_with()
|
||||
|
||||
def test_on_go_live_live_controller(self):
|
||||
"""
|
||||
Test that when the on_go_live() method is called the message is sent to the live controller and focus is
|
||||
|
Loading…
Reference in New Issue
Block a user