Remove usage of deprecated qWaitForWindowShown in dialog tests.
Change-Id: Id3ebe202d65ee682e8e2e3ae107808e9abb6cc15 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This commit is contained in:
parent
d38fb0b535
commit
607c37befb
@ -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);
|
||||
|
@ -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<QListView*>(&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<QLineEdit*>(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<QWidget*>(&fd));
|
||||
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
||||
QCOMPARE(fd.isVisible(), true);
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
||||
qApp->processEvents();
|
||||
|
||||
// make sure the tests work with focus follows mouse
|
||||
|
@ -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<QWidget*>(&fd));
|
||||
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
||||
QCOMPARE(fd.isVisible(), true);
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
||||
|
||||
QTest::qWait(250);
|
||||
QLineEdit *lineEdit = qFindChild<QLineEdit*>(&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<QWidget*>(&fd));
|
||||
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
||||
QCOMPARE(fd.isVisible(), true);
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
||||
|
||||
QFileSystemModel *model = qFindChild<QFileSystemModel*>(&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<QWidget*>(&fd));
|
||||
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
||||
QCOMPARE(fd.isVisible(), true);
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
||||
|
||||
QComboBox *filters = qFindChild<QComboBox*>(&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<QWidget*>(&fd2));
|
||||
QVERIFY(QTest::qWaitForWindowActive(&fd2));
|
||||
QCOMPARE(fd2.isVisible(), true);
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd2));
|
||||
|
||||
QComboBox *filters2 = qFindChild<QComboBox*>(&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<QWidget*>(&fd));
|
||||
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
||||
QCOMPARE(fd.isVisible(), true);
|
||||
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
||||
|
||||
fd.setDirectory("");
|
||||
QLineEdit *lineEdit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
|
||||
|
@ -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<QLabel*>(&dlg)->sizeHint().height();
|
||||
dlg.setLabel(0);
|
||||
QTest::ignoreMessage(QtWarningMsg, "QProgressDialog::setBar: Cannot set a null progress bar");
|
||||
|
@ -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<QLabel *>(&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);
|
||||
|
Loading…
Reference in New Issue
Block a user