From dd3c4cb9bfc965ae40e914216862fbb350c55992 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Fri, 14 Jan 2022 13:17:46 +0100 Subject: [PATCH] Stabilize tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad The test is impacted by the position of the mouse cursor, and fails if the mouse enters the test window when it gets shown. Try to move the cursor away from the window. As a drive-by, const'ify some of the local variables. Revert 7b4b5115ddb2d492c476942090a3fa7992e9fa7d by removing the blacklisting of the test on macOS in CI. Pick-to: 6.3 6.2 Change-Id: Ia0c554fdf161fd4eb4aa3965e937c7db8ceeef8f Reviewed-by: Shawn Rutledge --- tests/auto/gui/kernel/qtouchevent/BLACKLIST | 2 -- .../kernel/qtouchevent/tst_qtouchevent.cpp | 21 +++++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/tests/auto/gui/kernel/qtouchevent/BLACKLIST b/tests/auto/gui/kernel/qtouchevent/BLACKLIST index ab95a5a08a..2876c120fc 100644 --- a/tests/auto/gui/kernel/qtouchevent/BLACKLIST +++ b/tests/auto/gui/kernel/qtouchevent/BLACKLIST @@ -4,7 +4,5 @@ ubuntu-16.04 android [multiPointRawEventTranslationOnTouchPad] android -# QTBUG-99489 -macos ci [touchBeginWithGraphicsWidget] android diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp index b433912096..df4e8bd87d 100644 --- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp +++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp @@ -26,6 +26,7 @@ ** ****************************************************************************/ +#include #include #include #include @@ -1140,6 +1141,14 @@ void tst_QTouchEvent::touchOnMultipleTouchscreens() void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad() { +#ifdef Q_OS_MACOS +#if QT_CONFIG(cursor) + QCursor::setPos(0, 0); // move mouse out of the way + if (!QTest::qWaitFor([]{ return QCursor::pos() == QPoint(0, 0); })) +#endif + QSKIP("The macOS mouse cursor interferes with this test can cannot be moved away"); +#endif + tst_QTouchEventWidget touchWidget; touchWidget.setObjectName("touchWidget"); touchWidget.setWindowTitle(QTest::currentTestFunction()); @@ -1160,12 +1169,12 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad() touchWidget.show(); QVERIFY(QTest::qWaitForWindowExposed(&touchWidget)); - QPointF leftPos = leftWidget.rect().center(); - QPointF rightPos = rightWidget.rect().center(); - QPointF centerPos = touchWidget.rect().center(); - QPointF leftScreenPos = leftWidget.mapToGlobal(leftPos.toPoint()); - QPointF rightScreenPos = rightWidget.mapToGlobal(rightPos.toPoint()); - QPointF centerScreenPos = touchWidget.mapToGlobal(centerPos.toPoint()); + const QPointF leftPos = leftWidget.rect().center(); + const QPointF rightPos = rightWidget.rect().center(); + const QPointF centerPos = touchWidget.rect().center(); + const QPointF leftScreenPos = leftWidget.mapToGlobal(leftPos.toPoint()); + const QPointF rightScreenPos = rightWidget.mapToGlobal(rightPos.toPoint()); + const QPointF centerScreenPos = touchWidget.mapToGlobal(centerPos.toPoint()); ulong timestamp = 0; QList rawTouchPoints;