tst_QFiledialog: use escape to close dialogs instead of timer

This makes the test a lot faster and perhaps more reliable.

Change-Id: I055cfde627c75f71735eabbf01af2a196bd8b00a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Mitch Curtis 2017-05-24 16:06:28 +02:00
parent e579c822c5
commit 64a4216254

View File

@ -1463,10 +1463,7 @@ class DialogRejecter : public QObject
public:
DialogRejecter()
{
QTimer *timer = new QTimer(this);
timer->setInterval(1000);
connect(timer, &QTimer::timeout, this, &DialogRejecter::rejectFileDialog);
timer->start();
connect(qApp, &QApplication::focusChanged, this, &DialogRejecter::rejectFileDialog);
}
public slots:
@ -1474,7 +1471,7 @@ public slots:
{
if (QWidget *w = QApplication::activeModalWidget())
if (QDialog *d = qobject_cast<QDialog *>(w))
d->reject();
QTest::keyClick(d, Qt::Key_Escape);
}
};