本文整理汇总了Python中PySide.QtTest.QTest.keyRelease方法的典型用法代码示例。如果您正苦于以下问题:Python QTest.keyRelease方法的具体用法?Python QTest.keyRelease怎么用?Python QTest.keyRelease使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtTest.QTest
的用法示例。
在下文中一共展示了QTest.keyRelease方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: keyRelease
# 需要导入模块: from PySide.QtTest import QTest [as 别名]
# 或者: from PySide.QtTest.QTest import keyRelease [as 别名]
def keyRelease(self, widget, key, modifier=qt.Qt.NoModifier, delay=-1):
"""Sends a Qt key release event.
See QTest.keyRelease for details.
"""
QTest.keyRelease(widget, key, modifier, delay)
self.qWait(20)
示例2: testMoveCameraWithKeyboard
# 需要导入模块: from PySide.QtTest import QTest [as 别名]
# 或者: from PySide.QtTest.QTest import keyRelease [as 别名]
def testMoveCameraWithKeyboard(self):
self.cc.panSpeed = 1
self.cc.tiltSpeed = 2
QTest.keyPress(self.cc, Qt.Key_Up)
self.cam.moveUp.assert_called_once_with(1, 2)
QTest.keyRelease(self.cc, Qt.Key_Up)
self.cam.stop.assert_called_once_with()
self.cam.stop.reset_mock()
QTest.keyPress(self.cc, Qt.Key_Down)
self.cam.moveDown.assert_called_once_with(1, 2)
QTest.keyRelease(self.cc, Qt.Key_Down)
self.cam.stop.assert_called_once_with()
self.cam.stop.reset_mock()
QTest.keyPress(self.cc, Qt.Key_Left)
self.cam.moveLeft.assert_called_once_with(1, 2)
QTest.keyRelease(self.cc, Qt.Key_Left)
self.cam.stop.assert_called_once_with()
self.cam.stop.reset_mock()
QTest.keyPress(self.cc, Qt.Key_Right)
self.cam.moveRight.assert_called_once_with(1, 2)
QTest.keyRelease(self.cc, Qt.Key_Right)
self.cam.stop.assert_called_once_with()
self.cam.stop.reset_mock()
示例3: testMoveCameraWithKeyboard
# 需要导入模块: from PySide.QtTest import QTest [as 别名]
# 或者: from PySide.QtTest.QTest import keyRelease [as 别名]
def testMoveCameraWithKeyboard(self):
cc = CameraControl(self.mockController, "Test Camera")
QTest.keyPress(cc, Qt.Key_Up)
self.mockController.move.assert_called_with("Test Camera", CameraMove.Up)
QTest.keyRelease(cc, Qt.Key_Up)
self.mockController.move.assert_called_with("Test Camera", CameraMove.Stop)
QTest.keyPress(cc, Qt.Key_Down)
self.mockController.move.assert_called_with("Test Camera", CameraMove.Down)
QTest.keyRelease(cc, Qt.Key_Down)
self.mockController.move.assert_called_with("Test Camera", CameraMove.Stop)
QTest.keyPress(cc, Qt.Key_Left)
self.mockController.move.assert_called_with("Test Camera", CameraMove.Left)
QTest.keyRelease(cc, Qt.Key_Left)
self.mockController.move.assert_called_with("Test Camera", CameraMove.Stop)
QTest.keyPress(cc, Qt.Key_Right)
self.mockController.move.assert_called_with("Test Camera", CameraMove.Right)
QTest.keyRelease(cc, Qt.Key_Right)
self.mockController.move.assert_called_with("Test Camera", CameraMove.Stop)