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;
|
TestRejectDialog dialog;
|
||||||
dialog.show();
|
dialog.show();
|
||||||
QTest::qWaitForWindowShown(&dialog);
|
QVERIFY(QTest::qWaitForWindowExposed(&dialog));
|
||||||
QTRY_VERIFY(dialog.isVisible());
|
QVERIFY(dialog.isVisible());
|
||||||
dialog.reject();
|
dialog.reject();
|
||||||
QTRY_VERIFY(!dialog.isVisible());
|
QTRY_VERIFY(!dialog.isVisible());
|
||||||
QCOMPARE(dialog.called, 1);
|
QCOMPARE(dialog.called, 1);
|
||||||
|
|
||||||
dialog.show();
|
dialog.show();
|
||||||
QTest::qWaitForWindowShown(&dialog);
|
QVERIFY(QTest::qWaitForWindowExposed(&dialog));
|
||||||
QTRY_VERIFY(dialog.isVisible());
|
QVERIFY(dialog.isVisible());
|
||||||
QVERIFY(dialog.close());
|
QVERIFY(dialog.close());
|
||||||
QTRY_VERIFY(!dialog.isVisible());
|
QTRY_VERIFY(!dialog.isVisible());
|
||||||
QCOMPARE(dialog.called, 2);
|
QCOMPARE(dialog.called, 2);
|
||||||
|
|
||||||
dialog.cancelReject = true;
|
dialog.cancelReject = true;
|
||||||
dialog.show();
|
dialog.show();
|
||||||
QTest::qWaitForWindowShown(&dialog);
|
QVERIFY(QTest::qWaitForWindowExposed(&dialog));
|
||||||
QTRY_VERIFY(dialog.isVisible());
|
QVERIFY(dialog.isVisible());
|
||||||
dialog.reject();
|
dialog.reject();
|
||||||
QTRY_VERIFY(dialog.isVisible());
|
QTRY_VERIFY(dialog.isVisible());
|
||||||
QCOMPARE(dialog.called, 3);
|
QCOMPARE(dialog.called, 3);
|
||||||
|
@ -286,7 +286,7 @@ void tst_QFiledialog::filesSelectedSignal()
|
|||||||
QSignalSpy spyFilesSelected(&fd, SIGNAL(filesSelected(const QStringList &)));
|
QSignalSpy spyFilesSelected(&fd, SIGNAL(filesSelected(const QStringList &)));
|
||||||
|
|
||||||
fd.show();
|
fd.show();
|
||||||
QTest::qWait(500);
|
QVERIFY(QTest::qWaitForWindowExposed(&fd));
|
||||||
QListView *listView = qFindChild<QListView*>(&fd, "listView");
|
QListView *listView = qFindChild<QListView*>(&fd, "listView");
|
||||||
QVERIFY(listView);
|
QVERIFY(listView);
|
||||||
|
|
||||||
@ -938,7 +938,7 @@ void tst_QFiledialog::selectFiles()
|
|||||||
QString temporary = QDir::tempPath() + QLatin1String("/blah");
|
QString temporary = QDir::tempPath() + QLatin1String("/blah");
|
||||||
dialog->selectFile(temporary);
|
dialog->selectFile(temporary);
|
||||||
dialog->show();
|
dialog->show();
|
||||||
QTest::qWait(500);
|
QVERIFY(QTest::qWaitForWindowExposed(dialog));
|
||||||
QLineEdit *lineEdit = qFindChild<QLineEdit*>(dialog, "fileNameEdit");
|
QLineEdit *lineEdit = qFindChild<QLineEdit*>(dialog, "fileNameEdit");
|
||||||
QVERIFY(lineEdit);
|
QVERIFY(lineEdit);
|
||||||
QCOMPARE(lineEdit->text(),QLatin1String("blah"));
|
QCOMPARE(lineEdit->text(),QLatin1String("blah"));
|
||||||
@ -1012,9 +1012,9 @@ void tst_QFiledialog::focus()
|
|||||||
fd.setDirectory(QDir::currentPath());
|
fd.setDirectory(QDir::currentPath());
|
||||||
fd.show();
|
fd.show();
|
||||||
QApplication::setActiveWindow(&fd);
|
QApplication::setActiveWindow(&fd);
|
||||||
QTest::qWaitForWindowShown(&fd);
|
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
||||||
QTRY_COMPARE(fd.isVisible(), true);
|
QCOMPARE(fd.isVisible(), true);
|
||||||
QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
|
|
||||||
// make sure the tests work with focus follows mouse
|
// make sure the tests work with focus follows mouse
|
||||||
|
@ -1104,14 +1104,14 @@ void tst_QFileDialog2::QTBUG4419_lineEditSelectAll()
|
|||||||
|
|
||||||
fd.show();
|
fd.show();
|
||||||
QApplication::setActiveWindow(&fd);
|
QApplication::setActiveWindow(&fd);
|
||||||
QTest::qWaitForWindowShown(&fd);
|
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
||||||
QTRY_COMPARE(fd.isVisible(), true);
|
QCOMPARE(fd.isVisible(), true);
|
||||||
QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
||||||
|
|
||||||
QTest::qWait(250);
|
|
||||||
QLineEdit *lineEdit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
|
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());
|
QCOMPARE(tempPath + QChar('/') + lineEdit->selectedText(), t->fileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1147,9 +1147,9 @@ void tst_QFileDialog2::QTBUG6558_showDirsOnly()
|
|||||||
fd.show();
|
fd.show();
|
||||||
|
|
||||||
QApplication::setActiveWindow(&fd);
|
QApplication::setActiveWindow(&fd);
|
||||||
QTest::qWaitForWindowShown(&fd);
|
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
||||||
QTRY_COMPARE(fd.isVisible(), true);
|
QCOMPARE(fd.isVisible(), true);
|
||||||
QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
||||||
|
|
||||||
QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
|
QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
|
||||||
QTRY_COMPARE(model->rowCount(model->index(dir.absolutePath())), 2);
|
QTRY_COMPARE(model->rowCount(model->index(dir.absolutePath())), 2);
|
||||||
@ -1195,9 +1195,9 @@ void tst_QFileDialog2::QTBUG4842_selectFilterWithHideNameFilterDetails()
|
|||||||
fd.show();
|
fd.show();
|
||||||
|
|
||||||
QApplication::setActiveWindow(&fd);
|
QApplication::setActiveWindow(&fd);
|
||||||
QTest::qWaitForWindowShown(&fd);
|
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
||||||
QTRY_COMPARE(fd.isVisible(), true);
|
QCOMPARE(fd.isVisible(), true);
|
||||||
QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
||||||
|
|
||||||
QComboBox *filters = qFindChild<QComboBox*>(&fd, "fileTypeCombo");
|
QComboBox *filters = qFindChild<QComboBox*>(&fd, "fileTypeCombo");
|
||||||
//We compare the current combobox text with the stripped version
|
//We compare the current combobox text with the stripped version
|
||||||
@ -1211,9 +1211,9 @@ void tst_QFileDialog2::QTBUG4842_selectFilterWithHideNameFilterDetails()
|
|||||||
fd2.show();
|
fd2.show();
|
||||||
|
|
||||||
QApplication::setActiveWindow(&fd2);
|
QApplication::setActiveWindow(&fd2);
|
||||||
QTest::qWaitForWindowShown(&fd2);
|
QVERIFY(QTest::qWaitForWindowActive(&fd2));
|
||||||
QTRY_COMPARE(fd2.isVisible(), true);
|
QCOMPARE(fd2.isVisible(), true);
|
||||||
QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd2));
|
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd2));
|
||||||
|
|
||||||
QComboBox *filters2 = qFindChild<QComboBox*>(&fd2, "fileTypeCombo");
|
QComboBox *filters2 = qFindChild<QComboBox*>(&fd2, "fileTypeCombo");
|
||||||
//We compare the current combobox text with the non stripped version
|
//We compare the current combobox text with the non stripped version
|
||||||
@ -1228,9 +1228,9 @@ void tst_QFileDialog2::dontShowCompleterOnRoot()
|
|||||||
fd.show();
|
fd.show();
|
||||||
|
|
||||||
QApplication::setActiveWindow(&fd);
|
QApplication::setActiveWindow(&fd);
|
||||||
QTest::qWaitForWindowShown(&fd);
|
QVERIFY(QTest::qWaitForWindowActive(&fd));
|
||||||
QTRY_COMPARE(fd.isVisible(), true);
|
QCOMPARE(fd.isVisible(), true);
|
||||||
QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
QCOMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
|
||||||
|
|
||||||
fd.setDirectory("");
|
fd.setDirectory("");
|
||||||
QLineEdit *lineEdit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
|
QLineEdit *lineEdit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
|
||||||
|
@ -140,7 +140,7 @@ void tst_QProgressDialog::task198202()
|
|||||||
//should not crash
|
//should not crash
|
||||||
QProgressDialog dlg(QLatin1String("test"),QLatin1String("test"),1,10);
|
QProgressDialog dlg(QLatin1String("test"),QLatin1String("test"),1,10);
|
||||||
dlg.show();
|
dlg.show();
|
||||||
QTest::qWait(20);
|
QVERIFY(QTest::qWaitForWindowExposed(&dlg));
|
||||||
int futureHeight = dlg.sizeHint().height() - qFindChild<QLabel*>(&dlg)->sizeHint().height();
|
int futureHeight = dlg.sizeHint().height() - qFindChild<QLabel*>(&dlg)->sizeHint().height();
|
||||||
dlg.setLabel(0);
|
dlg.setLabel(0);
|
||||||
QTest::ignoreMessage(QtWarningMsg, "QProgressDialog::setBar: Cannot set a null progress bar");
|
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);
|
int idx = wizard.addPage(&page);
|
||||||
wizard.setStartId(idx);
|
wizard.setStartId(idx);
|
||||||
wizard.show();
|
wizard.show();
|
||||||
QTest::qWait(100);
|
QVERIFY(QTest::qWaitForWindowExposed(&wizard));
|
||||||
|
|
||||||
foreach (QLabel *subtitleLabel, qFindChildren<QLabel *>(&wizard)) {
|
foreach (QLabel *subtitleLabel, qFindChildren<QLabel *>(&wizard)) {
|
||||||
if (subtitleLabel->text().startsWith("SUBTITLE#")) {
|
if (subtitleLabel->text().startsWith("SUBTITLE#")) {
|
||||||
@ -2569,7 +2569,8 @@ void tst_QWizard::task177022_setFixedSize()
|
|||||||
QCOMPARE(wiz.maximumHeight(), height);
|
QCOMPARE(wiz.maximumHeight(), height);
|
||||||
|
|
||||||
wiz.show();
|
wiz.show();
|
||||||
QTest::qWait(100);
|
QVERIFY(QTest::qWaitForWindowExposed(&wiz));
|
||||||
|
|
||||||
QCOMPARE(wiz.size(), QSize(width, height));
|
QCOMPARE(wiz.size(), QSize(width, height));
|
||||||
QCOMPARE(wiz.minimumWidth(), width);
|
QCOMPARE(wiz.minimumWidth(), width);
|
||||||
QCOMPARE(wiz.minimumHeight(), height);
|
QCOMPARE(wiz.minimumHeight(), height);
|
||||||
@ -2601,7 +2602,8 @@ void tst_QWizard::task248107_backButton()
|
|||||||
wizard.addPage(&page4);
|
wizard.addPage(&page4);
|
||||||
|
|
||||||
wizard.show();
|
wizard.show();
|
||||||
QTest::qWait(100);
|
QVERIFY(QTest::qWaitForWindowExposed(&wizard));
|
||||||
|
|
||||||
QCOMPARE(wizard.currentPage(), &page1);
|
QCOMPARE(wizard.currentPage(), &page1);
|
||||||
|
|
||||||
QTest::mouseClick(wizard.button(QWizard::NextButton), Qt::LeftButton);
|
QTest::mouseClick(wizard.button(QWizard::NextButton), Qt::LeftButton);
|
||||||
|
Loading…
Reference in New Issue
Block a user