aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls/data/tst_dial.qml
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-08-17 10:48:34 +0200
committerLiang Qi <liang.qi@qt.io>2016-08-17 10:48:34 +0200
commit2568869819863de6b1f303dfe470aedf38b841c3 (patch)
tree69a47b9325910dad8e114a7e6c3dafdc9fa8b823 /tests/auto/controls/data/tst_dial.qml
parenta69f95259fae492c4b95813da8e75433b2883ac1 (diff)
parentcf2db0c7d64441d1d2da783de1df5404990ebb89 (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Diffstat (limited to 'tests/auto/controls/data/tst_dial.qml')
-rw-r--r--tests/auto/controls/data/tst_dial.qml35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_dial.qml b/tests/auto/controls/data/tst_dial.qml
index a94692eb..e6446d3e 100644
--- a/tests/auto/controls/data/tst_dial.qml
+++ b/tests/auto/controls/data/tst_dial.qml
@@ -321,4 +321,39 @@ TestCase {
focusScope.destroy();
}
+
+ function test_snapMode_data() {
+ return [
+ { tag: "NoSnap", snapMode: Slider.NoSnap, from: 0, to: 2, values: [0, 0, 1], positions: [0, 0.5, 0.5] },
+ { tag: "SnapAlways (0..2)", snapMode: Slider.SnapAlways, from: 0, to: 2, values: [0.0, 0.0, 1.0], positions: [0.0, 0.5, 0.5] },
+ { tag: "SnapAlways (1..3)", snapMode: Slider.SnapAlways, from: 1, to: 3, values: [1.0, 1.0, 2.0], positions: [0.0, 0.5, 0.5] },
+ { tag: "SnapAlways (-1..1)", snapMode: Slider.SnapAlways, from: -1, to: 1, values: [0.0, 0.0, 0.0], positions: [0.5, 0.5, 0.5] },
+ { tag: "SnapAlways (1..-1)", snapMode: Slider.SnapAlways, from: 1, to: -1, values: [1.0, 1.0, 0.0], positions: [0.0, 0.5, 0.5] },
+ { tag: "SnapOnRelease (0..2)", snapMode: Slider.SnapOnRelease, from: 0, to: 2, values: [0.0, 0.0, 1.0], positions: [0.0, 0.5, 0.5] },
+ { tag: "SnapOnRelease (1..3)", snapMode: Slider.SnapOnRelease, from: 1, to: 3, values: [1.0, 1.0, 2.0], positions: [0.0, 0.5, 0.5] },
+ { tag: "SnapOnRelease (-1..1)", snapMode: Slider.SnapOnRelease, from: -1, to: 1, values: [0.0, 0.0, 0.0], positions: [0.5, 0.5, 0.5] },
+ { tag: "SnapOnRelease (1..-1)", snapMode: Slider.SnapOnRelease, from: 1, to: -1, values: [1.0, 1.0, 0.0], positions: [0.0, 0.5, 0.5] }
+ ]
+ }
+
+ function test_snapMode(data) {
+ dial.snapMode = data.snapMode;
+ dial.from = data.from;
+ dial.to = data.to;
+ dial.stepSize = 0.2;
+
+ var fuzz = 0.05;
+
+ mousePress(dial, dial.width * 0.25, dial.height * 0.75);
+ compare(dial.value, data.values[0]);
+ compare(dial.position, data.positions[0]);
+
+ mouseMove(dial, dial.width * 0.5, dial.height * 0.25);
+ fuzzyCompare(dial.value, data.values[1], fuzz);
+ fuzzyCompare(dial.position, data.positions[1], fuzz);
+
+ mouseRelease(dial, dial.width * 0.5, dial.height * 0.25);
+ fuzzyCompare(dial.value, data.values[2], fuzz);
+ fuzzyCompare(dial.position, data.positions[2], fuzz);
+ }
}