Skip to content

Commit 19661b4

Browse files
committed
adding test for waitForWindowShown
1 parent d43c9bc commit 19661b4

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

pytestqt/_tests/test_basics.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pytestqt.qt_compat import QtGui, Qt, QEvent
1+
from pytestqt.qt_compat import QtGui, Qt, QEvent, QtCore
22
import pytest
33

44

@@ -55,7 +55,18 @@ def extract(mouse_event):
5555

5656
qtbot.mousePress(event_recorder, Qt.RightButton, Qt.AltModifier)
5757
assert event_recorder.event_data == (QEvent.MouseButtonPress, Qt.RightButton, Qt.AltModifier)
58-
58+
59+
60+
def test_stop_for_interaction(qtbot):
61+
"""
62+
Test qtbot.stopForInteraction()
63+
"""
64+
widget = QtGui.QWidget()
65+
qtbot.addWidget(widget)
66+
qtbot.waitForWindowShown(widget)
67+
QtCore.QTimer.singleShot(0, widget.close)
68+
qtbot.stopForInteraction()
69+
5970

6071
class EventRecorder(QtGui.QWidget):
6172
"""
@@ -90,3 +101,5 @@ def event_recorder(qtbot):
90101
widget = EventRecorder()
91102
qtbot.addWidget(widget)
92103
return widget
104+
105+

pytestqt/plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def result(*args, **kwargs):
2525
functools.update_wrapper(result, qtest_method)
2626
return staticmethod(result)
2727
else:
28-
return None
28+
return None # pragma: no cover
2929

3030
# inject methods from QTest into QtBot
3131
method_names = [

0 commit comments

Comments
 (0)