本文整理汇总了Python中qtpy.QtTest.QTest.mouseDClick方法的典型用法代码示例。如果您正苦于以下问题:Python QTest.mouseDClick方法的具体用法?Python QTest.mouseDClick怎么用?Python QTest.mouseDClick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qtpy.QtTest.QTest
的用法示例。
在下文中一共展示了QTest.mouseDClick方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_run_dialog_opens_on_double_click
# 需要导入模块: from qtpy.QtTest import QTest [as 别名]
# 或者: from qtpy.QtTest.QTest import mouseDClick [as 别名]
def test_run_dialog_opens_on_double_click(self):
with patch(createDialogFromName_func_name) as createDialog:
widget = AlgorithmSelectorWidget()
self._select_in_tree(widget, 'Load v.1')
selected_item = widget.tree.selectedItems()[0]
item_pos = widget.tree.visualItemRect(selected_item).center()
QTest.mouseDClick(widget.tree.viewport(), Qt.LeftButton,
Qt.NoModifier, pos=item_pos)
createDialog.assert_called_once_with('Load', 1)
示例2: test_plot_name_double_clicked_calls_presenter_and_makes_plot_current
# 需要导入模块: from qtpy.QtTest import QTest [as 别名]
# 或者: from qtpy.QtTest.QTest import mouseDClick [as 别名]
def test_plot_name_double_clicked_calls_presenter_and_makes_plot_current(self):
plot_numbers = [0, 1, 2]
self.view.set_plot_list(plot_numbers)
item = self.view.table_widget.item(1, 1)
item_center = self.view.table_widget.visualItemRect(item).center()
# This single click should not be required, but otherwise the double click is not registered
QTest.mouseClick(self.view.table_widget.viewport(), Qt.LeftButton, pos=item_center)
QTest.mouseDClick(self.view.table_widget.viewport(), Qt.LeftButton, pos=item_center)
self.assertEqual(self.presenter.show_single_selected.call_count, 1)
# Expected result: 1
# Something goes wrong in QTest here and the selection is
# always the first plot.
self.assertEqual(self.view.get_currently_selected_plot_number(), 0)