diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp index c23ccc8618..99963ce9a5 100644 --- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp +++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp @@ -524,23 +524,23 @@ void tst_QDialog::reject() { TestRejectDialog dialog; dialog.show(); - QTest::qWaitForWindowShown(&dialog); - QTRY_VERIFY(dialog.isVisible()); + QVERIFY(QTest::qWaitForWindowExposed(&dialog)); + QVERIFY(dialog.isVisible()); dialog.reject(); QTRY_VERIFY(!dialog.isVisible()); QCOMPARE(dialog.called, 1); dialog.show(); - QTest::qWaitForWindowShown(&dialog); - QTRY_VERIFY(dialog.isVisible()); + QVERIFY(QTest::qWaitForWindowExposed(&dialog)); + QVERIFY(dialog.isVisible()); QVERIFY(dialog.close()); QTRY_VERIFY(!dialog.isVisible()); QCOMPARE(dialog.called, 2); dialog.cancelReject = true; dialog.show(); - QTest::qWaitForWindowShown(&dialog); - QTRY_VERIFY(dialog.isVisible()); + QVERIFY(QTest::qWaitForWindowExposed(&dialog)); + QVERIFY(dialog.isVisible()); dialog.reject(); QTRY_VERIFY(dialog.isVisible()); QCOMPARE(dialog.called, 3); diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index 98ea8f4ac7..b50e32c8ea 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -286,7 +286,7 @@ void tst_QFiledialog::filesSelectedSignal() QSignalSpy spyFilesSelected(&fd, SIGNAL(filesSelected(const QStringList &))); fd.show(); - QTest::qWait(500); + QVERIFY(QTest::qWaitForWindowExposed(&fd)); QListView *listView = qFindChild(&fd, "listView"); QVERIFY(listView); @@ -938,7 +938,7 @@ void tst_QFiledialog::selectFiles() QString temporary = QDir::tempPath() + QLatin1String("/blah"); dialog->selectFile(temporary); dialog->show(); - QTest::qWait(500); + QVERIFY(QTest::qWaitForWindowExposed(dialog)); QLineEdit *lineEdit = qFindChild(dialog, "fileNameEdit"); QVERIFY(lineEdit); QCOMPARE(lineEdit->text(),QLatin1String("blah")); @@ -1012,9 +1012,9 @@ void tst_QFiledialog::focus() fd.setDirectory(QDir::currentPath()); fd.show(); QApplication::setActiveWindow(&fd); - QTest::qWaitForWindowShown(&fd); - QTRY_COMPARE(fd.isVisible(), true); - QTRY_COMPARE(QApplication::activeWindow(), static_cast(&fd)); + QVERIFY(QTest::qWaitForWindowActive(&fd)); + QCOMPARE(fd.isVisible(), true); + QCOMPARE(QApplication::activeWindow(), static_cast(&fd)); qApp->processEvents(); // make sure the tests work with focus follows mouse diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp index 1bf9409584..3506057521 100644 --- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp @@ -1104,14 +1104,14 @@ void tst_QFileDialog2::QTBUG4419_lineEditSelectAll() fd.show(); QApplication::setActiveWindow(&fd); - QTest::qWaitForWindowShown(&fd); - QTRY_COMPARE(fd.isVisible(), true); - QTRY_COMPARE(QApplication::activeWindow(), static_cast(&fd)); + QVERIFY(QTest::qWaitForWindowActive(&fd)); + QCOMPARE(fd.isVisible(), true); + QCOMPARE(QApplication::activeWindow(), static_cast(&fd)); - QTest::qWait(250); QLineEdit *lineEdit = qFindChild(&fd, "fileNameEdit"); + QVERIFY(lineEdit); - QCOMPARE(tempPath + QChar('/') + lineEdit->text(), t->fileName()); + QTRY_COMPARE(tempPath + QChar('/') + lineEdit->text(), t->fileName()); QCOMPARE(tempPath + QChar('/') + lineEdit->selectedText(), t->fileName()); } @@ -1147,9 +1147,9 @@ void tst_QFileDialog2::QTBUG6558_showDirsOnly() fd.show(); QApplication::setActiveWindow(&fd); - QTest::qWaitForWindowShown(&fd); - QTRY_COMPARE(fd.isVisible(), true); - QTRY_COMPARE(QApplication::activeWindow(), static_cast(&fd)); + QVERIFY(QTest::qWaitForWindowActive(&fd)); + QCOMPARE(fd.isVisible(), true); + QCOMPARE(QApplication::activeWindow(), static_cast(&fd)); QFileSystemModel *model = qFindChild(&fd, "qt_filesystem_model"); QTRY_COMPARE(model->rowCount(model->index(dir.absolutePath())), 2); @@ -1195,9 +1195,9 @@ void tst_QFileDialog2::QTBUG4842_selectFilterWithHideNameFilterDetails() fd.show(); QApplication::setActiveWindow(&fd); - QTest::qWaitForWindowShown(&fd); - QTRY_COMPARE(fd.isVisible(), true); - QTRY_COMPARE(QApplication::activeWindow(), static_cast(&fd)); + QVERIFY(QTest::qWaitForWindowActive(&fd)); + QCOMPARE(fd.isVisible(), true); + QCOMPARE(QApplication::activeWindow(), static_cast(&fd)); QComboBox *filters = qFindChild(&fd, "fileTypeCombo"); //We compare the current combobox text with the stripped version @@ -1211,9 +1211,9 @@ void tst_QFileDialog2::QTBUG4842_selectFilterWithHideNameFilterDetails() fd2.show(); QApplication::setActiveWindow(&fd2); - QTest::qWaitForWindowShown(&fd2); - QTRY_COMPARE(fd2.isVisible(), true); - QTRY_COMPARE(QApplication::activeWindow(), static_cast(&fd2)); + QVERIFY(QTest::qWaitForWindowActive(&fd2)); + QCOMPARE(fd2.isVisible(), true); + QCOMPARE(QApplication::activeWindow(), static_cast(&fd2)); QComboBox *filters2 = qFindChild(&fd2, "fileTypeCombo"); //We compare the current combobox text with the non stripped version @@ -1228,9 +1228,9 @@ void tst_QFileDialog2::dontShowCompleterOnRoot() fd.show(); QApplication::setActiveWindow(&fd); - QTest::qWaitForWindowShown(&fd); - QTRY_COMPARE(fd.isVisible(), true); - QTRY_COMPARE(QApplication::activeWindow(), static_cast(&fd)); + QVERIFY(QTest::qWaitForWindowActive(&fd)); + QCOMPARE(fd.isVisible(), true); + QCOMPARE(QApplication::activeWindow(), static_cast(&fd)); fd.setDirectory(""); QLineEdit *lineEdit = qFindChild(&fd, "fileNameEdit"); diff --git a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp index 8da5973d91..63e8373211 100644 --- a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp +++ b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp @@ -140,7 +140,7 @@ void tst_QProgressDialog::task198202() //should not crash QProgressDialog dlg(QLatin1String("test"),QLatin1String("test"),1,10); dlg.show(); - QTest::qWait(20); + QVERIFY(QTest::qWaitForWindowExposed(&dlg)); int futureHeight = dlg.sizeHint().height() - qFindChild(&dlg)->sizeHint().height(); dlg.setLabel(0); QTest::ignoreMessage(QtWarningMsg, "QProgressDialog::setBar: Cannot set a null progress bar"); diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp index 362c269e6f..a51717fa47 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp @@ -2537,7 +2537,7 @@ void tst_QWizard::task161658_alignments() int idx = wizard.addPage(&page); wizard.setStartId(idx); wizard.show(); - QTest::qWait(100); + QVERIFY(QTest::qWaitForWindowExposed(&wizard)); foreach (QLabel *subtitleLabel, qFindChildren(&wizard)) { if (subtitleLabel->text().startsWith("SUBTITLE#")) { @@ -2569,7 +2569,8 @@ void tst_QWizard::task177022_setFixedSize() QCOMPARE(wiz.maximumHeight(), height); wiz.show(); - QTest::qWait(100); + QVERIFY(QTest::qWaitForWindowExposed(&wiz)); + QCOMPARE(wiz.size(), QSize(width, height)); QCOMPARE(wiz.minimumWidth(), width); QCOMPARE(wiz.minimumHeight(), height); @@ -2601,7 +2602,8 @@ void tst_QWizard::task248107_backButton() wizard.addPage(&page4); wizard.show(); - QTest::qWait(100); + QVERIFY(QTest::qWaitForWindowExposed(&wizard)); + QCOMPARE(wizard.currentPage(), &page1); QTest::mouseClick(wizard.button(QWizard::NextButton), Qt::LeftButton);