diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-05-29 14:02:03 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-06-07 20:10:12 +0000 |
commit | eb926dc31f2a3e7fa287889ba478225ed2498a39 (patch) | |
tree | f5e26176644a5ddfdfdcdf21dde44cdb6b030121 /tests/auto/widgets/gestures | |
parent | 6468cf4e79cca74fa3704c1a1c03fc5da3778416 (diff) |
QSwipeGestureRecognizer: Allow for small direction changes.
When trying to do a straight right/left/up/down swipe, a minimal
change in the other direction caused to the gesture to be canceled.
Introduce a threshold for checking such to prevent this.
Task-number: QTBUG-46195
Change-Id: I3e199f2ec0c81d23a16073b1f5b8fff004958239
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Diffstat (limited to 'tests/auto/widgets/gestures')
-rw-r--r-- | tests/auto/widgets/gestures/qgesturerecognizer/tst_qgesturerecognizer.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/auto/widgets/gestures/qgesturerecognizer/tst_qgesturerecognizer.cpp b/tests/auto/widgets/gestures/qgesturerecognizer/tst_qgesturerecognizer.cpp index 67c431d16e..dc2adad5da 100644 --- a/tests/auto/widgets/gestures/qgesturerecognizer/tst_qgesturerecognizer.cpp +++ b/tests/auto/widgets/gestures/qgesturerecognizer/tst_qgesturerecognizer.cpp @@ -269,7 +269,8 @@ void tst_QGestureRecognizer::pinchGesture() enum SwipeSubTest { SwipeLineSubTest, - SwipeChangeDirectionSubTest, + SwipeDirectionChangeSubTest, + SwipeSmallDirectionChangeSubTest }; void tst_QGestureRecognizer::swipeGesture_data() @@ -277,7 +278,8 @@ void tst_QGestureRecognizer::swipeGesture_data() QTest::addColumn<int>("swipeSubTest"); QTest::addColumn<bool>("gestureExpected"); QTest::newRow("Line") << int(SwipeLineSubTest) << true; - QTest::newRow("ChangeDirection") << int(SwipeChangeDirectionSubTest) << false; + QTest::newRow("DirectionChange") << int(SwipeDirectionChangeSubTest) << false; + QTest::newRow("SmallDirectionChange") << int(SwipeSmallDirectionChangeSubTest) << true; } void tst_QGestureRecognizer::swipeGesture() @@ -314,10 +316,17 @@ void tst_QGestureRecognizer::swipeGesture() case SwipeLineSubTest: linearSequence(5, moveDelta, swipeSequence, points, &widget); break; - case SwipeChangeDirectionSubTest: + case SwipeDirectionChangeSubTest: linearSequence(5, moveDelta, swipeSequence, points, &widget); linearSequence(3, QPoint(-moveDelta.x(), moveDelta.y()), swipeSequence, points, &widget); break; + case SwipeSmallDirectionChangeSubTest: { // QTBUG-46195, small changes in direction should not cause the gesture to be canceled. + const QPoint smallChangeMoveDelta(50, 1); + linearSequence(5, smallChangeMoveDelta, swipeSequence, points, &widget); + linearSequence(1, QPoint(smallChangeMoveDelta.x(), -3), swipeSequence, points, &widget); + linearSequence(5, smallChangeMoveDelta, swipeSequence, points, &widget); + } + break; } releaseSequence(swipeSequence, points, &widget); |