diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-06-28 14:53:11 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-06-28 18:00:13 +0000 |
commit | fff036ab4d755bce4d1e4d1fbfb5ac1b79bf8150 (patch) | |
tree | 9679d66705fa6f3c3a21af218624fee99abb464d /tests/auto/controls/data/tst_spinbox.qml | |
parent | ed03a08c65ec796288a802da1edd6ec4fbe77db2 (diff) |
SpinBox: add up.hovered and down.hovered properties
The actual hover effects are coming in separate patches.
[ChangeLog][SpinBox] Added up.hovered and down.hovered properties
that hold whether the respective buttons are hovered.
Task-number: QTBUG-50003
Change-Id: Ie47329e23326f40e4c807703ff7a97437f68deb4
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/controls/data/tst_spinbox.qml')
-rw-r--r-- | tests/auto/controls/data/tst_spinbox.qml | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_spinbox.qml b/tests/auto/controls/data/tst_spinbox.qml index d8422706..aecf4af4 100644 --- a/tests/auto/controls/data/tst_spinbox.qml +++ b/tests/auto/controls/data/tst_spinbox.qml @@ -478,4 +478,33 @@ TestCase { control.destroy() } + + function test_hover_data() { + return [ + { tag: "up:true", button: "up", hoverEnabled: true, value: 50 }, + { tag: "up:false", button: "up", hoverEnabled: false, value: 50 }, + { tag: "up:max", button: "up", hoverEnabled: true, value: 99 }, + { tag: "down:true", button: "down", hoverEnabled: true, value: 50 }, + { tag: "down:false", button: "down", hoverEnabled: false, value: 50 }, + { tag: "down:min", button: "down", hoverEnabled: true, value: 0 } + ] + } + + function test_hover(data) { + var control = spinBox.createObject(testCase, {hoverEnabled: data.hoverEnabled, value: data.value}) + verify(control) + + var button = control[data.button] + compare(control.hovered, false) + compare(button.hovered, false) + + mouseMove(control, button.indicator.x + button.indicator.width / 2, button.indicator.y + button.indicator.height / 2) + compare(control.hovered, data.hoverEnabled) + compare(button.hovered, data.hoverEnabled && button.indicator.enabled) + + mouseMove(control, button.indicator.x - 1, button.indicator.y - 1) + compare(button.hovered, false) + + control.destroy() + } } |