Example #1
0
def test_widget_kept_as_weakref(qtbot):
    """
    Test if the widget is kept as a weak reference in QtBot
    """
    widget = QWidget()
    qtbot.add_widget(widget)
    widget = weakref.ref(widget)
    assert widget() is None
Example #2
0
def test_stop_for_interaction(qtbot):
    """
    Test qtbot.stopForInteraction()
    """
    widget = QWidget()
    qtbot.addWidget(widget)
    qtbot.waitForWindowShown(widget)
    QtCore.QTimer.singleShot(0, widget.close)
    qtbot.stopForInteraction()
Example #3
0
def test_basics(qtbot):
    """
    Basic test that works more like a sanity check to ensure we are setting up a QApplication
    properly and are able to display a simple event_recorder.
    """
    assert QApplication.instance() is not None
    widget = QWidget()
    qtbot.addWidget(widget)
    widget.setWindowTitle('W1')
    widget.show()

    assert widget.isVisible()
    assert widget.windowTitle() == 'W1'
Example #4
0
 def __init__(self):
     QWidget.__init__(self)
     self._event_types = {}
     self.event_data = None