diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-09-08 18:42:25 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-10-05 15:15:36 +0000 |
commit | 08e083e682d92290e36e4fb09abaf0318575dd41 (patch) | |
tree | 015d723565961179f8dad65b97ae3919d0158b17 /tests/auto/widgets/widgets | |
parent | 7bbb9a8ce81653b1665c9c942cc707ce98f611c5 (diff) |
Ensure result of all QTest::qWaitFor are verified
The qWaitFor functions themselves can not trigger a test failure, as that
will not result in the test function exiting early, so every single call
to qWaitFor needs to be wrapped in a QVERIFY.
Change-Id: Id15a1549f31d06cdbf788e1d84ea431c28636ec8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/widgets/widgets')
9 files changed, 40 insertions, 40 deletions
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 2f4e1a32f3..7c63497291 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -2261,7 +2261,7 @@ void tst_QComboBox::task190351_layout() listCombo.setCurrentIndex(70); listCombo.showPopup(); QTRY_VERIFY(listCombo.view()); - QTest::qWaitForWindowExposed(listCombo.view()); + QVERIFY(QTest::qWaitForWindowExposed(listCombo.view())); QTRY_VERIFY(listCombo.view()->isVisible()); QApplication::processEvents(); @@ -2408,7 +2408,7 @@ void tst_QComboBox::task248169_popupWithMinimalSize() QTRY_VERIFY(comboBox.isVisible()); comboBox.showPopup(); QTRY_VERIFY(comboBox.view()); - QTest::qWaitForWindowExposed(comboBox.view()); + QVERIFY(QTest::qWaitForWindowExposed(comboBox.view())); QTRY_VERIFY(comboBox.view()->isVisible()); #if defined QT_BUILD_INTERNAL @@ -3254,12 +3254,12 @@ void tst_QComboBox::task_QTBUG_49831_scrollerNotActivated() box.setModel(&model); box.setCurrentIndex(500); box.show(); - QTest::qWaitForWindowExposed(&box); + QVERIFY(QTest::qWaitForWindowExposed(&box)); QTest::mouseMove(&box, QPoint(5, 5), 100); box.showPopup(); QFrame *container = box.findChild<QComboBoxPrivateContainer *>(); QVERIFY(container); - QTest::qWaitForWindowExposed(container); + QVERIFY(QTest::qWaitForWindowExposed(container)); QList<QComboBoxPrivateScroller *> scrollers = container->findChildren<QComboBoxPrivateScroller *>(); // Not all styles support scrollers. We rely only on those platforms that do to catch any regression. @@ -3335,11 +3335,11 @@ void tst_QComboBox::task_QTBUG_56693_itemFontFromModel() box.addItem(QLatin1String("Item ") + QString::number(i)); box.show(); - QTest::qWaitForWindowExposed(&box); + QVERIFY(QTest::qWaitForWindowExposed(&box)); box.showPopup(); QFrame *container = box.findChild<QComboBoxPrivateContainer *>(); QVERIFY(container); - QTest::qWaitForWindowExposed(container); + QVERIFY(QTest::qWaitForWindowExposed(container)); QCOMPARE(proxyStyle->italicItemsNo, 5); diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index f71947e73b..71969ec695 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -1930,7 +1930,7 @@ void tst_QLineEdit::noCursorBlinkWhenReadOnly() centerOnScreen(&le); le.show(); le.setFocus(); - QTest::qWaitForWindowActive(&le); + QVERIFY(QTest::qWaitForWindowActive(&le)); le.updates = 0; QTest::qWait(cursorFlashTime); QVERIFY(le.updates > 0); @@ -3368,7 +3368,7 @@ void tst_QLineEdit::inlineCompletion() completer->setCaseSensitivity(Qt::CaseInsensitive); centerOnScreen(testWidget); testWidget->show(); - QTest::qWaitForWindowExposed(testWidget); + QVERIFY(QTest::qWaitForWindowExposed(testWidget)); testWidget->setFocus(); QTRY_COMPARE(qApp->activeWindow(), (QWidget*)testWidget); testWidget->setCompleter(completer); @@ -3696,7 +3696,7 @@ void tst_QLineEdit::task229938_dontEmitChangedWhenTextIsNotChanged() QLineEdit lineEdit; lineEdit.setMaxLength(5); lineEdit.show(); - QTest::qWaitForWindowExposed(&lineEdit); // to be safe and avoid failing setFocus with window managers + QVERIFY(QTest::qWaitForWindowExposed(&lineEdit)); // to be safe and avoid failing setFocus with window managers lineEdit.setFocus(); QSignalSpy changedSpy(&lineEdit, SIGNAL(textChanged(QString))); QTest::qWait(200); diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp index 292080c55f..30dc1e6043 100644 --- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp @@ -2013,7 +2013,7 @@ void tst_QMainWindow::resizeDocks() mw.setCentralWidget(new QTextEdit); mw.show(); - QTest::qWaitForWindowExposed(&mw); + QVERIFY(QTest::qWaitForWindowExposed(&mw)); QFETCH(Qt::Orientation, orientation); QFETCH(QStringList, docks); diff --git a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp index e10c7591d5..49291cf5f9 100644 --- a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp +++ b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp @@ -80,7 +80,7 @@ void tst_QOpenGLWidget::create() QVERIFY(w->textureFormat() == 0); QSignalSpy frameSwappedSpy(w.data(), SIGNAL(frameSwapped())); w->show(); - QTest::qWaitForWindowExposed(w.data()); + QVERIFY(QTest::qWaitForWindowExposed(w.data())); QVERIFY(frameSwappedSpy.count() > 0); QVERIFY(w->isValid()); @@ -131,7 +131,7 @@ void tst_QOpenGLWidget::clearAndGrab() QScopedPointer<ClearWidget> w(new ClearWidget(0, 800, 600)); w->resize(800, 600); w->show(); - QTest::qWaitForWindowExposed(w.data()); + QVERIFY(QTest::qWaitForWindowExposed(w.data())); QVERIFY(w->m_initCalled); QVERIFY(w->m_resizeCalled); QVERIFY(w->m_resizeOk); @@ -149,7 +149,7 @@ void tst_QOpenGLWidget::clearAndResizeAndGrab() QScopedPointer<QOpenGLWidget> w(new ClearWidget(0, 640, 480)); w->resize(640, 480); w->show(); - QTest::qWaitForWindowExposed(w.data()); + QVERIFY(QTest::qWaitForWindowExposed(w.data())); QImage image = w->grabFramebuffer(); QVERIFY(!image.isNull()); @@ -172,7 +172,7 @@ void tst_QOpenGLWidget::createNonTopLevel() QSignalSpy frameSwappedSpy(glw, SIGNAL(frameSwapped())); w.resize(400, 400); w.show(); - QTest::qWaitForWindowExposed(&w); + QVERIFY(QTest::qWaitForWindowExposed(&w)); QVERIFY(frameSwappedSpy.count() > 0); QVERIFY(glw->m_resizeCalled); @@ -228,7 +228,7 @@ void tst_QOpenGLWidget::painter() w.resize(640, 480); glw->resize(320, 200); w.show(); - QTest::qWaitForWindowExposed(&w); + QVERIFY(QTest::qWaitForWindowExposed(&w)); QImage image = glw->grabFramebuffer(); QCOMPARE(image.width(), glw->width()); @@ -249,11 +249,11 @@ void tst_QOpenGLWidget::reparentToAlreadyCreated() w1.resize(640, 480); glw->resize(320, 200); w1.show(); - QTest::qWaitForWindowExposed(&w1); + QVERIFY(QTest::qWaitForWindowExposed(&w1)); QWidget w2; w2.show(); - QTest::qWaitForWindowExposed(&w2); + QVERIFY(QTest::qWaitForWindowExposed(&w2)); glw->setParent(&w2); glw->show(); @@ -271,12 +271,12 @@ void tst_QOpenGLWidget::reparentToNotYetCreated() w1.resize(640, 480); glw->resize(320, 200); w1.show(); - QTest::qWaitForWindowExposed(&w1); + QVERIFY(QTest::qWaitForWindowExposed(&w1)); QWidget w2; glw->setParent(&w2); w2.show(); - QTest::qWaitForWindowExposed(&w2); + QVERIFY(QTest::qWaitForWindowExposed(&w2)); QImage image = glw->grabFramebuffer(); QCOMPARE(image.width(), 320); @@ -297,12 +297,12 @@ void tst_QOpenGLWidget::reparentHidden() glw->hide(); // Explicitly hidden - QTest::qWaitForWindowExposed(&topLevel1); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel1)); QWidget topLevel2; topLevel2.resize(640, 480); topLevel2.show(); - QTest::qWaitForWindowExposed(&topLevel2); + QVERIFY(QTest::qWaitForWindowExposed(&topLevel2)); QOpenGLContext *originalContext = glw->context(); QVERIFY(originalContext); @@ -353,7 +353,7 @@ void tst_QOpenGLWidget::asViewport() layout->addWidget(btn); widget.setLayout(layout); widget.show(); - QTest::qWaitForWindowExposed(&widget); + QVERIFY(QTest::qWaitForWindowExposed(&widget)); QVERIFY(view->paintCount() > 0); view->resetPaintCount(); @@ -381,7 +381,7 @@ void tst_QOpenGLWidget::requestUpdate() PaintCountWidget w; w.resize(640, 480); w.show(); - QTest::qWaitForWindowExposed(&w); + QVERIFY(QTest::qWaitForWindowExposed(&w)); w.reset(); QCOMPARE(w.m_count, 0); @@ -405,7 +405,7 @@ void tst_QOpenGLWidget::fboRedirect() FboCheckWidget w; w.resize(640, 480); w.show(); - QTest::qWaitForWindowExposed(&w); + QVERIFY(QTest::qWaitForWindowExposed(&w)); // Unlike in paintGL(), the default fbo reported by the context is not affected by the widget, // so we get the real default fbo: either 0 or (on iOS) the fbo associated with the window. @@ -420,7 +420,7 @@ void tst_QOpenGLWidget::showHide() QScopedPointer<ClearWidget> w(new ClearWidget(0, 800, 600)); w->resize(800, 600); w->show(); - QTest::qWaitForWindowExposed(w.data()); + QVERIFY(QTest::qWaitForWindowExposed(w.data())); w->hide(); @@ -432,7 +432,7 @@ void tst_QOpenGLWidget::showHide() w->setClearColor(0, 0, 1); w->show(); - QTest::qWaitForWindowExposed(w.data()); + QVERIFY(QTest::qWaitForWindowExposed(w.data())); image = w->grabFramebuffer(); QVERIFY(!image.isNull()); @@ -447,7 +447,7 @@ void tst_QOpenGLWidget::nativeWindow() w->resize(800, 600); w->show(); w->winId(); - QTest::qWaitForWindowExposed(w.data()); + QVERIFY(QTest::qWaitForWindowExposed(w.data())); QImage image = w->grabFramebuffer(); QVERIFY(!image.isNull()); @@ -466,7 +466,7 @@ void tst_QOpenGLWidget::nativeWindow() child->resize(400, 400); child->move(23, 34); nativeParent.show(); - QTest::qWaitForWindowExposed(&nativeParent); + QVERIFY(QTest::qWaitForWindowExposed(&nativeParent)); QVERIFY(nativeParent.internalWinId()); QVERIFY(!child->internalWinId()); @@ -586,8 +586,8 @@ void tst_QOpenGLWidget::stackWidgetOpaqueChildIsVisible() stack.setCurrentIndex(0); stack.resize(dimensionSize, dimensionSize); stack.show(); - QTest::qWaitForWindowExposed(&stack); - QTest::qWaitForWindowActive(&stack); + QVERIFY(QTest::qWaitForWindowExposed(&stack)); + QVERIFY(QTest::qWaitForWindowActive(&stack)); // Switch to the QOpenGLWidget. stack.setCurrentIndex(1); @@ -666,7 +666,7 @@ void tst_QOpenGLWidget::offscreenThenOnscreen() // now let's make things more challenging: show. Internally this needs // recreating the context. w->show(); - QTest::qWaitForWindowExposed(w.data()); + QVERIFY(QTest::qWaitForWindowExposed(w.data())); image = w->grabFramebuffer(); QVERIFY(!image.isNull()); diff --git a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp index bacab78601..2b54008de7 100644 --- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp +++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp @@ -594,7 +594,7 @@ void tst_QPushButton::taskQTBUG_20191_shortcutWithKeypadModifer() QDialog dialog; dialog.setLayout(layout); dialog.show(); - QTest::qWaitForWindowExposed(&dialog); + QVERIFY(QTest::qWaitForWindowExposed(&dialog)); QApplication::setActiveWindow(&dialog); // add shortcut '5' to button1 and test with keyboard and keypad '5' keys @@ -639,7 +639,7 @@ void tst_QPushButton::emitReleasedAfterChange() QDialog dialog; dialog.setLayout(layout); dialog.show(); - QTest::qWaitForWindowExposed(&dialog); + QVERIFY(QTest::qWaitForWindowExposed(&dialog)); QApplication::setActiveWindow(&dialog); button1->setFocus(); diff --git a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp index 5238eea592..5ef2c7bc50 100644 --- a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp +++ b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp @@ -78,7 +78,7 @@ void tst_QScrollBar::scrollSingleStep() testWidget.resize(100, testWidget.height()); centerOnScreen(&testWidget); testWidget.show(); - QTest::qWaitForWindowExposed(&testWidget); + QVERIFY(QTest::qWaitForWindowExposed(&testWidget)); testWidget.setValue(testWidget.minimum()); QCOMPARE(testWidget.value(), testWidget.minimum()); @@ -117,7 +117,7 @@ void tst_QScrollBar::task_209492() verticalScrollBar->setRange(0, 1000); centerOnScreen(&scrollArea); scrollArea.show(); - QTest::qWaitForWindowExposed(&scrollArea); + QVERIFY(QTest::qWaitForWindowExposed(&scrollArea)); QSignalSpy spy(verticalScrollBar, SIGNAL(actionTriggered(int))); QCOMPARE(scrollArea.scrollCount, 0); @@ -154,7 +154,7 @@ void tst_QScrollBar::QTBUG_27308() testWidget.resize(100, testWidget.height()); centerOnScreen(&testWidget); testWidget.show(); - QTest::qWaitForWindowExposed(&testWidget); + QVERIFY(QTest::qWaitForWindowExposed(&testWidget)); testWidget.setValue(testWidget.minimum()); testWidget.setEnabled(false); @@ -183,7 +183,7 @@ void tst_QScrollBar::QTBUG_42871() scrollBarWidget.resize(100, scrollBarWidget.height()); centerOnScreen(&scrollBarWidget); scrollBarWidget.show(); - QTest::qWaitForWindowExposed(&scrollBarWidget); + QVERIFY(QTest::qWaitForWindowExposed(&scrollBarWidget)); QSignalSpy spy(&scrollBarWidget, SIGNAL(actionTriggered(int))); QVERIFY(spy.isValid()); QCOMPARE(myHandler.updatesCount, 0); diff --git a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp index 72e6ffdeb5..aef4046afe 100644 --- a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp +++ b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp @@ -828,7 +828,7 @@ void tst_QSplitter::handleMinimumWidth() split.addWidget(new QLabel("Number Too")); split.show(); - QTest::qWaitForWindowExposed(&split); + QVERIFY(QTest::qWaitForWindowExposed(&split)); for (int i = 0; i < 10; i++) { split.setHandleWidth(i); QTest::qWait(100); // resizing diff --git a/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp b/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp index 2df5f01627..59a334fab9 100644 --- a/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp +++ b/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp @@ -180,7 +180,7 @@ void tst_QStackedWidget::dynamicPages() sw->resize(200, 200); sw->show(); qApp->setActiveWindow(sw); - QTest::qWaitForWindowActive(sw); + QVERIFY(QTest::qWaitForWindowActive(sw)); QTRY_COMPARE(QApplication::focusWidget(), le11); sw->setCurrentIndex(1); diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp index 55ef44f4e0..5fb6139e87 100644 --- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp @@ -2507,7 +2507,7 @@ void tst_QTextEdit::highlightLongLine() }; NumHighlighter nh(edit.document()); edit.show(); - QTest::qWaitForWindowActive(edit.windowHandle()); + QVERIFY(QTest::qWaitForWindowActive(edit.windowHandle())); QCoreApplication::processEvents(); //If there is a quadratic behaviour, this would take forever. QVERIFY(true); |