aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2021-05-04 23:37:57 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2021-05-04 23:40:51 +0200
commit9dacc312e5b0f5aeb0f8370f4f7722b57754a3c2 (patch)
treec2e66dcf9f5ee3eac9fdf63dc0fbbf0695f78a75 /tests
parent7642205be45135add120373299df02e05f4ffc58 (diff)
Use inexact comparison in tst_QQuickPinchArea::dragTransformedPinchArea
When rotating the parent by arbitrary angles and repeating the same pinch gestures, the actual displacement is not always quite consistent due to roundoff error. Within ±1 is close enough for testing. Task-number: QTBUG-63673 Change-Id: Ia193c4ff2a672b15443b445519d691e1342e57e9 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp
index 7375804893..55fb07f744 100644
--- a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp
+++ b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp
@@ -631,7 +631,10 @@ void tst_QQuickPinchArea::dragTransformedPinchArea() // QTBUG-63673
.move(2, pinchArea->mapToScene(p2 + delta).toPoint(), view).commit();
QQuickTouchUtils::flush(view);
QCOMPARE(pinchArea->pinch()->active(), true);
- QCOMPARE(pinchAreaTarget->position().toPoint(), delta - QPoint(threshold, threshold));
+ auto error = delta - QPoint(threshold, threshold) -
+ pinchAreaTarget->position().toPoint(); // expect 0, 0
+ QVERIFY(qAbs(error.x()) <= 1);
+ QVERIFY(qAbs(error.y()) <= 1);
// release pinch
pinchSequence.release(1, p1, view).release(2, p2, view).commit();