aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls/data/tst_scrollbar.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-01-19 14:31:54 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2017-01-20 09:05:06 +0000
commitfdd41317118cd14fdab472a60ac67516d9d4d937 (patch)
treee271bd55ae5a0e6bf700ffc32f7db53b6072a671 /tests/auto/controls/data/tst_scrollbar.qml
parent945a407d6f6ca25098efcf3bdf138fb622cd5110 (diff)
Add ScrollBar::interactive
[ChangeLog][Controls][ScrollBar] Added an interactive-property. A non-interactive ScrollBar is visually and behaviorally similar to ScrollIndicator. This property is useful for switching between typical mouse- and touch-orientated UIs with interactive and non- interactive scroll bars, respectively. Change-Id: Ie98bfa0b5bba94a9751baf3c65f17b850b58fd1f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/controls/data/tst_scrollbar.qml')
-rw-r--r--tests/auto/controls/data/tst_scrollbar.qml61
1 files changed, 57 insertions, 4 deletions
diff --git a/tests/auto/controls/data/tst_scrollbar.qml b/tests/auto/controls/data/tst_scrollbar.qml
index 840f187f..11d84114 100644
--- a/tests/auto/controls/data/tst_scrollbar.qml
+++ b/tests/auto/controls/data/tst_scrollbar.qml
@@ -320,20 +320,21 @@ TestCase {
function test_hover_data() {
return [
- { tag: "enabled", hoverEnabled: true },
- { tag: "disabled", hoverEnabled: false },
+ { tag: "enabled", hoverEnabled: true, interactive: true },
+ { tag: "disabled", hoverEnabled: false, interactive: true },
+ { tag: "non-interactive", hoverEnabled: true, interactive: false }
]
}
function test_hover(data) {
- var control = createTemporaryObject(scrollBar, testCase, {hoverEnabled: data.hoverEnabled})
+ var control = createTemporaryObject(scrollBar, testCase, {hoverEnabled: data.hoverEnabled, interactive: data.interactive})
verify(control)
compare(control.hovered, false)
mouseMove(control)
compare(control.hovered, data.hoverEnabled)
- compare(control.active, data.hoverEnabled)
+ compare(control.active, data.hoverEnabled && data.interactive)
mouseMove(control, -1, -1)
compare(control.hovered, false)
@@ -410,4 +411,56 @@ TestCase {
mouseRelease(control, control.width - 1, 0)
}
+
+ function test_interactive_data() {
+ return [
+ { tag: "true", interactive: true },
+ { tag: "false", interactive: false }
+ ]
+ }
+
+ function test_interactive(data) {
+ var control = createTemporaryObject(scrollBar, testCase, {interactive: data.interactive})
+ verify(control)
+
+ compare(control.interactive, data.interactive)
+
+ // press-move-release
+ mousePress(control, 0, 0, Qt.LeftButton)
+ compare(control.pressed, data.interactive)
+
+ mouseMove(control, control.width / 2, control.height / 2)
+ compare(control.position, data.interactive ? 0.5 : 0.0)
+
+ mouseRelease(control, control.width / 2, control.height / 2, Qt.LeftButton)
+ compare(control.pressed, false)
+
+ // change to non-interactive while pressed
+ mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton)
+ compare(control.pressed, data.interactive)
+
+ mouseMove(control, control.width, control.height)
+ compare(control.position, data.interactive ? 1.0 : 0.0)
+
+ control.interactive = false
+ compare(control.interactive, false)
+ compare(control.pressed, false)
+
+ mouseMove(control, control.width / 2, control.height / 2)
+ compare(control.position, data.interactive ? 1.0 : 0.0)
+
+ mouseRelease(control, control.width / 2, control.height / 2, Qt.LeftButton)
+ compare(control.pressed, false)
+
+ // change back to interactive & try press-move-release again
+ control.interactive = true
+ mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton)
+ compare(control.pressed, true)
+
+ mouseMove(control, 0, 0)
+ compare(control.position, 0.0)
+
+ mouseRelease(control, 0, 0, Qt.LeftButton)
+ compare(control.pressed, false)
+ }
}