From 1485c2f3fac4fb3819f6d6f493665308bba726c2 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Wed, 13 May 2015 09:55:03 +0200 Subject: [PATCH] tst_QDialog::snapToDefaultButton - tune the test for OS X MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Caroline Chao --- tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp index fecc14f541e..e62ce3ceb5c 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);