本文整理汇总了Python中navigation.Navigation.quality_select_dialog方法的典型用法代码示例。如果您正苦于以下问题:Python Navigation.quality_select_dialog方法的具体用法?Python Navigation.quality_select_dialog怎么用?Python Navigation.quality_select_dialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类navigation.Navigation
的用法示例。
在下文中一共展示了Navigation.quality_select_dialog方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: QualitySelectTests
# 需要导入模块: from navigation import Navigation [as 别名]
# 或者: from navigation.Navigation import quality_select_dialog [as 别名]
class QualitySelectTests(unittest.TestCase):
def setUp(self):
self.dialog = Xbmcgui.Dialog()
self.dialog.select = MagicMock(name='select')
xbmcgui = Xbmcgui()
xbmcgui.Dialog = MagicMock(name='Dialog')
xbmcgui.Dialog.return_value = self.dialog
self.navigation = Navigation(None, None, xbmcgui, [None, 1])
def tearDown(self):
actual = self.navigation.quality_select_dialog(self.input)
self.assertEqual(actual, self.expected)
if self.dialog_arg:
self.dialog.select.assert_called_once_with("Quality Select", self.dialog_arg)
else:
self.assertFalse(self.dialog.select.called, "Dialog called!")
def test_only_one_input(self):
self.input = [("240p", "url_240")]
self.expected = "url_240"
self.dialog_arg = None
def test_select_first_url(self):
self.input = [("360p", "url_360"), ('720p', 'url_720')]
self.dialog_arg = ["360p", "720p"]
self.dialog.select.return_value = 0
self.expected = "url_360"
def test_select_second_url(self):
self.input = [("360p", "url_360"), ('720p', 'url_720')]
self.dialog_arg = ["360p", "720p"]
self.dialog.select.return_value = 1
self.expected = "url_720"
def test_unsorted_input(self):
self.input = [("1080p", "url_1080"), ('720p', 'url_720')]
self.dialog_arg = ["720p", "1080p"]
self.dialog.select.return_value = 1
self.expected = "url_1080"
def test_select_leading_whitespace_url(self):
self.input = [("360p", "url_360"), ('720p', ' url_720')]
self.dialog_arg = ["360p", "720p"]
self.dialog.select.return_value = 1
self.expected = "url_720"