on xenial help sign in
Some ApplicationWindow test improvements
bb66e76Daniel d'Andrada
tests/qmltests/Stages/RecursingChildSessionControl.qml+1−1
@@ -93,7 +93,7 @@ ColumnLayout {
93 onCheckedChanged: {
93 onCheckedChanged: {
94 if (checked) {
94 if (checked) {
95 root.session.createSurface();
95 root.session.createSurface();
96− } else if (root.session.surface) {
96+ } else if (root.session && root.session.surface) {
97 ApplicationTest.removeSurface(root.session.surface);
97 ApplicationTest.removeSurface(root.session.surface);
98 }
98 }
99 }
99 }
tests/qmltests/Stages/tst_ApplicationWindow.qml+11−12
@@ -53,20 +53,15 @@ Rectangle {
53 orientation: Qt.PortraitOrientation
53 orientation: Qt.PortraitOrientation
54 }
54 }
55 }
55 }
56− FocusScope {
56+ Loader {
57− id: appFocus
57+ id: applicationWindowLoader
58 anchors {
58 anchors {
59 top: parent.top
59 top: parent.top
60 bottom: parent.bottom
60 bottom: parent.bottom
61 left: parent.left
61 left: parent.left
62 }
62 }
63 width: units.gu(40)
63 width: units.gu(40)
64−
65− Loader {
66− id: applicationWindowLoader
67− anchors.fill: parent
68− sourceComponent: applicationWindowComponent
64+ sourceComponent: applicationWindowComponent
69− }
70 }
65 }
71
66
72 Rectangle {
67 Rectangle {
@@ -74,7 +69,7 @@ Rectangle {
74 anchors {
69 anchors {
75 top: parent.top
70 top: parent.top
76 bottom: parent.bottom
71 bottom: parent.bottom
77− left: appFocus.right
72+ left: applicationWindowLoader.right
78 right: parent.right
73 right: parent.right
79 }
74 }
80
75
@@ -403,15 +398,19 @@ Rectangle {
403 verify(stateGroup.state === "void");
398 verify(stateGroup.state === "void");
404 }
399 }
405
400
406− // should be forcing active focus when interactive changes,
407− // which will cause a FocusScope higher in the object hierarchy tp be given the focus
408 function test_forceActiveFocusFollowsInterative() {
401 function test_forceActiveFocusFollowsInterative() {
409 fakeApplication.createSession();
402 fakeApplication.createSession();
410 applicationWindowLoader.item.interactive = false;
403 applicationWindowLoader.item.interactive = false;
411 applicationWindowLoader.item.interactive = true;
404 applicationWindowLoader.item.interactive = true;
412 fakeSession.createSurface();
405 fakeSession.createSurface();
413
406
414− compare(appFocus.focus, true);
407+ compare(fakeSession.surface.activeFocus, true);
408+
409+ applicationWindowLoader.item.interactive = false;
410+ compare(fakeSession.surface.activeFocus, false);
411+
412+ applicationWindowLoader.item.interactive = true;
413+ compare(fakeSession.surface.activeFocus, true);
415 }
414 }
416 }
415 }
417}
416}