本文整理汇总了Python中openlp.core.ui.media.vlcplayer.VlcPlayer.setup方法的典型用法代码示例。如果您正苦于以下问题:Python VlcPlayer.setup方法的具体用法?Python VlcPlayer.setup怎么用?Python VlcPlayer.setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openlp.core.ui.media.vlcplayer.VlcPlayer
的用法示例。
在下文中一共展示了VlcPlayer.setup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_visible_mouse_test
# 需要导入模块: from openlp.core.ui.media.vlcplayer import VlcPlayer [as 别名]
# 或者: from openlp.core.ui.media.vlcplayer.VlcPlayer import setup [as 别名]
def setup_visible_mouse_test(self, MockedSettings, MockedQtGui, mocked_get_vlc, mocked_is_macosx, mocked_is_win):
"""
Test the setup method when Settings().value("hide mouse") is False
"""
# GIVEN: A bunch of mocked out stuff and a VlcPlayer object
mocked_is_macosx.return_value = False
mocked_is_win.return_value = False
mocked_settings = MagicMock()
mocked_settings.value.return_value = False
MockedSettings.return_value = mocked_settings
mocked_qframe = MagicMock()
mocked_qframe.winId.return_value = 2
MockedQtGui.QFrame.NoFrame = 1
MockedQtGui.QFrame.return_value = mocked_qframe
mocked_media_player_new = MagicMock()
mocked_instance = MagicMock()
mocked_instance.media_player_new.return_value = mocked_media_player_new
mocked_vlc = MagicMock()
mocked_vlc.Instance.return_value = mocked_instance
mocked_get_vlc.return_value = mocked_vlc
mocked_display = MagicMock()
mocked_display.has_audio = False
mocked_display.controller.is_live = True
mocked_display.size.return_value = (10, 10)
vlc_player = VlcPlayer(None)
# WHEN: setup() is run
vlc_player.setup(mocked_display)
# THEN: The VLC instance should be created with the correct options
mocked_vlc.Instance.assert_called_with('--no-video-title-show --no-audio --no-video-title-show')
示例2: setup_osx_test
# 需要导入模块: from openlp.core.ui.media.vlcplayer import VlcPlayer [as 别名]
# 或者: from openlp.core.ui.media.vlcplayer.VlcPlayer import setup [as 别名]
def setup_osx_test(self, MockedSettings, MockedQtGui, mocked_get_vlc, mocked_is_macosx, mocked_is_win):
"""
Test the setup method when running on OS X
"""
# GIVEN: A bunch of mocked out stuff and a VlcPlayer object
mocked_is_macosx.return_value = True
mocked_is_win.return_value = False
mocked_settings = MagicMock()
mocked_settings.value.return_value = False
MockedSettings.return_value = mocked_settings
mocked_qframe = MagicMock()
mocked_qframe.winId.return_value = 2
MockedQtGui.QFrame.NoFrame = 1
MockedQtGui.QFrame.return_value = mocked_qframe
mocked_media_player_new = MagicMock()
mocked_instance = MagicMock()
mocked_instance.media_player_new.return_value = mocked_media_player_new
mocked_vlc = MagicMock()
mocked_vlc.Instance.return_value = mocked_instance
mocked_get_vlc.return_value = mocked_vlc
mocked_display = MagicMock()
mocked_display.has_audio = False
mocked_display.controller.is_live = True
mocked_display.size.return_value = (10, 10)
vlc_player = VlcPlayer(None)
# WHEN: setup() is run
vlc_player.setup(mocked_display)
# THEN: set_nsobject should be called
mocked_media_player_new.set_nsobject.assert_called_with(2)
示例3: setup_test
# 需要导入模块: from openlp.core.ui.media.vlcplayer import VlcPlayer [as 别名]
# 或者: from openlp.core.ui.media.vlcplayer.VlcPlayer import setup [as 别名]
def setup_test(self, MockedSettings, MockedQtGui, mocked_get_vlc, mocked_is_macosx, mocked_is_win):
"""
Test the setup method
"""
# GIVEN: A bunch of mocked out stuff and a VlcPlayer object
mocked_is_macosx.return_value = False
mocked_is_win.return_value = False
mocked_settings = MagicMock()
mocked_settings.value.return_value = True
MockedSettings.return_value = mocked_settings
mocked_qframe = MagicMock()
mocked_qframe.winId.return_value = 2
MockedQtGui.QFrame.NoFrame = 1
MockedQtGui.QFrame.return_value = mocked_qframe
mocked_media_player_new = MagicMock()
mocked_instance = MagicMock()
mocked_instance.media_player_new.return_value = mocked_media_player_new
mocked_vlc = MagicMock()
mocked_vlc.Instance.return_value = mocked_instance
mocked_get_vlc.return_value = mocked_vlc
mocked_display = MagicMock()
mocked_display.has_audio = False
mocked_display.controller.is_live = True
mocked_display.size.return_value = (10, 10)
vlc_player = VlcPlayer(None)
# WHEN: setup() is run
vlc_player.setup(mocked_display)
# THEN: The VLC widget should be set up correctly
self.assertEqual(mocked_display.vlc_widget, mocked_qframe)
mocked_qframe.setFrameStyle.assert_called_with(1)
mocked_settings.value.assert_called_with('advanced/hide mouse')
mocked_vlc.Instance.assert_called_with('--no-video-title-show --no-audio --no-video-title-show '
'--mouse-hide-timeout=0')
self.assertEqual(mocked_display.vlc_instance, mocked_instance)
mocked_instance.media_player_new.assert_called_with()
self.assertEqual(mocked_display.vlc_media_player, mocked_media_player_new)
mocked_display.size.assert_called_with()
mocked_qframe.resize.assert_called_with((10, 10))
mocked_qframe.raise_.assert_called_with()
mocked_qframe.hide.assert_called_with()
mocked_media_player_new.set_xwindow.assert_called_with(2)
self.assertTrue(vlc_player.has_own_widget)