on xenial help sign in
Merge pull request #365 from ubports/xenial_-_replace-test-loaders
d456639Rodney
plugins/GlobalShortcut/globalshortcut.cpp+3
@@ -58,6 +58,9 @@ void GlobalShortcut::setActive(bool active)
58
58
59void GlobalShortcut::componentComplete()
59void GlobalShortcut::componentComplete()
60{
60{
61+ if (this->window()) {
62+ QMetaObject::invokeMethod(this, "setupFilterOnWindow", Q_ARG(QQuickWindow*, this->window()));
63+ }
61 connect(this, &QQuickItem::windowChanged, this, &GlobalShortcut::setupFilterOnWindow);
64 connect(this, &QQuickItem::windowChanged, this, &GlobalShortcut::setupFilterOnWindow);
62}
65}
63
66
tests/mocks/Unity/Application/SurfaceManager.cpp−3
@@ -35,9 +35,6 @@ SurfaceManager *SurfaceManager::m_instance = nullptr;
35
35
36SurfaceManager *SurfaceManager::instance()
36SurfaceManager *SurfaceManager::instance()
37{
37{
38− if (m_instance == nullptr) {
39− auto inst = new SurfaceManager();
40− }
41 return m_instance;
38 return m_instance;
42}
39}
43
40
tests/qmltests/Tutorial/tst_Tutorial.qml+53−70
@@ -36,6 +36,8 @@ Rectangle {
36 width: units.gu(100) + buttons.width
36 width: units.gu(100) + buttons.width
37 height: units.gu(71)
37 height: units.gu(71)
38
38
39+ property var shell: null
40+
39 QtObject {
41 QtObject {
40 id: applicationArguments
42 id: applicationArguments
41
43
@@ -87,7 +89,23 @@ Rectangle {
87 Component.onCompleted: {
89 Component.onCompleted: {
88 // must set the mock mode before loading the Shell
90 // must set the mock mode before loading the Shell
89 LightDMController.userMode = "single-pin";
91 LightDMController.userMode = "single-pin";
90− shellLoader.active = true;
92+ }
93+
94+ Component {
95+ id: shellComponent
96+ Shell {
97+ anchors.fill: parent
98+ usageScenario: shellRect.state
99+ nativeWidth: width
100+ nativeHeight: height
101+ property string indicatorProfile: "phone"
102+ orientation: shellRect.shellOrientation
103+ orientations: Orientations {
104+ native_: shellRect.nativeOrientation
105+ primary: shellRect.primaryOrientation
106+ }
107+ hasTouchscreen: true
108+ }
91 }
109 }
92
110
93 Item {
111 Item {
@@ -97,10 +115,9 @@ Rectangle {
97 anchors.top: root.top
115 anchors.top: root.top
98 anchors.bottom: root.bottom
116 anchors.bottom: root.bottom
99
117
100− Loader {
118+ Rectangle {
101− id: shellLoader
119+ id: shellRect
102
120
103− active: false
104 anchors.horizontalCenter: parent.horizontalCenter
121 anchors.horizontalCenter: parent.horizontalCenter
105 anchors.top: parent.top
122 anchors.top: parent.top
106 anchors.bottom: parent.bottom
123 anchors.bottom: parent.bottom
@@ -114,14 +131,14 @@ Rectangle {
114 State {
131 State {
115 name: "phone"
132 name: "phone"
116 PropertyChanges {
133 PropertyChanges {
117− target: shellLoader
134+ target: shellRect
118 width: units.gu(40)
135 width: units.gu(40)
119 }
136 }
120 },
137 },
121 State {
138 State {
122 name: "tablet"
139 name: "tablet"
123 PropertyChanges {
140 PropertyChanges {
124− target: shellLoader
141+ target: shellRect
125 width: units.gu(100)
142 width: units.gu(100)
126 shellOrientation: Qt.LandscapeOrientation
143 shellOrientation: Qt.LandscapeOrientation
127 nativeOrientation: Qt.LandscapeOrientation
144 nativeOrientation: Qt.LandscapeOrientation
@@ -131,31 +148,11 @@ Rectangle {
131 State {
148 State {
132 name: "desktop"
149 name: "desktop"
133 PropertyChanges {
150 PropertyChanges {
134− target: shellLoader
151+ target: shellRect
135 width: units.gu(100)
152 width: units.gu(100)
136 }
153 }
137 }
154 }
138 ]
155 ]
139−
140− property bool itemDestroyed: false
141− sourceComponent: Component {
142− Shell {
143− usageScenario: shellLoader.state
144− nativeWidth: width
145− nativeHeight: height
146− property string indicatorProfile: "phone"
147− orientation: shellLoader.shellOrientation
148− orientations: Orientations {
149− native_: shellLoader.nativeOrientation
150− primary: shellLoader.primaryOrientation
151− }
152− hasTouchscreen: true
153−
154− Component.onDestruction: {
155− shellLoader.itemDestroyed = true;
156− }
157− }
158− }
159 }
156 }
160 }
157 }
161
158
@@ -170,15 +167,28 @@ Rectangle {
170 Column {
167 Column {
171 anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
168 anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
172 spacing: units.gu(1)
169 spacing: units.gu(1)
170+ Row {
171+ anchors { left: parent.left; right: parent.right }
172+ Button {
173+ text: "Load shell"
174+ onClicked: {
175+ if (shell === null) {
176+ shell = shellComponent.createObject(shellRect);
177+ shell.focus = true;
178+ }
179+ }
180+ }
181+ }
182+
173 Row {
183 Row {
174 anchors { left: parent.left; right: parent.right }
184 anchors { left: parent.left; right: parent.right }
175 Button {
185 Button {
176 text: "Hide Greeter"
186 text: "Hide Greeter"
177 onClicked: {
187 onClicked: {
178− if (shellLoader.status !== Loader.Ready)
188+ if (root.shell === null)
179 return;
189 return;
180
190
181− var greeter = testCase.findChild(shellLoader.item, "greeter");
191+ var greeter = testCase.findChild(shell, "greeter");
182 if (greeter.shown) {
192 if (greeter.shown) {
183 greeter.hide();
193 greeter.hide();
184 }
194 }
@@ -191,7 +201,7 @@ Rectangle {
191 Button {
201 Button {
192 text: "Restart Tutorial"
202 text: "Restart Tutorial"
193 onClicked: {
203 onClicked: {
194− if (shellLoader.status !== Loader.Ready)
204+ if (root.shell === null)
195 return;
205 return;
196
206
197 AccountsService.demoEdges = false;
207 AccountsService.demoEdges = false;
@@ -223,6 +233,7 @@ Rectangle {
223 CheckBox {
233 CheckBox {
224 activeFocusOnPress: false
234 activeFocusOnPress: false
225 onCheckedChanged: {
235 onCheckedChanged: {
236+ var topLevelSurfaceList = findInvisibleChild(shell, "topLevelSurfaceList");
226 var surface = topLevelSurfaceList.inputMethodSurface;
237 var surface = topLevelSurfaceList.inputMethodSurface;
227 if (checked) {
238 if (checked) {
228 surface.requestState(Mir.RestoredState);
239 surface.requestState(Mir.RestoredState);
@@ -252,19 +263,11 @@ Rectangle {
252 name: "Tutorial"
263 name: "Tutorial"
253 when: windowShown
264 when: windowShown
254
265
255− property Item shell: shellLoader.status === Loader.Ready ? shellLoader.item : null
256 property real halfWidth: shell ? shell.width / 2 : 0
266 property real halfWidth: shell ? shell.width / 2 : 0
257 property real halfHeight: shell ? shell.height / 2 : 0
267 property real halfHeight: shell ? shell.height / 2 : 0
258
268
259− onShellChanged: {
260− if (shell) {
261− topLevelSurfaceList = testCase.findInvisibleChild(shell, "topLevelSurfaceList");
262− } else {
263− topLevelSurfaceList = null;
264− }
265− }
266−
267 function init() {
269 function init() {
270+ shell = createTemporaryObject(shellComponent, shellRect);
268 prepareShell();
271 prepareShell();
269
272
270 var tutorialTop = findChild(shell, "tutorialTop");
273 var tutorialTop = findChild(shell, "tutorialTop");
@@ -274,38 +277,14 @@ Rectangle {
274 }
277 }
275
278
276 function cleanup() {
279 function cleanup() {
277− resetLoader("phone");
278− }
279−
280− function resetLoader(state) {
281− shellLoader.itemDestroyed = false;
282−
283− shellLoader.active = false;
284− shellLoader.state = state;
285−
286− tryCompare(shellLoader, "status", Loader.Null);
287− tryCompare(shellLoader, "item", null);
288− // Loader.status might be Loader.Null and Loader.item might be null but the Loader
289− // item might still be alive. So if we set Loader.active back to true
290− // again right now we will get the very same Shell instance back. So no reload
291− // actually took place. Likely because Loader waits until the next event loop
292− // iteration to do its work. So to ensure the reload, we will wait until the
293− // Shell instance gets destroyed.
294− tryCompare(shellLoader, "itemDestroyed", true);
295−
296− // kill all (fake) running apps
297− killApps();
298−
299− // reload our test subject to get it in a fresh state once again
300− shellLoader.active = true;
301−
302 mockNotificationsModel.clear();
280 mockNotificationsModel.clear();
303− tryCompare(shellLoader, "status", Loader.Ready);
281+ killApps();
304− removeTimeConstraintsFromSwipeAreas(shellLoader.item);
282+ shellRect.state = "phone";
305 }
283 }
306
284
307 function prepareShell() {
285 function prepareShell() {
308 tryCompare(shell, "waitingOnGreeter", false); // reset by greeter when ready
286 tryCompare(shell, "waitingOnGreeter", false); // reset by greeter when ready
287+ removeTimeConstraintsFromSwipeAreas(shell);
309
288
310 WindowStateStorage.clear();
289 WindowStateStorage.clear();
311 callManager.foregroundCall = null;
290 callManager.foregroundCall = null;
@@ -319,11 +298,11 @@ Rectangle {
319 }
298 }
320
299
321 function loadShell(state) {
300 function loadShell(state) {
322− resetLoader(state);
301+ shellRect.state = state;
323 prepareShell();
302 prepareShell();
324 }
303 }
325
304
326− function ensureInputMethodSurface() {
305+ function ensureInputMethodSurface(topLevelSurfaceList) {
327 var surfaceManager = findInvisibleChild(shell, "surfaceManager");
306 var surfaceManager = findInvisibleChild(shell, "surfaceManager");
328 verify(surfaceManager);
307 verify(surfaceManager);
329 surfaceManager.createInputMethodSurface();
308 surfaceManager.createInputMethodSurface();
@@ -726,10 +705,12 @@ Rectangle {
726 }
705 }
727
706
728 function test_oskDoesNotHideTutorial() {
707 function test_oskDoesNotHideTutorial() {
708+ var topLevelSurfaceList = findInvisibleChild(shell, "topLevelSurfaceList");
709+ verify(topLevelSurfaceList);
729 var tutorialTopLoader = findChild(shell, "tutorialTopLoader");
710 var tutorialTopLoader = findChild(shell, "tutorialTopLoader");
730 verify(tutorialTopLoader.shown);
711 verify(tutorialTopLoader.shown);
731
712
732− ensureInputMethodSurface();
713+ ensureInputMethodSurface(topLevelSurfaceList);
733 var surface = topLevelSurfaceList.inputMethodSurface;
714 var surface = topLevelSurfaceList.inputMethodSurface;
734 surface.requestState(Mir.RestoredState);
715 surface.requestState(Mir.RestoredState);
735
716
@@ -740,10 +721,12 @@ Rectangle {
740 }
721 }
741
722
742 function test_oskDelaysTutorial() {
723 function test_oskDelaysTutorial() {
724+ var topLevelSurfaceList = findInvisibleChild(shell, "topLevelSurfaceList");
725+ verify(topLevelSurfaceList);
743 var tutorial = findChild(shell, "tutorial");
726 var tutorial = findChild(shell, "tutorial");
744 verify(!tutorial.delayed);
727 verify(!tutorial.delayed);
745
728
746− ensureInputMethodSurface();
729+ ensureInputMethodSurface(topLevelSurfaceList);
747 topLevelSurfaceList.inputMethodSurface.requestState(Mir.RestoredState);
730 topLevelSurfaceList.inputMethodSurface.requestState(Mir.RestoredState);
748
731
749 tryCompare(tutorial, "delayed", true);
732 tryCompare(tutorial, "delayed", true);
tests/qmltests/tst_Shell.qml+76−72
@@ -15,7 +15,8 @@
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
16 */
17
17
18−import QtQuick 2.4
18+import QtQuick 2.7
19+import QtQuick.Window 2.4
19import QtTest 1.0
20import QtTest 1.0
20import AccountsService 0.1
21import AccountsService 0.1
21import GSettings 1.0
22import GSettings 1.0
@@ -51,14 +52,13 @@ Rectangle {
51 Component.onCompleted: {
52 Component.onCompleted: {
52 // must set the mock mode before loading the Shell
53 // must set the mock mode before loading the Shell
53 LightDMController.userMode = "single";
54 LightDMController.userMode = "single";
54− shellLoader.active = true;
55 }
55 }
56
56
57 ApplicationMenuDataLoader {
57 ApplicationMenuDataLoader {
58 id: appMenuData
58 id: appMenuData
59 }
59 }
60
60
61− property var shell: shellLoader.item ? shellLoader.item : null
61+ property var shell: null
62 onShellChanged: {
62 onShellChanged: {
63 if (shell) {
63 if (shell) {
64 topLevelSurfaceList = testCase.findInvisibleChild(shell, "topLevelSurfaceList");
64 topLevelSurfaceList = testCase.findInvisibleChild(shell, "topLevelSurfaceList");
@@ -71,14 +71,33 @@ Rectangle {
71
71
72 property var topLevelSurfaceList: null
72 property var topLevelSurfaceList: null
73
73
74+ Component {
75+ id: shellComponent
76+ Shell {
77+ id: __shell
78+ objectName: "shell"
79+ anchors.fill: parent
80+ usageScenario: usageScenarioSelector.model[usageScenarioSelector.selectedIndex]
81+ nativeWidth: width
82+ nativeHeight: height
83+ orientation: shellRect.shellOrientation
84+ orientations: Orientations {
85+ native_: shellRect.nativeOrientation
86+ primary: shellRect.primaryOrientation
87+ }
88+ mode: shellRect.mode
89+ hasTouchscreen: true
90+ }
91+ }
92+
74 Item {
93 Item {
75 id: shellContainer
94 id: shellContainer
76 anchors.left: root.left
95 anchors.left: root.left
77 anchors.right: controls.left
96 anchors.right: controls.left
78 anchors.top: root.top
97 anchors.top: root.top
79 anchors.bottom: root.bottom
98 anchors.bottom: root.bottom
80− Loader {
99+ Rectangle {
81− id: shellLoader
100+ id: shellRect
82 focus: true
101 focus: true
83
102
84 anchors.centerIn: parent
103 anchors.centerIn: parent
@@ -93,7 +112,7 @@ Rectangle {
93 State {
112 State {
94 name: "phone"
113 name: "phone"
95 PropertyChanges {
114 PropertyChanges {
96− target: shellLoader
115+ target: shellRect
97 width: units.gu(40)
116 width: units.gu(40)
98 height: units.gu(71)
117 height: units.gu(71)
99 }
118 }
@@ -101,7 +120,7 @@ Rectangle {
101 State {
120 State {
102 name: "tablet"
121 name: "tablet"
103 PropertyChanges {
122 PropertyChanges {
104− target: shellLoader
123+ target: shellRect
105 width: units.gu(100)
124 width: units.gu(100)
106 height: units.gu(71)
125 height: units.gu(71)
107 shellOrientation: Qt.LandscapeOrientation
126 shellOrientation: Qt.LandscapeOrientation
@@ -112,7 +131,7 @@ Rectangle {
112 State {
131 State {
113 name: "desktop"
132 name: "desktop"
114 PropertyChanges {
133 PropertyChanges {
115− target: shellLoader
134+ target: shellRect
116 width: shellContainer.width
135 width: shellContainer.width
117 height: shellContainer.height
136 height: shellContainer.height
118 }
137 }
@@ -122,28 +141,6 @@ Rectangle {
122 }
141 }
123 }
142 }
124 ]
143 ]
125−
126− active: false
127− property bool itemDestroyed: false
128− sourceComponent: Component {
129− Shell {
130− id: __shell
131− objectName: "shell"
132− usageScenario: usageScenarioSelector.model[usageScenarioSelector.selectedIndex]
133− nativeWidth: width
134− nativeHeight: height
135− orientation: shellLoader.shellOrientation
136− orientations: Orientations {
137− native_: shellLoader.nativeOrientation
138− primary: shellLoader.primaryOrientation
139− }
140− mode: shellLoader.mode
141− hasTouchscreen: true
142− Component.onDestruction: {
143− shellLoader.itemDestroyed = true;
144− }
145− }
146− }
147 }
144 }
148 }
145 }
149
146
@@ -170,14 +167,24 @@ Rectangle {
170 spacing: units.gu(1)
167 spacing: units.gu(1)
171 anchors { left: parent.left; right: parent.right }
168 anchors { left: parent.left; right: parent.right }
172
169
170+ Button {
171+ text: "Load shell"
172+ onClicked: {
173+ if (shell === null) {
174+ shell = shellComponent.createObject(shellRect);
175+ shell.focus = true;
176+ }
177+ }
178+ }
179+
173 Button {
180 Button {
174 text: "Show Greeter"
181 text: "Show Greeter"
175 activeFocusOnPress: false
182 activeFocusOnPress: false
176 onClicked: {
183 onClicked: {
177− if (shellLoader.status !== Loader.Ready)
184+ if (shell === null)
178 return;
185 return;
179
186
180− var greeter = shellLoader.item.greeter;
187+ var greeter = shell.greeter;
181 if (!greeter.shown) {
188 if (!greeter.shown) {
182 LightDM.Greeter.showGreeter();
189 LightDM.Greeter.showGreeter();
183 }
190 }
@@ -187,10 +194,10 @@ Rectangle {
187 text: "Hide Greeter"
194 text: "Hide Greeter"
188 activeFocusOnPress: false
195 activeFocusOnPress: false
189 onClicked: {
196 onClicked: {
190− if (shellLoader.status !== Loader.Ready)
197+ if (shell === null)
191 return;
198 return;
192
199
193− var greeter = shellLoader.item.greeter;
200+ var greeter = shell.greeter;
194 if (greeter.shown) {
201 if (greeter.shown) {
195 greeter.hide()
202 greeter.hide()
196 }
203 }
@@ -200,7 +207,7 @@ Rectangle {
200 text: callManager.foregroundCall ? "Hide Call" : "Show Call"
207 text: callManager.foregroundCall ? "Hide Call" : "Show Call"
201 activeFocusOnPress: false
208 activeFocusOnPress: false
202 onClicked: {
209 onClicked: {
203− if (shellLoader.status !== Loader.Ready)
210+ if (shell === null)
204 return;
211 return;
205
212
206 callManager.foregroundCall = callManager.foregroundCall ? null : phoneCall;
213 callManager.foregroundCall = callManager.foregroundCall ? null : phoneCall;
@@ -210,10 +217,10 @@ Rectangle {
210 text: "Show Launcher"
217 text: "Show Launcher"
211 activeFocusOnPress: false
218 activeFocusOnPress: false
212 onClicked: {
219 onClicked: {
213− if (shellLoader.status !== Loader.Ready)
220+ if (shell === null)
214 return;
221 return;
215
222
216− var launcher = testCase.findChild(shellLoader.item, "launcher");
223+ var launcher = testCase.findChild(shell, "launcher");
217 launcher.state = "visible";
224 launcher.state = "visible";
218 }
225 }
219 }
226 }
@@ -222,7 +229,7 @@ Rectangle {
222 activeFocusOnPress: false
229 activeFocusOnPress: false
223 onClicked: {
230 onClicked: {
224 var childs = new Array(0);
231 var childs = new Array(0);
225− childs.push(shellLoader.item)
232+ childs.push(shell)
226 while (childs.length > 0) {
233 while (childs.length > 0) {
227 if (childs[0].activeFocus && childs[0].focus && childs[0].objectName != "shell") {
234 if (childs[0].activeFocus && childs[0].focus && childs[0].objectName != "shell") {
228 console.log("Active focus is on item:", childs[0]);
235 console.log("Active focus is on item:", childs[0]);
@@ -248,7 +255,7 @@ Rectangle {
248 onSelectedIndexChanged: {
255 onSelectedIndexChanged: {
249 testCase.tearDown();
256 testCase.tearDown();
250 LightDMController.userMode = model[selectedIndex];
257 LightDMController.userMode = model[selectedIndex];
251− shellLoader.active = true;
258+ testCase.init();
252 }
259 }
253 }
260 }
254 Label {
261 Label {
@@ -261,7 +268,7 @@ Rectangle {
261 activeFocusOnPress: false
268 activeFocusOnPress: false
262 model: ["phone", "tablet", "desktop"]
269 model: ["phone", "tablet", "desktop"]
263 onSelectedIndexChanged: {
270 onSelectedIndexChanged: {
264− shellLoader.state = model[selectedIndex];
271+ shellRect.state = model[selectedIndex];
265 }
272 }
266 }
273 }
267 Label {
274 Label {
@@ -419,19 +426,19 @@ Rectangle {
419 if (guard) return;
426 if (guard) return;
420 guard = true;
427 guard = true;
421 testCase.tearDown();
428 testCase.tearDown();
422− shellLoader.mode = model[selectedIndex];
429+ shellRect.mode = model[selectedIndex];
423− shellLoader.active = true;
430+ testCase.init();
424 guard = false;
431 guard = false;
425 }
432 }
426 Connections {
433 Connections {
427− target: shellLoader
434+ target: shellRect
428 onModeChanged: {
435 onModeChanged: {
429 if (shellModeSelector.guard) {
436 if (shellModeSelector.guard) {
430 return;
437 return;
431 }
438 }
432 shellModeSelector.guard = true;
439 shellModeSelector.guard = true;
433 for (var i = 0; i < 3; i++) {
440 for (var i = 0; i < 3; i++) {
434− if (shellModeSelector.model[i] === shellLoader.mode) {
441+ if (shellModeSelector.model[i] === shellRect.mode) {
435 shellModeSelector.selectedIndex = i;
442 shellModeSelector.selectedIndex = i;
436 return;
443 return;
437 }
444 }
@@ -556,17 +563,26 @@ Rectangle {
556 name: "Shell"
563 name: "Shell"
557 when: windowShown
564 when: windowShown
558
565
559− property Item shell: shellLoader.status === Loader.Ready ? shellLoader.item : null
560−
561 function initTestCase() {
566 function initTestCase() {
567+ // FIXME: The first shell created in the testcase sometimes doesn't
568+ // receive Alt keypresses. Creating and destroying a shell seems
569+ // to fix it.
570+ var localShell = createTemporaryObject(shellComponent, shellRect);
571+ localShell.destroy();
562 tearDown();
572 tearDown();
563 }
573 }
564
574
565 function init() {
575 function init() {
566 mouseMove(root, 0, 0);
576 mouseMove(root, 0, 0);
577+ keyRelease(Qt.Key_Alt);
578+ keyRelease(Qt.Key_Control);
579+ keyRelease(Qt.Key_Super_L);
567 }
580 }
568
581
569 function cleanup() {
582 function cleanup() {
583+ var keyMapper = testCase.findChild(shellContainer, "physicalKeysMapper");
584+ keyMapper.controlInsteadOfAlt = false;
585+ keyMapper.controlInsteadOfSuper = false;
570 waitForRendering(shell);
586 waitForRendering(shell);
571 mouseEmulation.checked = true;
587 mouseEmulation.checked = true;
572 tryCompare(shell, "waitingOnGreeter", false); // make sure greeter didn't leave us in disabled state
588 tryCompare(shell, "waitingOnGreeter", false); // make sure greeter didn't leave us in disabled state
@@ -580,10 +596,9 @@ Rectangle {
580 apps = 0;
596 apps = 0;
581 }
597 }
582
598
583− shellLoader.state = formFactor;
599+ shellRect.state = formFactor;
584− shellLoader.active = true;
600+ shell = createTemporaryObject(shellComponent, shellRect);
585− tryCompare(shellLoader, "status", Loader.Ready);
586− removeTimeConstraintsFromSwipeAreas(shellLoader.item);
601+ removeTimeConstraintsFromSwipeAreas(shell);
587 tryCompare(shell, "waitingOnGreeter", false); // reset by greeter when ready
602 tryCompare(shell, "waitingOnGreeter", false); // reset by greeter when ready
588
603
589 sessionSpy.target = shell.greeter;
604 sessionSpy.target = shell.greeter;
@@ -606,6 +621,8 @@ Rectangle {
606 stage = findChild(shell, "stage");
621 stage = findChild(shell, "stage");
607
622
608 addApps(apps);
623 addApps(apps);
624+ shell.focus = true;
625+ waitForRendering(shell);
609 }
626 }
610
627
611 function addApps(count) {
628 function addApps(count) {
@@ -636,20 +653,6 @@ Rectangle {
636 function tearDown() {
653 function tearDown() {
637 launcherShowDashHomeSpy.target = null;
654 launcherShowDashHomeSpy.target = null;
638
655
639− shellLoader.itemDestroyed = false;
640−
641− shellLoader.active = false;
642−
643− tryCompare(shellLoader, "status", Loader.Null);
644− tryCompare(shellLoader, "item", null);
645− // Loader.status might be Loader.Null and Loader.item might be null but the Loader
646− // item might still be alive. So if we set Loader.active back to true
647− // again right now we will get the very same Shell instance back. So no reload
648− // actually took place. Likely because Loader waits until the next event loop
649− // iteration to do its work. So to ensure the reload, we will wait until the
650− // Shell instance gets destroyed.
651− tryCompare(shellLoader, "itemDestroyed", true);
652−
653 LightDMController.reset();
656 LightDMController.reset();
654 setLightDMMockMode("single"); // these tests default to "single"
657 setLightDMMockMode("single"); // these tests default to "single"
655
658
@@ -657,7 +660,7 @@ Rectangle {
657 AccountsService.demoEdgesCompleted = [];
660 AccountsService.demoEdgesCompleted = [];
658 AccountsService.backgroundFile = "";
661 AccountsService.backgroundFile = "";
659 Wizard.System.wizardEnabled = false;
662 Wizard.System.wizardEnabled = false;
660− shellLoader.mode = "full-greeter";
663+ shellRect.mode = "full-greeter";
661
664
662 // kill all (fake) running apps
665 // kill all (fake) running apps
663 killApps();
666 killApps();
@@ -1647,8 +1650,9 @@ Rectangle {
1647
1650
1648 var spreadItem = findChild(shell, "spreadItem");
1651 var spreadItem = findChild(shell, "spreadItem");
1649 verify(spreadItem !== null);
1652 verify(spreadItem !== null);
1653+ waitForRendering(shell);
1650
1654
1651− keyPress(Qt.Key_Alt)
1655+ keyPress(Qt.Key_Alt);
1652 keyClick(Qt.Key_Tab);
1656 keyClick(Qt.Key_Tab);
1653 tryCompare(spreadItem, "highlightedIndex", 1);
1657 tryCompare(spreadItem, "highlightedIndex", 1);
1654
1658
@@ -2406,7 +2410,7 @@ Rectangle {
2406 }
2410 }
2407
2411
2408 function test_greeterModeBroadcastsApp() {
2412 function test_greeterModeBroadcastsApp() {
2409− shellLoader.mode = "greeter";
2413+ shellRect.mode = "greeter";
2410 setLightDMMockMode("single-pin");
2414 setLightDMMockMode("single-pin");
2411 loadShell("phone");
2415 loadShell("phone");
2412 waitForRendering(shell);
2416 waitForRendering(shell);
@@ -2424,7 +2428,7 @@ Rectangle {
2424 }
2428 }
2425
2429
2426 function test_greeterModeBroadcastsHome() {
2430 function test_greeterModeBroadcastsHome() {
2427− shellLoader.mode = "greeter";
2431+ shellRect.mode = "greeter";
2428 setLightDMMockMode("single-pin");
2432 setLightDMMockMode("single-pin");
2429 loadShell("phone");
2433 loadShell("phone");
2430 waitForRendering(shell);
2434 waitForRendering(shell);
@@ -2445,7 +2449,7 @@ Rectangle {
2445 }
2449 }
2446
2450
2447 function test_greeterModeDispatchesURL() {
2451 function test_greeterModeDispatchesURL() {
2448− shellLoader.mode = "greeter";
2452+ shellRect.mode = "greeter";
2449 setLightDMMockMode("single-pin");
2453 setLightDMMockMode("single-pin");
2450 loadShell("phone");
2454 loadShell("phone");
2451 waitForRendering(shell);
2455 waitForRendering(shell);
@@ -2501,7 +2505,7 @@ Rectangle {
2501 tryCompare(appSurface, "keymap", "fr");
2505 tryCompare(appSurface, "keymap", "fr");
2502
2506
2503 // go to e.g. desktop stage
2507 // go to e.g. desktop stage
2504− shellLoader.state = "desktop";
2508+ shellRect.state = "desktop";
2505 shell.usageScenario = "desktop";
2509 shell.usageScenario = "desktop";
2506 waitForRendering(shell);
2510 waitForRendering(shell);
2507
2511
@@ -2574,7 +2578,7 @@ Rectangle {
2574 }
2578 }
2575
2579
2576 function test_fullShellModeHasNoInitialGreeter() {
2580 function test_fullShellModeHasNoInitialGreeter() {
2577− shellLoader.mode = "full-shell";
2581+ shellRect.mode = "full-shell";
2578 loadShell("phone");
2582 loadShell("phone");
2579 setLightDMMockMode("single-pin");
2583 setLightDMMockMode("single-pin");
2580 waitForRendering(shell);
2584 waitForRendering(shell);
@@ -3309,7 +3313,7 @@ Rectangle {
3309 */
3313 */
3310 function test_launcherLockedWhenNoAppsRunning(data) {
3314 function test_launcherLockedWhenNoAppsRunning(data) {
3311 loadShell(data.shell, 0);
3315 loadShell(data.shell, 0);
3312− shellLoader.state = data.formFactor;
3316+ shellRect.state = data.formFactor;
3313 var launcher = findChild(shell, "launcher");
3317 var launcher = findChild(shell, "launcher");
3314 var inputMethod = findChild(shell, "inputMethod");
3318 var inputMethod = findChild(shell, "inputMethod");
3315 GSettingsController.setAutohideLauncher(!data.launcherLocked);
3319 GSettingsController.setAutohideLauncher(!data.launcherLocked);