forked from openlp/openlp
code fix done and tests updated
This commit is contained in:
parent
5496745f98
commit
fee77506f6
@ -664,12 +664,6 @@ class MediaController(RegistryBase, LogMixin, RegistryProperties):
|
||||
self.log_debug('media_reset')
|
||||
self.set_controls_visible(controller, False)
|
||||
if controller.controller_type in self.current_media_players:
|
||||
display = self._define_display(controller)
|
||||
hide_mode = controller.get_hide_mode()
|
||||
if hide_mode is None:
|
||||
display.show_display()
|
||||
else:
|
||||
display.hide_display(hide_mode)
|
||||
self.current_media_players[controller.controller_type].reset(controller)
|
||||
if controller.is_live and delayed:
|
||||
self.live_kill_timer.start(HIDE_DELAY_TIME)
|
||||
|
@ -952,11 +952,16 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties):
|
||||
self.info_label.setText(self.service_item.title)
|
||||
self.slide_list = {}
|
||||
if old_item:
|
||||
# Close the old item if it's not to be used by the new sevice item
|
||||
# Close the old item if it's not to be used by the new service item
|
||||
if not self.service_item.is_media() and not self.service_item.requires_media():
|
||||
self.on_media_close()
|
||||
if old_item.is_command() and not old_item.is_media():
|
||||
Registry().execute('{name}_stop'.format(name=old_item.name.lower()), [old_item, self.is_live])
|
||||
# if the old item was media which hid the main display then need to reset it if new service item uses it
|
||||
if self.is_live and self._current_hide_mode is None and old_item.is_media() and not \
|
||||
old_item.requires_media() and not self.service_item.is_capable(ItemCapabilities.ProvidesOwnDisplay):
|
||||
for display in self.displays:
|
||||
display.show_display()
|
||||
row = 0
|
||||
width = self.main_window.control_splitter.sizes()[self.split]
|
||||
if self.service_item.is_text():
|
||||
|
@ -282,21 +282,17 @@ def test_media_reset(media_env):
|
||||
# GIVEN: A media controller, mocked slide controller, mocked media player and mocked display
|
||||
mocked_slide_controller = MagicMock()
|
||||
mocked_media_player = MagicMock()
|
||||
mocked_display = MagicMock(hide_mode=None)
|
||||
mocked_slide_controller.controller_type = 'media player'
|
||||
mocked_slide_controller.media_info = MagicMock(is_background=False)
|
||||
mocked_slide_controller.get_hide_mode = MagicMock(return_value=None)
|
||||
mocked_slide_controller.is_live = False
|
||||
media_env.media_controller.current_media_players = {'media player': mocked_media_player}
|
||||
media_env.media_controller.live_hide_timer = MagicMock()
|
||||
media_env.media_controller._define_display = MagicMock(return_value=mocked_display)
|
||||
media_env.media_controller._media_set_visibility = MagicMock()
|
||||
|
||||
# WHEN: media_reset() is called
|
||||
media_env.media_controller.media_reset(mocked_slide_controller)
|
||||
|
||||
# THEN: The display should be shown, media should be hidden and removed
|
||||
mocked_display.show_display.assert_called_once_with()
|
||||
media_env.media_controller._media_set_visibility.assert_called_once_with(mocked_slide_controller, False)
|
||||
assert 'media player' not in media_env.media_controller.current_media_players
|
||||
|
||||
|
@ -960,6 +960,7 @@ def test_process_item_transition(mocked_execute, registry, state_media):
|
||||
slide_controller.song_menu = MagicMock()
|
||||
slide_controller.displays = [MagicMock()]
|
||||
slide_controller.toolbar = MagicMock()
|
||||
slide_controller._current_hide_mode = None
|
||||
slide_controller.split = 0
|
||||
slide_controller.type_prefix = 'test'
|
||||
slide_controller.screen_capture = 'old_capture'
|
||||
|
Loading…
Reference in New Issue
Block a user