forked from openlp/openlp
Added 3 tests for replacing Live item from service manager while display is blanked. (One for each)
This commit is contained in:
parent
4a6b5b7cc4
commit
6858a7cfb5
@ -538,6 +538,103 @@ class TestSlideController(TestCase):
|
||||
mocked_preview_widget.current_slide_number.assert_called_with()
|
||||
mocked_process_item.assert_called_once_with(mocked_item, 7)
|
||||
|
||||
def replace_service_manager_item_on_blank_display_test(self):
|
||||
"""
|
||||
Test that when the service item is replaced, display remains blanked if it was blanked.
|
||||
"""
|
||||
# GIVEN: A slide controller and a new item to add, blanked display.
|
||||
mocked_item = MagicMock()
|
||||
mocked_preview_widget = MagicMock()
|
||||
mocked_preview_widget.current_slide_number = MagicMock()
|
||||
mocked_process_item = MagicMock()
|
||||
slide_controller = SlideController(None)
|
||||
slide_controller.preview_widget = mocked_preview_widget
|
||||
slide_controller._process_item = mocked_process_item
|
||||
slide_controller.service_item = mocked_item
|
||||
slide_controller.hide_menu = MagicMock()
|
||||
slide_controller.hide_mode = MagicMock()
|
||||
slide_controller.hide_mode.return_value = True
|
||||
slide_controller.blank_screen = MagicMock()
|
||||
slide_controller.blank_screen.isChecked = MagicMock()
|
||||
slide_controller.blank_screen.isChecked.return_value = True
|
||||
slide_controller.on_blank_display = mocked_item
|
||||
slide_controller.theme_screen = MagicMock()
|
||||
slide_controller.desktop_screen = MagicMock()
|
||||
slide_controller.log_debug = MagicMock()
|
||||
|
||||
# WHEN: The service item is replaced
|
||||
slide_controller.replace_service_manager_item(mocked_item)
|
||||
|
||||
# THEN: The display should remain blanked
|
||||
slide_controller.on_blank_display.assert_called_once_with(True)
|
||||
|
||||
def replace_service_manager_item_on_theme_display_test(self):
|
||||
"""
|
||||
Test that when the service item is replaced, display remains blanked if it was blanked.
|
||||
"""
|
||||
# GIVEN: A slide controller and a new item to add, blanked display.
|
||||
mocked_item = MagicMock()
|
||||
mocked_preview_widget = MagicMock()
|
||||
mocked_preview_widget.current_slide_number = MagicMock()
|
||||
mocked_process_item = MagicMock()
|
||||
slide_controller = SlideController(None)
|
||||
slide_controller.preview_widget = mocked_preview_widget
|
||||
slide_controller._process_item = mocked_process_item
|
||||
slide_controller.service_item = mocked_item
|
||||
slide_controller.hide_menu = MagicMock()
|
||||
slide_controller.hide_mode = MagicMock()
|
||||
slide_controller.hide_mode.return_value = True
|
||||
slide_controller.blank_screen = MagicMock()
|
||||
slide_controller.blank_screen.isChecked = MagicMock()
|
||||
slide_controller.blank_screen.isChecked.return_value = False
|
||||
slide_controller.theme_screen = MagicMock()
|
||||
slide_controller.theme_screen.isChecked = MagicMock()
|
||||
slide_controller.theme_screen.isChecked.return_value = True
|
||||
slide_controller.on_theme_display = mocked_item
|
||||
slide_controller.desktop_screen = MagicMock()
|
||||
slide_controller.log_debug = MagicMock()
|
||||
|
||||
# WHEN: The service item is replaced
|
||||
slide_controller.replace_service_manager_item(mocked_item)
|
||||
|
||||
# THEN: The display should remain blanked
|
||||
slide_controller.on_theme_display.assert_called_once_with(True)
|
||||
|
||||
def replace_service_manager_item_on_hide_display_test(self):
|
||||
"""
|
||||
Test that when the service item is replaced, display remains blanked if it was blanked.
|
||||
"""
|
||||
# GIVEN: A slide controller and a new item to add, blanked display.
|
||||
mocked_item = MagicMock()
|
||||
mocked_preview_widget = MagicMock()
|
||||
mocked_preview_widget.current_slide_number = MagicMock()
|
||||
mocked_process_item = MagicMock()
|
||||
slide_controller = SlideController(None)
|
||||
slide_controller.preview_widget = mocked_preview_widget
|
||||
slide_controller._process_item = mocked_process_item
|
||||
slide_controller.service_item = mocked_item
|
||||
slide_controller.hide_menu = MagicMock()
|
||||
slide_controller.hide_mode = MagicMock()
|
||||
slide_controller.hide_mode.return_value = True
|
||||
slide_controller.blank_screen = MagicMock()
|
||||
slide_controller.blank_screen.isChecked = MagicMock()
|
||||
slide_controller.blank_screen.isChecked.return_value = False
|
||||
slide_controller.theme_screen = MagicMock()
|
||||
slide_controller.theme_screen.isChecked = MagicMock()
|
||||
slide_controller.theme_screen.isChecked.return_value = False
|
||||
slide_controller.on_theme_display = mocked_item
|
||||
slide_controller.desktop_screen = MagicMock()
|
||||
slide_controller.desktop_screen.isChecked = MagicMock()
|
||||
slide_controller.desktop_screen.isChecked.return_value = True
|
||||
slide_controller.on_hide_display = MagicMock()
|
||||
slide_controller.log_debug = MagicMock()
|
||||
|
||||
# WHEN: The service item is replaced
|
||||
slide_controller.replace_service_manager_item(mocked_item)
|
||||
|
||||
# THEN: The display should remain blanked
|
||||
slide_controller.on_hide_display.assert_called_once_with(True)
|
||||
|
||||
def on_slide_blank_test(self):
|
||||
"""
|
||||
Test on_slide_blank
|
||||
|
Loading…
Reference in New Issue
Block a user