diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp index d02b86bd8a..7e0b0dac0c 100644 --- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp @@ -1726,9 +1726,8 @@ void tst_QMainWindow::addToolbarAfterShow() QToolBar toolBar; mainWindow.addToolBar(&toolBar); - QTest::qWait(100); - QVERIFY(!toolBar.isHidden()); + QTRY_VERIFY(!toolBar.isHidden()); } void tst_QMainWindow::centralWidgetSize() @@ -1743,8 +1742,7 @@ void tst_QMainWindow::centralWidgetSize() mainWindow.setCentralWidget(&widget); mainWindow.show(); - QTest::qWait(100); - QCOMPARE(widget.size(), widget.sizeHint()); + QTRY_COMPARE(widget.size(), widget.sizeHint()); } void tst_QMainWindow::dockWidgetSize() @@ -1789,19 +1787,15 @@ void tst_QMainWindow::QTBUG2774_stylechange() { - QTest::qWait(1000); mw.setStyleSheet("QMainWindow::separator { width: 50px; height:50px; }"); - QTest::qWait(5000); - QApplication::processEvents(); - QVERIFY(central->width() < centralOriginalWidth); + QTRY_VERIFY(central->width() < centralOriginalWidth); QVERIFY( mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height()))); QVERIFY( mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height() + 49))); } { mw.setStyleSheet("QMainWindow::separator { width: 0px; height: 0px; }"); - QApplication::processEvents(); - QVERIFY(central->width() > centralOriginalWidth); + QTRY_VERIFY(central->width() > centralOriginalWidth); QVERIFY(!mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height()))); QVERIFY(!mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height() + 1))); } diff --git a/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp b/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp index a301d51c4c..8dd191e621 100644 --- a/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp +++ b/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp @@ -127,9 +127,7 @@ void tst_QStatusBar::tempMessage() QCOMPARE(testWidget->currentMessage(), QString("Ready")); QCOMPARE(testWidget->currentMessage(), currentMessage); - QTest::qWait(1000); - - QVERIFY(testWidget->currentMessage().isNull()); + QTRY_VERIFY(testWidget->currentMessage().isNull()); QVERIFY(currentMessage.isNull()); testWidget->showMessage("Ready again", 500); @@ -294,10 +292,10 @@ void tst_QStatusBar::QTBUG25492_msgtimeout() QCOMPARE(testWidget->currentMessage(), QString("Ready")); QCOMPARE(testWidget->currentMessage(), currentMessage); - QTest::qWait(3000); + QTest::qWait(1500); // Message disappears after 2 seconds - QVERIFY(testWidget->currentMessage().isNull()); + QTRY_VERIFY(testWidget->currentMessage().isNull()); QVERIFY(currentMessage.isNull()); // Set display message for 2 seconds first