aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-04-24 07:51:12 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2017-04-24 07:29:35 +0000
commit49423c18f5fa7f26b1a02a79055a05b67f322a6a (patch)
tree5c70c213db96403d9109b5398f0734fd2e9b01d0 /tests/auto/controls
parent7faafa470eee71c51255e276e7b9df5beed2dd5b (diff)
QQuickRangeSlider: don't crash on press with null handles
The handle visuals should be optional. There were a few missing checks for null pointers. Change-Id: I13e38f373428dbe0c8e338442370fbe7bb02c15a Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/controls')
-rw-r--r--tests/auto/controls/data/tst_rangeslider.qml27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_rangeslider.qml b/tests/auto/controls/data/tst_rangeslider.qml
index 69ec6218..da6e24a1 100644
--- a/tests/auto/controls/data/tst_rangeslider.qml
+++ b/tests/auto/controls/data/tst_rangeslider.qml
@@ -896,4 +896,31 @@ TestCase {
mouseMove(control, node.handle.x - 1, node.handle.y - 1)
compare(node.hovered, false)
}
+
+ function test_nullHandles() {
+ var control = createTemporaryObject(sliderComponent, testCase, {"second.value": 1})
+ verify(control)
+
+ verify(control.first.handle)
+ verify(control.second.handle)
+
+ control.first.handle = null
+ control.second.handle = null
+
+ mousePress(control, control.leftPadding, control.height / 2)
+ verify(control.first.pressed, true)
+ compare(control.second.pressed, false)
+
+ mouseRelease(control, control.leftPadding, control.height / 2)
+ compare(control.first.pressed, false)
+ compare(control.second.pressed, false)
+
+ mousePress(control, control.width - control.rightPadding, control.height / 2)
+ compare(control.first.pressed, false)
+ compare(control.second.pressed, true)
+
+ mouseRelease(control, control.width - control.rightPadding, control.height / 2)
+ compare(control.first.pressed, false)
+ compare(control.second.pressed, false)
+ }
}