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


Python QtTest.QTest类代码示例

本文整理汇总了Python中PySide.QtTest.QTest的典型用法代码示例。如果您正苦于以下问题:Python QTest类的具体用法?Python QTest怎么用?Python QTest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QTest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: keyClicks

    def keyClicks(self, widget, sequence, modifier=qt.Qt.NoModifier, delay=-1):
        """Simulate clicking a sequence of keys.

        See QTest.keyClick for details.
        """
        QTest.keyClicks(widget, sequence, modifier, delay)
        self.qWait(20)
开发者ID:CaptainNemoz,项目名称:silx,代码行数:7,代码来源:testutils.py

示例2: mouseMove

    def mouseMove(widget, pos=None, delay=-1):
        """Simulate moving the mouse.

        See QTest.mouseMove for details.
        """
        pos = qt.QPoint(pos[0], pos[1]) if pos is not None else qt.QPoint()
        QTest.mouseMove(widget, pos, delay)
开发者ID:andygotz,项目名称:silx,代码行数:7,代码来源:testutils.py

示例3: keyPress

    def keyPress(self, widget, key, modifier=qt.Qt.NoModifier, delay=-1):
        """Sends a Qt key press event.

        See QTest.keyPress for details.
        """
        QTest.keyPress(widget, key, modifier, delay)
        self.qWait(20)
开发者ID:CaptainNemoz,项目名称:silx,代码行数:7,代码来源:testutils.py

示例4: keyRelease

    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,代码行数:7,代码来源:testutils.py

示例5: test_send_pushButton_will_warn_the_user_to_set_the_media_files_path_if_it_is_not_set_before

    def test_send_pushButton_will_warn_the_user_to_set_the_media_files_path_if_it_is_not_set_before(self):
        """testing if send_pushButton will warn the user to set the media files
        path in preferences if it is not set before
        """
        # set a proper EDL file
        edl_path = os.path.abspath('../previs/test_data/test_v001.edl')
        self.dialog.edl_path_lineEdit.setText(edl_path)

        # patch QMessageBox.critical method
        original = QtGui.QMessageBox.critical
        QtGui.QMessageBox = PatchedMessageBox

        self.assertEqual(PatchedMessageBox.called_function, '')
        self.assertEqual(PatchedMessageBox.title, '')
        self.assertEqual(PatchedMessageBox.message, '')

        # now hit it
        QTest.mouseClick(self.dialog.send_pushButton, Qt.LeftButton)

        # restore QMessageBox.critical
        QtGui.QMessageBox.critical = original

        self.assertEqual(PatchedMessageBox.called_function, 'critical')
        self.assertEqual(PatchedMessageBox.title, 'Error')

        self.assertEqual(
            "Media path doesn't exists",
            PatchedMessageBox.message
        )
开发者ID:eoyilmaz,项目名称:anima,代码行数:29,代码来源:test_edl_importer.py

示例6: test_place_item

    def test_place_item(self):
        """
        Tests the workflow of placing an item
        """
        # Make sure the dockwidget is out of the way
        self.mw.history_dock_widget.hide()

        # Select insertion mode
        QTest.keyClick(self.mw, QtCore.Qt.Key_F2)

        self.app.processEvents()

        # Place item
        QTest.mouseClick(
            self.mw._view.viewport(),
            QtCore.Qt.LeftButton,
            pos=self.mw._view.geometry().center()
        )
        self.app.processEvents()

        logic_item_count = 0
        for item in self.mw._view.scene().items():
            if isinstance(item, logicitems.LogicItem):
                logic_item_count += 1

        self.assertEqual(1, logic_item_count)
开发者ID:LogikSim,项目名称:LogikSimPython,代码行数:26,代码来源:test_gui.py

示例7: keyClick

    def keyClick(self, widget, key, modifier=qt.Qt.NoModifier, delay=-1):
        """Simulate clicking a key.

        See QTest.keyClick for details.
        """
        QTest.keyClick(widget, key, modifier, delay)
        self.qWait(20)
开发者ID:CaptainNemoz,项目名称:silx,代码行数:7,代码来源:testutils.py

示例8: test_clicking_picker_button_opens_picker_window

 def test_clicking_picker_button_opens_picker_window(self):
     QTest.mouseClick(self.controller.add_button, Qt.LeftButton)
     picker_window_open = False
     for widget in QApplication.topLevelWidgets():
         if isinstance(widget, lyrical.LyricalPicker):
             picker_window_open = True
     self.assertTrue(picker_window_open)
