aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2017-04-24 12:07:46 +0200
committerMitch Curtis <mitch.curtis@qt.io>2017-04-24 13:37:02 +0000
commit039c25daac5ec6b96c0aa074eae2a983a1b5aabd (patch)
treee8fb889ce6bedae2664a37a9c0d138f9bddd2401 /tests/auto/controls
parent743d0132fe006699dd33e5b4254a36f4e2ec7f9f (diff)
Forward focus to the contentItem of editable spinboxes
This fixes the scenario where a SpinBox is shown for the first time with focus, but its editor (TextInput) doesn't have active focus. tst_focus' keyNavigation.qml had to be adjusted, as an editable spinbox will now consume key events. Task-number: QTBUG-60356 Change-Id: I3af0260a22e9633ab6110d6adab7b39a22b849de Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'tests/auto/controls')
-rw-r--r--tests/auto/controls/data/tst_spinbox.qml11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_spinbox.qml b/tests/auto/controls/data/tst_spinbox.qml
index 6d681d60..4b2e38b3 100644
--- a/tests/auto/controls/data/tst_spinbox.qml
+++ b/tests/auto/controls/data/tst_spinbox.qml
@@ -51,6 +51,7 @@
import QtQuick 2.2
import QtTest 1.0
import QtQuick.Controls 2.2
+import QtQuick.Window 2.3
TestCase {
id: testCase
@@ -422,6 +423,16 @@ TestCase {
compare(control.value, 100)
}
+ function test_initialFocus() {
+ var window = testCase.Window.window
+ verify(window)
+ compare(window.activeFocusItem, window.contentItem)
+
+ var control = createTemporaryObject(spinBox, testCase, { editable: true, focus: true })
+ verify(control)
+ tryCompare(control.contentItem, "activeFocus", true)
+ }
+
function test_editable() {
var control = createTemporaryObject(spinBox, testCase)
verify(control)