当前位置: 首页>>代码示例>>Python>>正文


Python QTest.keyRelease方法代码示例

本文整理汇总了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)
开发者ID:CaptainNemoz,项目名称:silx,代码行数:9,代码来源:testutils.py

示例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()
开发者ID:staldates,项目名称:av-control,代码行数:29,代码来源:TestCameraControls.py

示例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)
开发者ID:staldates,项目名称:aldatesx,代码行数:20,代码来源:TestCameraControls.py


注:本文中的PySide.QtTest.QTest.keyRelease方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。