summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTimur Pocheptsov <Timur.Pocheptsov@digia.com>2015-05-13 09:55:03 +0200
committerCaroline Chao <caroline.chao@theqtcompany.com>2015-05-15 09:39:41 +0000
commit1485c2f3fac4fb3819f6d6f493665308bba726c2 (patch)
treef18e656d898e54154f9a99ed8b6a3caa0b29a78a /tests
parent1842322b2b18467e8641e89a9f2356c9f1ba044a (diff)
tst_QDialog::snapToDefaultButton - tune the test for OS X
QCursor::setPos with Cocoa integration is calling CGEventPost. Some time is required before the cursor position is really set, so we can not immediately call QCOMPARE. Change-Id: I83a4c13f06ec151a4b9ab18c83de1eb5247ea9cc Task-number: QTBUG-45553 Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com> Reviewed-by: Caroline Chao <caroline.chao@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
index fecc14f541..e62ce3ceb5 100644
--- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
+++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
@@ -564,6 +564,11 @@ void tst_QDialog::snapToDefaultButton()
topLeftPos = QPoint(topLeftPos.x() + 100, topLeftPos.y() + 100);
QPoint startingPos(topLeftPos.x() + 250, topLeftPos.y() + 250);
QCursor::setPos(startingPos);
+#ifdef Q_OS_OSX
+ // On OS X we use CGEventPost to move the cursor, it needs at least
+ // some time before the event handled and the position really set.
+ QTest::qWait(100);
+#endif
QCOMPARE(QCursor::pos(), startingPos);
QDialog dialog;
QPushButton *button = new QPushButton(&dialog);