summaryrefslogtreecommitdiff
path: root/tests/auto/controls/data/tst_stackview.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2014-11-25 14:02:03 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2014-11-28 16:12:45 +0100
commitfbcc860f28bbd062855359c635dd67420d6e8c9e (patch)
tree583a3a999d2df9b741ddb54bdd0d1018c44e0c21 /tests/auto/controls/data/tst_stackview.qml
parent71314570d03631f50ab2c262011aba6a572d0ced (diff)
downloadqtquickcontrols-fbcc860f28bbd062855359c635dd67420d6e8c9e.tar.gz
Fix StackView focus handling
Make StackView a FocusScope so inner focus changes don't have undesired side effects in other parts of the application. Task-number: QTBUG-42506 Change-Id: I0d901083196cf90f236a24e1dcd2e91bd9f320db Reviewed-by: Mitch Curtis <mitch.curtis@digia.com> Reviewed-by: Caroline Chao <caroline.chao@theqtcompany.com>
Diffstat (limited to 'tests/auto/controls/data/tst_stackview.qml')
-rw-r--r--tests/auto/controls/data/tst_stackview.qml26
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/auto/controls/data/tst_stackview.qml b/tests/auto/controls/data/tst_stackview.qml
index 848be725..f574feed 100644
--- a/tests/auto/controls/data/tst_stackview.qml
+++ b/tests/auto/controls/data/tst_stackview.qml
@@ -46,10 +46,12 @@ TestCase {
id: testCase
name: "Tests_StackView"
when: windowShown
+ visible: true
width: 400
height: 400
Item { id: anItem }
+ TextField { id: textField }
Component {
id: pageComponent
Item {}
@@ -57,7 +59,7 @@ TestCase {
Component {
id: stackComponent
- StackView {}
+ StackView { anchors.fill: parent }
}
function test_stackview() {
@@ -73,5 +75,27 @@ TestCase {
verify (stack.depth === 1)
stack.push(pageComponent)
verify (stack.depth === 2)
+ stack.destroy()
+ }
+
+ function test_focus() {
+ var stack = stackComponent.createObject(testCase, {initialItem: anItem})
+ verify (stack !== null, "stackview created is null")
+ compare(stack.currentItem, anItem)
+
+ stack.forceActiveFocus()
+ verify(stack.activeFocus)
+
+ stack.push({item: textField, immediate: true})
+ compare(stack.currentItem, textField)
+ textField.forceActiveFocus()
+ verify(textField.activeFocus)
+
+ stack.pop({immediate: true})
+ compare(stack.currentItem, anItem)
+ verify(stack.activeFocus)
+ verify(!textField.activeFocus)
+
+ stack.destroy()
}
}