aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2019-10-30 16:19:32 +0100
committerMitch Curtis <mitch.curtis@qt.io>2019-11-14 13:57:01 +0100
commit02ffe50af41526f604ae61d41bf2150037d67473 (patch)
tree43f1aec0c61f43c6961e051f96f2b3a3599403c8 /src/imports
parent35fdf3a7b77a79806d0b5d9632b5066e3618adf5 (diff)
mouseDrag(): never drag along an axis that wasn't requested
mouseDrag() should not drag along an axis if the distance passed in for that axis was 0. Doing so can interfere with tests for an item that e.g. handles horizontal flicks which is within e.g. a Flickable that handles vertical flicks. This was seen with SwipeDelegate auto tests, where the delegates handles horizontal swipes within a vertical ListView. Change-Id: I8fee567d59c53bdc4cbfe1d42ae0592e324bd2f6 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/testlib/TestCase.qml8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml
index 6e075d8792..fff375b49a 100644
--- a/src/imports/testlib/TestCase.qml
+++ b/src/imports/testlib/TestCase.qml
@@ -1425,8 +1425,12 @@ Item {
ddy = 0
mousePress(item, x, y, button, modifiers, delay)
- //trigger dragging
- mouseMove(item, x + util.dragThreshold + 1, y + util.dragThreshold + 1, moveDelay, button)
+
+ // Trigger dragging by dragging past the drag threshold, but making sure to only drag
+ // along a certain axis if a distance greater than zero was given for that axis.
+ var dragTriggerXDistance = dx > 0 ? (util.dragThreshold + 1) : 0
+ var dragTriggerYDistance = dy > 0 ? (util.dragThreshold + 1) : 0
+ mouseMove(item, x + dragTriggerXDistance, y + dragTriggerYDistance, moveDelay, button)
if (ddx > 0 || ddy > 0) {
mouseMove(item, x + ddx, y + ddy, moveDelay, button)
mouseMove(item, x + 2*ddx, y + 2*ddy, moveDelay, button)