summaryrefslogtreecommitdiff
path: root/tests/auto/controls/data/tst_slider.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2014-11-07 12:25:29 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2014-11-07 17:52:25 +0100
commit8e8b0dbaec1868944e0a699a4474304b0cae65e9 (patch)
treeaa3c20c58c00a4294dd687d0bf0e228bfb516ee0 /tests/auto/controls/data/tst_slider.qml
parenta8532793ffac763b8345fd42fe0bccb312e4c94c (diff)
downloadqtquickcontrols-8e8b0dbaec1868944e0a699a4474304b0cae65e9.tar.gz
Slider: don't clamp to the initial press point
Change-Id: I5115bbab670f534dae44eb19c2208aff21293889 Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Diffstat (limited to 'tests/auto/controls/data/tst_slider.qml')
-rw-r--r--tests/auto/controls/data/tst_slider.qml25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml
index 2b3a00a5..2541b1c5 100644
--- a/tests/auto/controls/data/tst_slider.qml
+++ b/tests/auto/controls/data/tst_slider.qml
@@ -41,6 +41,8 @@
import QtQuick 2.2
import QtTest 1.0
import QtQuickControlsTests 1.0
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
Item {
id: container
@@ -305,5 +307,28 @@ Item {
compare(slider.__handlePos, 50)
slider.destroy()
}
+
+ function test_dragThreshold() {
+ var control = Qt.createQmlObject('import QtQuick.Controls 1.2; Slider {x: 20; y: 20; width: 100; height: 50}', container, '')
+
+ var pt = { x: control.width/2, y: control.height/2 }
+
+ mousePress(control, pt.x, pt.y)
+ compare(control.value, 0.5)
+
+ // drag less than the threshold distance
+ mouseMove(control, pt.x + Settings.dragThreshold - 1, pt.y)
+ compare(control.value, 0.5)
+
+ // drag over the threshold
+ mouseMove(control, pt.x + Settings.dragThreshold + 1, pt.y)
+ verify(control.value > 0.5)
+
+ // move back close to the original press point, less than the threshold distance away
+ mouseMove(control, pt.x - Settings.dragThreshold / 2, pt.y)
+ verify(control.value < 0.5)
+
+ control.destroy()
+ }
}
}