on xenial help sign in
Added test for force focus
b60a55eNick Dedekind
tests/qmltests/Stages/tst_ApplicationWindow.qml+20−4
@@ -52,15 +52,20 @@ Rectangle {
52 application: fakeApplication
52 application: fakeApplication
53 }
53 }
54 }
54 }
55− Loader {
55+ FocusScope {
56− id: applicationWindowLoader
56+ id: appFocus
57 anchors {
57 anchors {
58 top: parent.top
58 top: parent.top
59 bottom: parent.bottom
59 bottom: parent.bottom
60 left: parent.left
60 left: parent.left
61 }
61 }
62 width: units.gu(40)
62 width: units.gu(40)
63+
64+ Loader {
65+ id: applicationWindowLoader
66+ anchors.fill: parent
63− sourceComponent: applicationWindowComponent
67+ sourceComponent: applicationWindowComponent
68+ }
64 }
69 }
65
70
66 Rectangle {
71 Rectangle {
@@ -68,7 +73,7 @@ Rectangle {
68 anchors {
73 anchors {
69 top: parent.top
74 top: parent.top
70 bottom: parent.bottom
75 bottom: parent.bottom
71− left: applicationWindowLoader.right
76+ left: appFocus.right
72 right: parent.right
77 right: parent.right
73 }
78 }
74
79
@@ -378,5 +383,16 @@ Rectangle {
378
383
379 verify(stateGroup.state === "void");
384 verify(stateGroup.state === "void");
380 }
385 }
386+
387+ // should be forcing active focus when interactive changes,
388+ // which will cause a FocusScope higher in the object hierarchy tp be given the focus
389+ function test_forceActiveFocusFollowsInterative() {
390+ fakeApplication.createSession();
391+ applicationWindowLoader.item.interactive = false;
392+ applicationWindowLoader.item.interactive = true;
393+ fakeSession.createSurface();
394+
395+ compare(appFocus.focus, true);
396+ }
381 }
397 }
382}
398}