开发者ID:jamesgecko,项目名称:Lyrical,代码行数:7,代码来源:test_control.py

示例9: test_copy_button_clicked_with_no_selection_on_to_task_tree_view

    def test_copy_button_clicked_with_no_selection_on_to_task_tree_view(self):
        """testing if a QMessageDialog will be displayed when the copy button
        selected and no selection is made in to_task_tree_vie
        """
        # select one task in from_task_tree_view

        # Select Task4 in from_task_tree_view
        selection_model = self.dialog.from_task_tree_view.selectionModel()
        model = self.dialog.from_task_tree_view.model()

        project1_item = model.item(0, 0)
        self.dialog.from_task_tree_view.expand(project1_item.index())

        task1_item = project1_item.child(0, 0)
        self.dialog.from_task_tree_view.expand(task1_item.index())

        task4_item = task1_item.child(0, 0)

        selection_model.select(
            task4_item.index(),
            QtGui.QItemSelectionModel.Select
        )

        self.assertEqual(PatchedMessageBox.called_function, '')

        # now try to copy it
        QTest.mouseClick(self.dialog.copy_push_button, Qt.LeftButton)

        self.assertEqual(PatchedMessageBox.called_function, 'critical')
        self.assertEqual(PatchedMessageBox.title, 'Error')
        self.assertEqual(PatchedMessageBox.message,
                         'Please select a task from <b>To Task</b> list')
开发者ID:eoyilmaz,项目名称:anima,代码行数:32,代码来源:test_version_mover.py

示例10: keyEvent

    def keyEvent(self, action, widget, key,
                 modifier=qt.Qt.NoModifier, delay=-1):
        """Sends a Qt key event.

        See QTest.keyEvent for details.
        """
        QTest.keyEvent(action, widget, key, modifier, delay)
        self.qWait(20)
开发者ID:CaptainNemoz,项目名称:silx,代码行数:8,代码来源:testutils.py

示例11: test_add_task_with_description

 def test_add_task_with_description(self):
     itemsBefore = self.form.listWidget.count()
     '''ensures AddTaskEdit contains text'''
     QTest.keyClicks(self.form.AddTaskEdit, "task one")
     addButton = self.form.AddTaskButton
     QTest.mouseClick(addButton, Qt.LeftButton)
     '''assert there is one more item'''
     self.assertEqual(self.form.listWidget.count(), itemsBefore+1)
开发者ID:diegoponciano,项目名称:Pomotimer,代码行数:8,代码来源:mainwidget_test.py

示例12: test_add_task_without_description

 def test_add_task_without_description(self):
     itemsBefore = self.form.listWidget.count()
     '''ensures AddTaskEdit is empty'''
     QTest.keyClicks(self.form.AddTaskEdit, "")
     addButton = self.form.AddTaskButton
     QTest.mouseClick(addButton, Qt.LeftButton)
     '''assert no items were added'''
     self.assertEqual(self.form.listWidget.count(), itemsBefore)
开发者ID:diegoponciano,项目名称:Pomotimer,代码行数:8,代码来源:mainwidget_test.py

示例13: testKeyEvent

    def testKeyEvent(self):
        widget = QLineEdit()
        key = Qt.Key_A
        eventFilter = KeyEventFilter(widget, QEvent.KeyPress, key)
        widget.installEventFilter(eventFilter)

        QTest.keyClick(widget, key)

        self.assert_(eventFilter.processed)
开发者ID:Hasimir,项目名称:PySide,代码行数:9,代码来源:eventfilter_test.py

示例14: mouseRelease

    def mouseRelease(widget, button, modifier=None, pos=None, delay=-1):
        """Simulate releasing a mouse button.

        See QTest.mouseRelease for details.
        """
        if modifier is None:
            modifier = qt.Qt.KeyboardModifiers()
        pos = qt.QPoint(pos[0], pos[1]) if pos is not None else qt.QPoint()
        QTest.mouseRelease(widget, button, modifier, pos, delay)
开发者ID:andygotz,项目名称:silx,代码行数:9,代码来源:testutils.py

示例15: test_close_button_closes_ui

    def test_close_button_closes_ui(self):
        """testing if the close button is closing the ui
        """
        self.dialog.show()

        self.assertEqual(self.dialog.isVisible(), True)

        # now run the UI
        QTest.mouseClick(self.dialog.close_pushButton, Qt.LeftButton)
        self.assertEqual(self.dialog.isVisible(), False)
开发者ID:eoyilmaz,项目名称:anima,代码行数:10,代码来源:test_version_creator.py


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