aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls/data/tst_slider.qml
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-01-10 16:47:26 +0100
committerLiang Qi <liang.qi@qt.io>2019-01-10 16:47:26 +0100
commitefa04c2ae8427c70848477ace3d8f6e82baaab11 (patch)
treec0394c9cd5ce51961337a7a15e169074dd41632b /tests/auto/controls/data/tst_slider.qml
parent9c7429219d36e8eb40e1fe6e679715c89209fc40 (diff)
parent6476de0b669162cf08c11f5c8d5ad0b42419f365 (diff)
Merge remote-tracking branch 'origin/5.12' into dev
Conflicts: .qmake.conf src/imports/controls/qtquickcontrols2plugin.cpp Change-Id: I27f1260b539354e084beb28be78385e57fda63e1
Diffstat (limited to 'tests/auto/controls/data/tst_slider.qml')
-rw-r--r--tests/auto/controls/data/tst_slider.qml61
1 files changed, 59 insertions, 2 deletions
diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml
index 368bc9fd..280138c5 100644
--- a/tests/auto/controls/data/tst_slider.qml
+++ b/tests/auto/controls/data/tst_slider.qml
@@ -48,9 +48,9 @@
**
****************************************************************************/
-import QtQuick 2.2
+import QtQuick 2.12
import QtTest 1.0
-import QtQuick.Controls 2.2
+import QtQuick.Controls 2.12
TestCase {
id: testCase
@@ -772,6 +772,63 @@ TestCase {
compare(control.position, 0.25)
}
+ function test_wheelPropagation_data() {
+ return [
+ { tag: "horizontal", orientation: Qt.Horizontal, dx: 120, dy: 0 },
+ { tag: "vertical", orientation: Qt.Vertical, dx: 0, dy: 120 }
+ ]
+ }
+
+ Component {
+ id: mouseAreaComponent
+ MouseArea {}
+ }
+
+ function test_wheelPropagation(data) {
+ var mouseArea = createTemporaryObject(mouseAreaComponent, testCase, { width: parent.width, height: parent.height })
+ verify(mouseArea)
+
+ var mouseAreaWheelSpy = signalSpy.createObject(mouseArea, { target: mouseArea, signalName: "wheel" })
+ verify(mouseAreaWheelSpy.valid)
+
+ var control = createTemporaryObject(slider, mouseArea,
+ { wheelEnabled: true, orientation: data.orientation, stepSize: 1 })
+ verify(control)
+ compare(control.value, 0.0)
+
+ var movedCount = 0
+ var movedSpy = signalSpy.createObject(control, { target: control, signalName: "moved" })
+ verify(movedSpy.valid)
+
+ // Scroll the handle to the edge.
+ mouseWheel(control, control.width / 2, control.height / 2, data.dx, data.dy)
+ compare(control.value, 1.0)
+ compare(control.position, 1.0)
+ compare(movedSpy.count, ++movedCount)
+ compare(mouseAreaWheelSpy.count, 0)
+
+ // Scroll again; the wheel event shouldn't go through to the MouseArea parent.
+ mouseWheel(control, control.width / 2, control.height / 2, data.dx, data.dy)
+ compare(control.value, 1.0)
+ compare(control.position, 1.0)
+ compare(movedSpy.count, movedCount)
+ compare(mouseAreaWheelSpy.count, 0)
+
+ // Scroll the handle to the other edge.
+ mouseWheel(control, control.width / 2, control.height / 2, -data.dx, -data.dy)
+ compare(control.value, 0.0)
+ compare(control.position, 0.0)
+ compare(movedSpy.count, ++movedCount)
+ compare(mouseAreaWheelSpy.count, 0)
+
+ // Scroll again; the wheel event shouldn't go through to the MouseArea parent.
+ mouseWheel(control, control.width / 2, control.height / 2, -data.dx, -data.dy)
+ compare(control.value, 0.0)
+ compare(control.position, 0.0)
+ compare(movedSpy.count, movedCount)
+ compare(mouseAreaWheelSpy.count, 0)
+ }
+
function test_valueAt_data() {
return [
{ tag: "0.0..1.0", from: 0.0, to: 1.0, values: [0.0, 0.2, 0.5, 1.0] },