diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-04-04 17:41:14 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-04-05 09:08:08 +0000 |
commit | 1cf6abc8ba5547f12352467db8ce1c3d09921960 (patch) | |
tree | a1fb7e09417bf2dc7d41fa1bd64901e202d04549 /tests/auto/controls/data | |
parent | f5890e07ca8172b05ce8305c65b42531acdb629b (diff) |
Slider: react immediately when using a mouse
The initial drag threshold is a necessary evil on touch to avoid
conflicting with flickables, but leads to bad experience (QTBUG-47081)
when using a mouse. Now that we have separate mouse and touch handling,
we can apply immediate moves when using a mouse, but keep the old
behavior on touch.
Changing the behavior is simple, but auto tests need quite many tweaks
so RangeSlider and Dial will be done separate follow up changes.
[ChangeLog][Important Behavior Changes] Sliders and Dials now react
immediately when using a mouse. Now the initial drag threshold applies
only on touch, to avoid conflicting with flickables.
Task-number: QTBUG-59920
Change-Id: Ifc1e6ed74c7894c3c854c975dff5238278827590
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/controls/data')
-rw-r--r-- | tests/auto/controls/data/tst_slider.qml | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml index 40bb389d..b02e77d0 100644 --- a/tests/auto/controls/data/tst_slider.qml +++ b/tests/auto/controls/data/tst_slider.qml @@ -229,7 +229,7 @@ TestCase { var movedSpy = signalSpy.createObject(control, {target: control, signalName: "moved"}) verify(movedSpy.valid) - mousePress(control, 0, 0, Qt.LeftButton) + mousePress(control, 0, control.height, Qt.LeftButton) compare(pressedSpy.count, ++pressedCount) compare(movedSpy.count, movedCount) compare(control.pressed, true) @@ -258,17 +258,17 @@ TestCase { compare(control.value, 0.5) compare(control.position, 0.5) - mousePress(control, control.width, control.height, Qt.LeftButton) + mousePress(control, control.width, 0, Qt.LeftButton) compare(pressedSpy.count, ++pressedCount) - compare(movedSpy.count, movedCount) + compare(movedSpy.count, ++movedCount) compare(control.pressed, true) - compare(control.value, 0.5) - compare(control.position, 0.5) + compare(control.value, data.live ? 1.0 : 0.5) + compare(control.position, 1.0) // maximum on the right in horizontal vs. at the top in vertical mouseMove(control, control.width * 2, -control.height, 0) compare(pressedSpy.count, pressedCount) - compare(movedSpy.count, ++movedCount) + compare(movedSpy.count, movedCount) compare(control.pressed, true) compare(control.value, data.live ? 1.0 : 0.5) compare(control.position, 1.0) @@ -617,8 +617,8 @@ TestCase { compare(pressedSpy.count, 3) compare(control.pressed, true) compare(control.value, 0.0) - compare(control.position, 0.0) - compare(control.visualPosition, 1.0) + compare(control.position, 1.0) + compare(control.visualPosition, 0.0) mouseMove(control, control.leftPadding + control.availableWidth * 0.5, control.height * 0.5, 0) compare(pressedSpy.count, 3) @@ -642,22 +642,22 @@ TestCase { compare(control.visualPosition, 0.5) } - function test_snapMode_data() { + function test_snapMode_data(immediate) { return [ { tag: "NoSnap", snapMode: Slider.NoSnap, from: 0, to: 2, values: [0, 0, 0.25], positions: [0, 0.1, 0.1] }, { tag: "SnapAlways (0..2)", snapMode: Slider.SnapAlways, from: 0, to: 2, values: [0.0, 0.0, 0.2], positions: [0.0, 0.1, 0.1] }, { tag: "SnapAlways (1..3)", snapMode: Slider.SnapAlways, from: 1, to: 3, values: [1.0, 1.0, 1.2], positions: [0.0, 0.1, 0.1] }, - { tag: "SnapAlways (-1..1)", snapMode: Slider.SnapAlways, from: -1, to: 1, values: [0.0, 0.0, -0.8], positions: [0.5, 0.1, 0.1] }, - { tag: "SnapAlways (1..-1)", snapMode: Slider.SnapAlways, from: 1, to: -1, values: [0.0, 0.0, 0.8], positions: [0.5, 0.1, 0.1] }, + { tag: "SnapAlways (-1..1)", snapMode: Slider.SnapAlways, from: -1, to: 1, values: [0.0, 0.0, -0.8], positions: [immediate ? 0.0 : 0.5, 0.1, 0.1] }, + { tag: "SnapAlways (1..-1)", snapMode: Slider.SnapAlways, from: 1, to: -1, values: [0.0, 0.0, 0.8], positions: [immediate ? 0.0 : 0.5, 0.1, 0.1] }, { tag: "SnapOnRelease (0..2)", snapMode: Slider.SnapOnRelease, from: 0, to: 2, values: [0.0, 0.0, 0.2], positions: [0.0, 0.1, 0.1] }, { tag: "SnapOnRelease (1..3)", snapMode: Slider.SnapOnRelease, from: 1, to: 3, values: [1.0, 1.0, 1.2], positions: [0.0, 0.1, 0.1] }, - { tag: "SnapOnRelease (-1..1)", snapMode: Slider.SnapOnRelease, from: -1, to: 1, values: [0.0, 0.0, -0.8], positions: [0.5, 0.1, 0.1] }, - { tag: "SnapOnRelease (1..-1)", snapMode: Slider.SnapOnRelease, from: 1, to: -1, values: [0.0, 0.0, 0.8], positions: [0.5, 0.1, 0.1] } + { tag: "SnapOnRelease (-1..1)", snapMode: Slider.SnapOnRelease, from: -1, to: 1, values: [0.0, 0.0, -0.8], positions: [immediate ? 0.0 : 0.5, 0.1, 0.1] }, + { tag: "SnapOnRelease (1..-1)", snapMode: Slider.SnapOnRelease, from: 1, to: -1, values: [0.0, 0.0, 0.8], positions: [immediate ? 0.0 : 0.5, 0.1, 0.1] } ] } function test_snapMode_mouse_data() { - return test_snapMode_data() + return test_snapMode_data(true) } function test_snapMode_mouse(data) { @@ -681,7 +681,7 @@ TestCase { } function test_snapMode_touch_data() { - return test_snapMode_data() + return test_snapMode_data(false) } function test_snapMode_touch(data) { |