summaryrefslogtreecommitdiff
path: root/tests/auto/controls/data
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/controls/data')
-rw-r--r--tests/auto/controls/data/tst_slider.qml33
-rw-r--r--tests/auto/controls/data/tst_spinbox.qml38
2 files changed, 71 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml
index e95d26d9..f6435314 100644
--- a/tests/auto/controls/data/tst_slider.qml
+++ b/tests/auto/controls/data/tst_slider.qml
@@ -439,5 +439,38 @@ Item {
control.destroy();
}
+
+ Component {
+ id: mouseWheelSlider
+ Slider {
+ property real boundValue: 10
+ width: 300
+ height: 50
+ minimumValue: 0
+ maximumValue: 200
+ stepSize: 2
+ value: boundValue
+ }
+ }
+
+ function test_mouseWheelWithValueBinding() {
+ var slider = createTemporaryObject(mouseWheelSlider, container)
+ slider.forceActiveFocus()
+
+ var defaultScrollSpeed = 20.0
+ var mouseStep = 15.0
+ var deltatUnit = 8.0
+ var mouseRatio = deltatUnit * mouseStep / defaultScrollSpeed;
+ var sliderDeltaRatio = 1; //(slider.maximumValue - slider.minimumValue)/slider.width
+ var ratio = mouseRatio / sliderDeltaRatio
+
+ compare(slider.value, 10)
+
+ mouseWheel(slider, 5, 5, -20 * ratio, 0)
+ compare(slider.value, 24)
+
+ slider.boundValue = 50
+ compare(slider.value, 50)
+ }
}
}
diff --git a/tests/auto/controls/data/tst_spinbox.qml b/tests/auto/controls/data/tst_spinbox.qml
index 587d2be0..d42a2551 100644
--- a/tests/auto/controls/data/tst_spinbox.qml
+++ b/tests/auto/controls/data/tst_spinbox.qml
@@ -49,6 +49,7 @@
****************************************************************************/
import QtQuick 2.2
+import QtQuick.Controls 1.2
import QtQuick.Controls.Private 1.0
import QtTest 1.0
@@ -702,6 +703,43 @@ Item {
test.destroy()
}
+
+ Component {
+ id: moveMouseFlickable
+ Flickable {
+ property alias spinbox: _spinbox
+ width: 100
+ height: 200
+ contentHeight: 500
+ contentWidth: 200
+ SpinBox {
+ id: _spinbox
+ x: 20
+ y: 100
+ minimumValue: 0
+ maximumValue: 12500
+ }
+ }
+ }
+
+ function test_moveMouseInFlickable() {
+ var control = createTemporaryObject(moveMouseFlickable, container)
+ var spinbox = control.spinbox
+ spinbox.forceActiveFocus()
+ setCoordinates(spinbox)
+ mousePress(spinbox, upCoord.x, upCoord.y, Qt.LeftButton)
+ mouseMove(spinbox.parent, mainCoord.x, mainCoord.y - 50, 500)
+ compare(spinbox.hovered, false)
+ compare(spinbox.__styleData.upHovered, false)
+ compare(spinbox.__styleData.downHovered, false)
+ mouseRelease(spinbox.parent, mainCoord.x, mainCoord.y - 50, Qt.LeftButton)
+ var currentVal = spinbox.value
+ mouseMove(spinbox.parent, upCoord.x, upCoord.y)
+ compare(spinbox.hovered, true)
+ compare(spinbox.__styleData.upHovered, true)
+ compare(spinbox.__styleData.downHovered, false)
+ compare(spinbox.value, currentVal)
+ }
}
}