diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-12-01 13:59:53 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-12-01 13:59:53 +0100 |
commit | 4ba00f0054ffd183377fd420b35ef7a388c0bcfe (patch) | |
tree | dde076314b40ce0dd540e5363ff6d9fca98016f4 /tests/auto/controls/data | |
parent | 948932c9c6ae535647e69962aad2add516802b9c (diff) | |
parent | d8c5dea96fb8861089e2166ae574a85d2b69c09e (diff) |
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
src/imports/controls/SpinBox.qml
src/imports/controls/material/SpinBox.qml
src/imports/controls/universal/SpinBox.qml
tests/auto/controls/data/tst_swipedelegate.qml
Change-Id: Ie1d1f487890f0a9f80a00df5e813e1d2e8303fe5
Diffstat (limited to 'tests/auto/controls/data')
-rw-r--r-- | tests/auto/controls/data/tst_dial.qml | 47 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_swipedelegate.qml | 49 |
2 files changed, 96 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_dial.qml b/tests/auto/controls/data/tst_dial.qml index 06037523..c520aa4c 100644 --- a/tests/auto/controls/data/tst_dial.qml +++ b/tests/auto/controls/data/tst_dial.qml @@ -392,4 +392,51 @@ TestCase { fuzzyCompare(dial.value, data.values[2], fuzz); fuzzyCompare(dial.position, data.positions[2], fuzz); } + + function test_wheel_data() { + return [ + { tag: "horizontal", orientation: Qt.Horizontal, dx: 120, dy: 0 }, + { tag: "vertical", orientation: Qt.Vertical, dx: 0, dy: 120 } + ] + } + + function test_wheel(data) { + var control = dialComponent.createObject(testCase, {wheelEnabled: true, orientation: data.orientation}) + verify(control) + + compare(control.value, 0.0) + + mouseWheel(control, control.width / 2, control.height / 2, data.dx, data.dy) + compare(control.value, 0.1) + compare(control.position, 0.1) + + control.stepSize = 0.2 + + mouseWheel(control, control.width / 2, control.height / 2, data.dx, data.dy) + compare(control.value, 0.3) + compare(control.position, 0.3) + + control.stepSize = 10.0 + + mouseWheel(control, control.width / 2, control.height / 2, -data.dx, -data.dy) + compare(control.value, 0.0) + compare(control.position, 0.0) + + control.to = 10.0 + control.stepSize = 5.0 + + mouseWheel(control, control.width / 2, control.height / 2, data.dx, data.dy) + compare(control.value, 5.0) + compare(control.position, 0.5) + + mouseWheel(control, control.width / 2, control.height / 2, 0.5 * data.dx, 0.5 * data.dy) + compare(control.value, 7.5) + compare(control.position, 0.75) + + mouseWheel(control, control.width / 2, control.height / 2, -data.dx, -data.dy) + compare(control.value, 2.5) + compare(control.position, 0.25) + + control.destroy() + } } diff --git a/tests/auto/controls/data/tst_swipedelegate.qml b/tests/auto/controls/data/tst_swipedelegate.qml index 47aba3d5..a6e11246 100644 --- a/tests/auto/controls/data/tst_swipedelegate.qml +++ b/tests/auto/controls/data/tst_swipedelegate.qml @@ -1512,4 +1512,53 @@ TestCase { control.destroy(); } + + Component { + id: animationSwipeDelegateComponent + + SwipeDelegate { + id: control + text: "SwipeDelegate" + width: 150 + swipe.left: greenLeftComponent + swipe.right: redRightComponent + + property alias behavior: xBehavior + property alias animation: numberAnimation + + background: Rectangle { + color: control.down ? "#ccc" : "#fff" + + Behavior on x { + id: xBehavior + enabled: !control.down + + NumberAnimation { + id: numberAnimation + easing.type: Easing.InOutCubic + duration: 400 + } + } + } + } + } + + function test_animations() { + // Test that animations are run when releasing from a drag. + var control = animationSwipeDelegateComponent.createObject(testCase); + verify(control); + + mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton); + mouseMove(control, control.width - 1, control.height / 2, Qt.LeftButton); + verify(control.down); + verify(!control.behavior.enabled); + verify(!control.animation.running); + + mouseRelease(control, control.width - 1, control.height / 2, Qt.LeftButton); + verify(!control.down); + verify(control.behavior.enabled); + verify(control.animation.running); + + control.destroy(); + } } |