diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-12-01 18:55:30 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-12-12 18:45:49 +0100 |
commit | 2482a00596f3bbfe2fd429ccaffa4b1927092293 (patch) | |
tree | 5b185b399fdc4dc696ccb2ce83a32fd3e677e173 /tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp | |
parent | 71db3d449e9f42d6af614e63acc81401f8fcfa14 (diff) |
PinchHandler: don't confine activeScale and activeRotation to min/max
It was inconsistent to do this for the active values only on one
handler's axis objects. The main purpose of the minimum and maximum
values is to avoid modifying the target item's respective properties
beyond reasonable limits, whereas the active values are supposed to be
derived directly from the gesture. If the users modify target properties
based on active values, or based on the activeValueChanged signal
argument, they need to enforce the property limits themselves.
[ChangeLog][QtQuick][Event Handlers] PinchHandler's activeScale (which
was previously called scale) is no longer restricted to the range
between minimumScale and maximumScale: these limits apply only to
persistentScale. Likewise, activeRotation (previously rotation)
is no longer restricted to the range between minimumRotation and
maximumRotation.
Change-Id: I5757e3d931e6165c81cecff19fc30b50033d89ce
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp')
-rw-r--r-- | tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp b/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp index 340ab4b184..973a4eab5f 100644 --- a/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp @@ -403,8 +403,12 @@ void tst_QQuickPinchHandler::scaleThreeFingers() QVERIFY(withinBounds(1.163, pinchHandler->scale(), 1.183)); // should not rotate QCOMPARE(root->rotation(), 0); - QCOMPARE(pinchHandler->rotation(), 0); - QCOMPARE(pinchHandler->rotationAxis()->activeValue(), 0); + // rotation should be 0, but could be something tiny + qCDebug(lcPointerTests) << "pinch scale expected zero:" << pinchHandler->rotation() + << pinchHandler->rotationAxis()->activeValue() + << pinchHandler->rotationAxis()->persistentValue(); + QCOMPARE_LE(qAbs(pinchHandler->rotation()), 0.001); + QCOMPARE(pinchHandler->rotationAxis()->activeValue(), pinchHandler->rotation()); QCOMPARE(pinchHandler->rotationAxis()->persistentValue(), 0); for (int i = 0; i < 5;++i) { @@ -489,8 +493,8 @@ void tst_QQuickPinchHandler::scaleNativeGesture() QVERIFY(qAbs(target->position().x() - expectedPos.x()) < 0.001); QVERIFY(qAbs(target->position().y() - expectedPos.y()) < 0.001); QCOMPARE(pinchHandler->scale(), expectedScale); - QCOMPARE(pinchHandler->activeScale(), expectedScale); - QCOMPARE(pinchHandler->scaleAxis()->activeValue(), expectedScale); + QCOMPARE(pinchHandler->activeScale(), scale); + QCOMPARE(pinchHandler->scaleAxis()->activeValue(), scale); QCOMPARE(pinchHandler->translation(), QVector2D()); QCOMPARE(pinchHandler->rotation(), 0); QCOMPARE(pinchHandler->rotationAxis()->persistentValue(), 0); |