summaryrefslogtreecommitdiff
path: root/tests/auto/widgets/dialogs
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2017-05-24 16:06:28 +0200
committerMitch Curtis <mitch.curtis@qt.io>2017-05-30 07:19:42 +0000
commit64a4216254a49ae0ba946717599c4f52dac978c5 (patch)
tree71b36076735c28805f40249437d7e86ce7aeddc4 /tests/auto/widgets/dialogs
parente579c822c5bedf5e626e4eb72db3b49a4a4015dc (diff)
downloadqtbase-64a4216254a49ae0ba946717599c4f52dac978c5.tar.gz
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>
Diffstat (limited to 'tests/auto/widgets/dialogs')
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
index 44cb5a5bf8..8d209fc241 100644
--- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
@@ -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);
}
};