aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-06-29 10:53:01 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-06-29 13:22:48 +0000
commita07606a56b1bc8d277ef5cfc394178b660a0c30c (patch)
treed0c567613ec0149f09ef77662144b2e72b2472fb /tests/auto
parentf379e58bf51f1b32782a54f455401b86c83c3ee4 (diff)
Add hover support to TextArea & TextField
Task-number: QTBUG-50003 Change-Id: Ie101ba8840fba2a7503da8de77d9cf2a3c91d562 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/controls/data/tst_textarea.qml22
-rw-r--r--tests/auto/controls/data/tst_textfield.qml22
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_textarea.qml b/tests/auto/controls/data/tst_textarea.qml
index 3afa7193..9bbbf726 100644
--- a/tests/auto/controls/data/tst_textarea.qml
+++ b/tests/auto/controls/data/tst_textarea.qml
@@ -176,4 +176,26 @@ TestCase {
ignoreWarning(Qt.resolvedUrl("tst_textarea.qml") + ":45:1: QML TestCase: TextArea must be attached to a Flickable")
testCase.TextArea.flickable = null
}
+
+ function test_hover_data() {
+ return [
+ { tag: "enabled", hoverEnabled: true },
+ { tag: "disabled", hoverEnabled: false },
+ ]
+ }
+
+ function test_hover(data) {
+ var control = textArea.createObject(testCase, {text: "TextArea", hoverEnabled: data.hoverEnabled})
+ verify(control)
+
+ compare(control.hovered, false)
+
+ mouseMove(control)
+ compare(control.hovered, data.hoverEnabled)
+
+ mouseMove(control, -1, -1)
+ compare(control.hovered, false)
+
+ control.destroy()
+ }
}
diff --git a/tests/auto/controls/data/tst_textfield.qml b/tests/auto/controls/data/tst_textfield.qml
index 012dedba..18bcd63f 100644
--- a/tests/auto/controls/data/tst_textfield.qml
+++ b/tests/auto/controls/data/tst_textfield.qml
@@ -144,4 +144,26 @@ TestCase {
control.destroy()
}
+
+ function test_hover_data() {
+ return [
+ { tag: "enabled", hoverEnabled: true },
+ { tag: "disabled", hoverEnabled: false },
+ ]
+ }
+
+ function test_hover(data) {
+ var control = textField.createObject(testCase, {hoverEnabled: data.hoverEnabled})
+ verify(control)
+
+ compare(control.hovered, false)
+
+ mouseMove(control)
+ compare(control.hovered, data.hoverEnabled)
+
+ mouseMove(control, -1, -1)
+ compare(control.hovered, false)
+
+ control.destroy()
+ }
}