on xenial help sign in
fix parts of phonestage tests, not complete yet
0b077f2Michael Zanetti
qml/Stage/Stage.qml+5−3
@@ -1480,12 +1480,14 @@ AbstractStage {
1480 }
1480 }
1481 onClose: {
1481 onClose: {
1482 priv.closingIndex = index
1482 priv.closingIndex = index
1483+ if (model.surface) { // could be stopped by OOM
1483− model.surface.close()
1484+ model.surface.close()
1485+ } else if (model.application) {
1486+ root.applicationManager.stopApplication(model.application.appId);
1487+ }
1484 }
1488 }
1485 }
1489 }
1486
1490
1487−// Rectangle { anchors.fill: parent; color: "blue"; opacity: .4 }
1488−
1489 WindowInfoItem {
1491 WindowInfoItem {
1490 id: windowInfoItem
1492 id: windowInfoItem
1491 objectName: "windowInfoItem"
1493 objectName: "windowInfoItem"
tests/qmltests/Stage/tst_PhoneStage.qml+100−198
@@ -32,7 +32,7 @@ Item {
32 property var greeter: { fullyShown: true }
32 property var greeter: { fullyShown: true }
33
33
34 Stage {
34 Stage {
35− id: phoneStage
35+ id: stage
36 anchors { fill: parent; rightMargin: units.gu(30) }
36 anchors { fill: parent; rightMargin: units.gu(30) }
37 focus: true
37 focus: true
38 dragAreaWidth: units.gu(2)
38 dragAreaWidth: units.gu(2)
@@ -67,9 +67,9 @@ Item {
67 id: edgeBarrierControls
67 id: edgeBarrierControls
68 text: "Drag here to pull out spread"
68 text: "Drag here to pull out spread"
69 backgroundColor: "blue"
69 backgroundColor: "blue"
70− onDragged: { phoneStage.pushRightEdge(amount); }
70+ onDragged: { stage.pushRightEdge(amount); }
71 Component.onCompleted: {
71 Component.onCompleted: {
72− edgeBarrierControls.target = testCase.findChild(phoneStage, "edgeBarrierController");
72+ edgeBarrierControls.target = testCase.findChild(stage, "edgeBarrierController");
73 }
73 }
74 }
74 }
75 Repeater {
75 Repeater {
@@ -85,11 +85,37 @@ Item {
85 name: "PhoneStage"
85 name: "PhoneStage"
86 when: windowShown
86 when: windowShown
87
87
88+ function init() {
89+ // wait until unity8-dash is up and running.
90+ // it's started automatically by ApplicationManager mock implementation
91+ tryCompare(ApplicationManager, "count", 1);
92+ var dashApp = ApplicationManager.findApplication("unity8-dash");
93+ verify(dashApp);
94+ tryCompare(dashApp, "state", ApplicationInfoInterface.Running);
95+ }
96+
97+ function cleanup() {
98+ ApplicationManager.requestFocusApplication("unity8-dash");
99+ tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
100+ tryCompare(stage, "state", "staged");
101+ waitForRendering(stage);
102+
103+ killApps();
104+ // wait for Stage to stabilize back into its initial state
105+ var appRepeater = findChild(stage, "appRepeater");
106+ tryCompare(appRepeater, "count", 1);
107+ tryCompare(appRepeater.itemAt(0), "x", 0);
108+
109+ stage.shellOrientationAngle = 0;
110+
111+ waitForRendering(stage)
112+ }
113+
88 function findAppWindowForSurfaceId(surfaceId) {
114 function findAppWindowForSurfaceId(surfaceId) {
89 var delegateObjectName = "appDelegate_" + surfaceId;
115 var delegateObjectName = "appDelegate_" + surfaceId;
90− var spreadDelegate = findChild(phoneStage, delegateObjectName);
116+ var spreadDelegate = findChild(stage, delegateObjectName);
91 if (!spreadDelegate) {
117 if (!spreadDelegate) {
92− console.warn("Failed to find " + delegateObjectName + " in phoneStage ("+phoneStage+")");
118+ console.warn("Failed to find " + delegateObjectName + " in stage");
93 return null;
119 return null;
94 }
120 }
95 var appWindow = findChild(spreadDelegate, "appWindow");
121 var appWindow = findChild(spreadDelegate, "appWindow");
@@ -109,31 +135,29 @@ Item {
109 function addApps(count) {
135 function addApps(count) {
110 if (count == undefined) count = 1;
136 if (count == undefined) count = 1;
111 for (var i = 0; i < count; i++) {
137 for (var i = 0; i < count; i++) {
138+ var startingAppId = ApplicationManager.availableApplications[ApplicationManager.count];
112 var appSurfaceId = topLevelSurfaceList.nextId;
139 var appSurfaceId = topLevelSurfaceList.nextId;
113− var app = ApplicationManager.startApplication(ApplicationManager.availableApplications[ApplicationManager.count])
140+ var app = ApplicationManager.startApplication(startingAppId)
114 tryCompare(app, "state", ApplicationInfoInterface.Running)
141 tryCompare(app, "state", ApplicationInfoInterface.Running)
115 waitUntilAppSurfaceShowsUp(appSurfaceId);
142 waitUntilAppSurfaceShowsUp(appSurfaceId);
116− waitForRendering(phoneStage)
143+ waitForRendering(stage)
144+ tryCompare(ApplicationManager, "focusedApplicationId", startingAppId)
117 }
145 }
118 }
146 }
119
147
120 function performEdgeSwipeToShowAppSpread() {
148 function performEdgeSwipeToShowAppSpread() {
121− var spreadView = findChild(phoneStage, "spreadView");
122−
123− // Keep it inside the PhoneStage otherwise the controls on the right side will
149+ // Keep it inside the Stage otherwise the controls on the right side will
124 // capture the press thus the "- 2" on startX.
150 // capture the press thus the "- 2" on startX.
125− var startX = phoneStage.width - 2;
151+ var startX = stage.width - 2;
126− var startY = phoneStage.height / 2;
152+ var startY = stage.height / 2;
127 var endY = startY;
153 var endY = startY;
128− var endX = phoneStage.width / 2;
154+ var endX = stage.width / 2;
129
155
130− touchFlick(phoneStage, startX, startY, endX, endY,
156+ touchFlick(stage, startX, startY, endX, endY,
131 true /* beginTouch */, true /* endTouch */, units.gu(10), 50);
157 true /* beginTouch */, true /* endTouch */, units.gu(10), 50);
132
158
133− tryCompare(spreadView, "phase", 2);
159+ tryCompare(stage, "state", "spread");
134− tryCompare(spreadView, "flicking", false);
135− tryCompare(spreadView, "moving", false);
136− waitForRendering(phoneStage);
160+ waitForRendering(stage);
137 }
161 }
138
162
139 function swipeSurfaceUpwards(surfaceId) {
163 function swipeSurfaceUpwards(surfaceId) {
@@ -162,7 +186,7 @@ Item {
162
186
163 function waitUntilAppDelegateStopsMoving(targetSurfaceId)
187 function waitUntilAppDelegateStopsMoving(targetSurfaceId)
164 {
188 {
165− var targetAppDelegate = findChild(phoneStage, "spreadDelegate_" + targetSurfaceId);
189+ var targetAppDelegate = findChild(stage, "appDelegate_" + targetSurfaceId);
166 verify(targetAppDelegate);
190 verify(targetAppDelegate);
167 var lastValue = undefined;
191 var lastValue = undefined;
168 do {
192 do {
@@ -171,79 +195,40 @@ Item {
171 } while (lastValue != targetAppDelegate.animatedProgress);
195 } while (lastValue != targetAppDelegate.animatedProgress);
172 }
196 }
173
197
174− function test_shortFlick() {
175− addApps(2)
176− var startX = phoneStage.width - units.gu(1);
177− var startY = phoneStage.height / 2;
178− var endX = startX - units.gu(4);
179− var endY = startY;
180−
181− var activeApp = ApplicationManager.get(0);
182− var inactiveApp = ApplicationManager.get(1);
183−
184− touchFlick(phoneStage, startX, startY, endX, endY,
185− true /* beginTouch */, true /* endTouch */, units.gu(10), 50);
186−
187− tryCompare(ApplicationManager, "focusedApplicationId", inactiveApp.appId)
188−
189− touchFlick(phoneStage, startX, startY, endX, endY,
190− true /* beginTouch */, true /* endTouch */, units.gu(10), 50);
191−
192− tryCompare(ApplicationManager, "focusedApplicationId", activeApp.appId)
193− }
194−
195 function test_enterSpread_data() {
198 function test_enterSpread_data() {
196 return [
199 return [
197− {tag: "<position1 (linear movement)", positionMarker: "positionMarker1", linear: true, offset: 0, endPhase: 0, targetPhase: 0, newFocusedIndex: 1 },
200+ {tag: "<breakPoint (trigger)", progress: .2, cancel: false, endState: "staged", newFocusedIndex: 1 },
198− {tag: "<position1 (non-linear movement)", positionMarker: "positionMarker1", linear: false, offset: 0, endPhase: 0, targetPhase: 0, newFocusedIndex: 0 },
201+ {tag: "<breakPoint (cancel)", progress: .2, cancel: true, endState: "staged", newFocusedIndex: 0 },
199− {tag: ">position1", positionMarker: "positionMarker1", linear: true, offset: +5, endPhase: 0, targetPhase: 0, newFocusedIndex: 1 },
202+ {tag: ">breakPoint (trigger)", progress: .5, cancel: false, endState: "spread", newFocusedIndex: 0 },
200− {tag: "<position2 (linear)", positionMarker: "positionMarker2", linear: true, offset: 0, endPhase: 0, targetPhase: 0, newFocusedIndex: 1 },
203+ {tag: ">breakPoint (cancel)", progress: .8, cancel: true, endState: "staged", newFocusedIndex: 0 },
201− {tag: "<position2 (non-linear)", positionMarker: "positionMarker2", linear: false, offset: 0, endPhase: 0, targetPhase: 0, newFocusedIndex: 1 },
202− {tag: ">position2", positionMarker: "positionMarker2", linear: true, offset: +5, endPhase: 1, targetPhase: 0, newFocusedIndex: 1 },
203− {tag: "<position3", positionMarker: "positionMarker3", linear: true, offset: 0, endPhase: 1, targetPhase: 0, newFocusedIndex: 1 },
204− {tag: ">position3", positionMarker: "positionMarker3", linear: true, offset: +5, endPhase: 1, targetPhase: 2, newFocusedIndex: 2 },
205 ];
204 ];
206 }
205 }
207
206
208 function test_enterSpread(data) {
207 function test_enterSpread(data) {
209 addApps(5)
208 addApps(5)
210
209
211− var spreadView = findChild(phoneStage, "spreadView");
212−
213− // Keep it inside the PhoneStage otherwise the controls on the right side will
210+ // Keep it inside the Stage otherwise the controls on the right side will
214 // capture the press thus the "- 2" on startX.
211 // capture the press thus the "- 2" on startX.
215− var startX = phoneStage.width - 2;
212+ var startX = stage.width - 2;
216− var startY = phoneStage.height / 2;
213+ var startY = stage.height / 2;
217 var endY = startY;
214 var endY = startY;
218− var endX = spreadView.width - (spreadView.width * spreadView[data.positionMarker]) - data.offset
215+ var endX = stage.width - (stage.width * data.progress) - stage.dragAreaWidth;
219− - phoneStage.dragAreaWidth;
220
216
221 var oldFocusedApp = ApplicationManager.get(0);
217 var oldFocusedApp = ApplicationManager.get(0);
222 var newFocusedApp = ApplicationManager.get(data.newFocusedIndex);
218 var newFocusedApp = ApplicationManager.get(data.newFocusedIndex);
223
219
224− touchFlick(phoneStage, startX, startY, endX, endY,
220+ touchFlick(stage, startX, startY, endX, endY,
225 true /* beginTouch */, false /* endTouch */, units.gu(10), 50);
221 true /* beginTouch */, false /* endTouch */, units.gu(10), 50);
226
222
227− tryCompare(spreadView, "phase", data.endPhase)
228−
229− if (!data.linear) {
223+ if (data.cancel) {
230− touchFlick(phoneStage, endX, endY, endX + units.gu(.5), endY,
224+ touchFlick(stage, endX, endY, endX + units.gu(5), endY,
231− false /* beginTouch */, false /* endTouch */, units.gu(10), 50);
225+ false /* beginTouch */, true /* endTouch */, units.gu(10), 50);
232− touchFlick(phoneStage, endY + units.gu(.5), endY, endX, endY,
226+ } else {
233− false /* beginTouch */, false /* endTouch */, units.gu(10), 50);
227+ touchRelease(stage, endX, endY);
234 }
228 }
235
229
236− touchRelease(phoneStage, endX, endY);
230+ tryCompare(stage, "state", data.endState);
237−
238− tryCompare(spreadView, "phase", data.targetPhase)
239−
240− if (data.targetPhase == 2) {
241− var app2 = findChild(spreadView, "spreadDelegate_" + topLevelSurfaceList.idAt(2));
242− tryCompare(app2, "swipeToCloseEnabled", true);
243− mouseClick(app2, units.gu(1), units.gu(1));
244− }
245−
246− tryCompare(ApplicationManager, "focusedApplicationId", newFocusedApp.appId);
231+ tryCompare(ApplicationManager, "focusedApplicationId", data.endState == "spread" ? "" : newFocusedApp.appId);
247 }
232 }
248
233
249 function test_selectAppFromSpread_data() {
234 function test_selectAppFromSpread_data() {
@@ -262,32 +247,26 @@ Item {
262 function test_selectAppFromSpread(data) {
247 function test_selectAppFromSpread(data) {
263 addApps(data.total)
248 addApps(data.total)
264
249
265− var spreadView = findChild(phoneStage, "spreadView");
266−
267 performEdgeSwipeToShowAppSpread();
250 performEdgeSwipeToShowAppSpread();
268
251
269− tryCompare(spreadView, "phase", 2);
270−
271− var tile = findChild(spreadView, "spreadDelegate_" + topLevelSurfaceList.idAt(data.index));
252+ var tile = findChild(stage, "appDelegate_" + topLevelSurfaceList.idAt(data.index));
272 var appId = ApplicationManager.get(data.index).appId;
253 var appId = ApplicationManager.get(data.index).appId;
273
254
274− if (tile.mapToItem(spreadView, 0, 0).x > spreadView.width) {
255+ if (tile.mapToItem(stage, 0, 0).x > stage.width) {
275 // Item is not visible... Need to flick the spread
256 // Item is not visible... Need to flick the spread
276− var startX = phoneStage.width - units.gu(1);
257+ var startX = stage.width - units.gu(1);
277− var startY = phoneStage.height / 2;
258+ var startY = stage.height / 2;
278 var endY = startY;
259 var endY = startY;
279 var endX = units.gu(2);
260 var endX = units.gu(2);
280− touchFlick(phoneStage, startX, startY, endX, endY, true, true, units.gu(10), 50)
261+ touchFlick(stage, startX, startY, endX, endY, true, true, units.gu(10), 50)
281− tryCompare(spreadView, "flicking", false);
282− tryCompare(spreadView, "moving", false);
283−// waitForRendering(phoneStage);
284 }
262 }
285
263
286 console.log("clicking app", data.index, "(", appId, ")")
264 console.log("clicking app", data.index, "(", appId, ")")
265+ var dragArea = findChild(tile, "dragArea");
287− tryCompare(tile, "swipeToCloseEnabled", true);
266+ tryCompare(dragArea, "closeable", true);
288− mouseClick(spreadView, tile.mapToItem(spreadView, 0, 0).x + units.gu(1), spreadView.height / 2)
267+ mouseClick(stage, tile.mapToItem(stage, 0, 0).x + units.gu(1), stage.height / 2)
289 tryCompare(ApplicationManager, "focusedApplicationId", appId);
268 tryCompare(ApplicationManager, "focusedApplicationId", appId);
290− tryCompare(spreadView, "phase", 0);
269+ tryCompare(stage, "state", "staged");
291 }
270 }
292
271
293 function test_select_data() {
272 function test_select_data() {
@@ -301,12 +280,12 @@ Item {
301 function test_select(data) {
280 function test_select(data) {
302 addApps(5);
281 addApps(5);
303
282
304− var spreadView = findChild(phoneStage, "spreadView");
283+ var spreadView = findChild(stage, "spreadView");
305 var selectedApp = ApplicationManager.get(data.index);
284 var selectedApp = ApplicationManager.get(data.index);
306
285
307 performEdgeSwipeToShowAppSpread();
286 performEdgeSwipeToShowAppSpread();
308
287
309− phoneStage.select(selectedApp.appId);
288+ stage.select(selectedApp.appId);
310
289
311 tryCompare(spreadView, "contentX", -spreadView.shift);
290 tryCompare(spreadView, "contentX", -spreadView.shift);
312
291
@@ -319,37 +298,14 @@ Item {
319 var focusedAppId = ApplicationManager.focusedApplicationId;
298 var focusedAppId = ApplicationManager.focusedApplicationId;
320
299
321 performEdgeSwipeToShowAppSpread();
300 performEdgeSwipeToShowAppSpread();
301+ tryCompare(stage, "state", "spread");
322
302
323− mouseClick(phoneStage, units.gu(1), units.gu(1));
303+ mouseClick(stage, units.gu(1), units.gu(1));
324
304
325− // Make sure the spread is in the idle position
305+ tryCompare(stage, "state", "staged");
326− var spreadView = findChild(phoneStage, "spreadView");
327− tryCompare(spreadView, "contentX", -spreadView.shift);
328
306
329 // Make sure the same app is still focused
307 // Make sure the same app is still focused
330− compare(focusedAppId, ApplicationManager.focusedApplicationId);
308+ tryCompare(ApplicationManager, "focusedApplicationId", focusedAppId);
331− }
332−
333− function init() {
334− // wait until unity8-dash is up and running.
335− // it's started automatically by ApplicationManager mock implementation
336− tryCompare(ApplicationManager, "count", 1);
337− var dashApp = ApplicationManager.findApplication("unity8-dash");
338− verify(dashApp);
339− tryCompare(dashApp, "state", ApplicationInfoInterface.Running);
340− }
341−
342− function cleanup() {
343− killApps();
344−
345− phoneStage.shellOrientationAngle = 0;
346− phoneStage.select(ApplicationManager.get(0).appId);
347−
348− // wait for PhoneStage to stabilize back into its initial state
349− var spreadView = findChild(phoneStage, "spreadView");
350− while (spreadView.phase !== 0 || spreadView.contentX !== -spreadView.shift || spreadView.selectedIndex != -1) {
351− wait(50);
352− }
353 }
309 }
354
310
355 function test_focusNewTopMostAppAfterFocusedOneClosesItself() {
311 function test_focusNewTopMostAppAfterFocusedOneClosesItself() {
@@ -369,57 +325,6 @@ Item {
369 tryCompare(firstApp, "focused", true);
325 tryCompare(firstApp, "focused", true);
370 }
326 }
371
327
372− function test_cantCloseWhileSnapping() {
373− addApps(2);
374−
375− performEdgeSwipeToShowAppSpread();
376−
377− var spreadView = findChild(phoneStage, "spreadView");
378− var selectedApp = ApplicationManager.get(2);
379−
380− performEdgeSwipeToShowAppSpread();
381−
382− var app0 = findChild(spreadView, "spreadDelegate_" + topLevelSurfaceList.idAt(0));
383− var app1 = findChild(spreadView, "spreadDelegate_" + topLevelSurfaceList.idAt(1));
384− var app2 = findChild(spreadView, "spreadDelegate_" + topLevelSurfaceList.idAt(2));
385−
386− var dragArea0 = findChild(app0, "dragArea");
387− var dragArea1 = findChild(app1, "dragArea");
388− var dragArea2 = findChild(app2, "dragArea");
389−
390− compare(dragArea0.enabled, true);
391− compare(dragArea1.enabled, true);
392− compare(dragArea2.enabled, true);
393−
394− phoneStage.select(selectedApp.appId);
395−
396− // Make sure all drag areas are disabled instantly. Don't use tryCompare here!
397− compare(dragArea0.enabled, false);
398− compare(dragArea1.enabled, false);
399− compare(dragArea2.enabled, false);
400−
401− tryCompare(spreadView, "contentX", -spreadView.shift)
402− }
403−
404− function test_cantAccessPhoneStageWhileRightEdgeGesture() {
405− var spreadView = findChild(phoneStage, "spreadView");
406− var eventEaterArea = findChild(phoneStage, "eventEaterArea")
407−
408− var startX = phoneStage.width - 2;
409− var startY = phoneStage.height / 2;
410− var endY = startY;
411− var endX = phoneStage.width / 2;
412−
413− touchFlick(phoneStage, startX, startY, endX, endY,
414− true /* beginTouch */, false /* endTouch */, units.gu(10), 50);
415−
416− compare(eventEaterArea.enabled, true);
417−
418− touchRelease(phoneStage, endX, endY);
419−
420− compare(eventEaterArea.enabled, false);
421− }
422−
423 function test_leftEdge_data() {
328 function test_leftEdge_data() {
424 return [
329 return [
425 { tag: "normal", inSpread: false, leftEdgeDragWidth: units.gu(5), shouldMoveApp: true },
330 { tag: "normal", inSpread: false, leftEdgeDragWidth: units.gu(5), shouldMoveApp: true },
@@ -434,12 +339,12 @@ Item {
434 performEdgeSwipeToShowAppSpread();
339 performEdgeSwipeToShowAppSpread();
435 }
340 }
436
341
437− var focusedDelegate = findChild(phoneStage, "spreadDelegate_" + topLevelSurfaceList.idAt(0));
342+ var focusedDelegate = findChild(stage, "appDelegate_" + topLevelSurfaceList.idAt(0));
438− phoneStage.inverseProgress = data.leftEdgeDragWidth;
343+ stage.inverseProgress = data.leftEdgeDragWidth;
439
344
440 tryCompare(focusedDelegate, "x", data.shouldMoveApp ? data.leftEdgeDragWidth : 0);
345 tryCompare(focusedDelegate, "x", data.shouldMoveApp ? data.leftEdgeDragWidth : 0);
441
346
442− phoneStage.inverseProgress = 0;
347+ stage.inverseProgress = 0;
443
348
444 tryCompare(focusedDelegate, "x", 0);
349 tryCompare(focusedDelegate, "x", 0);
445 }
350 }
@@ -447,9 +352,9 @@ Item {
447 function test_focusedAppIsTheOnlyRunningApp() {
352 function test_focusedAppIsTheOnlyRunningApp() {
448 addApps(2);
353 addApps(2);
449
354
450− var delegateA = findChild(phoneStage, "spreadDelegate_" + topLevelSurfaceList.idAt(0));
355+ var delegateA = findChild(stage, "appDelegate_" + topLevelSurfaceList.idAt(0));
451 verify(delegateA);
356 verify(delegateA);
452− var delegateB = findChild(phoneStage, "spreadDelegate_" + topLevelSurfaceList.idAt(1));
357+ var delegateB = findChild(stage, "appDelegate_" + topLevelSurfaceList.idAt(1));
453 verify(delegateB);
358 verify(delegateB);
454
359
455 // A is focused and running, B is unfocused and suspended
360 // A is focused and running, B is unfocused and suspended
@@ -460,7 +365,7 @@ Item {
460
365
461 // Switch foreground/focused appp from A to B
366 // Switch foreground/focused appp from A to B
462 performEdgeSwipeToShowAppSpread();
367 performEdgeSwipeToShowAppSpread();
463− phoneStage.select(delegateB.application.appId);
368+ stage.select(delegateB.application.appId);
464
369
465 // Now it's the other way round
370 // Now it's the other way round
466 // A is unfocused and suspended, B is focused and running
371 // A is unfocused and suspended, B is focused and running
@@ -473,15 +378,15 @@ Item {
473 function test_dashRemainsRunningIfStageIsToldSo() {
378 function test_dashRemainsRunningIfStageIsToldSo() {
474 addApps(1);
379 addApps(1);
475
380
476− var delegateDash = findChild(phoneStage, "spreadDelegate_" + topLevelSurfaceList.idAt(1));
381+ var delegateDash = findChild(stage, "appDelegate_" + topLevelSurfaceList.idAt(1));
477 verify(delegateDash);
382 verify(delegateDash);
478 compare(delegateDash.application.appId, "unity8-dash");
383 compare(delegateDash.application.appId, "unity8-dash");
479
384
480− var delegateOther = findChild(phoneStage, "spreadDelegate_" + topLevelSurfaceList.idAt(0));
385+ var delegateOther = findChild(stage, "appDelegate_" + topLevelSurfaceList.idAt(0));
481 verify(delegateOther);
386 verify(delegateOther);
482
387
483 performEdgeSwipeToShowAppSpread();
388 performEdgeSwipeToShowAppSpread();
484− phoneStage.select("unity8-dash");
389+ tap(delegateDash, 1, 1);
485
390
486 tryCompare(delegateDash, "focus", true);
391 tryCompare(delegateDash, "focus", true);
487 tryCompare(delegateDash.application, "requestedState", ApplicationInfoInterface.RequestedRunning);
392 tryCompare(delegateDash.application, "requestedState", ApplicationInfoInterface.RequestedRunning);
@@ -489,39 +394,38 @@ Item {
489 compare(delegateOther.application.requestedState, ApplicationInfoInterface.RequestedSuspended);
394 compare(delegateOther.application.requestedState, ApplicationInfoInterface.RequestedSuspended);
490
395
491 performEdgeSwipeToShowAppSpread();
396 performEdgeSwipeToShowAppSpread();
492− phoneStage.select(delegateOther.application.appId);
397+ tap(delegateOther, 1, 1);
493−
494 // The other app gets focused and running but dash is kept running despite being unfocused
398 // The other app gets focused and running but dash is kept running despite being unfocused
399+ tryCompare(delegateOther, "focus", true);
400+ tryCompare(delegateOther.application, "requestedState", ApplicationInfoInterface.RequestedRunning);
495 tryCompare(delegateDash, "focus", false);
401 tryCompare(delegateDash, "focus", false);
496 tryCompare(delegateDash.application, "requestedState", ApplicationInfoInterface.RequestedRunning);
402 tryCompare(delegateDash.application, "requestedState", ApplicationInfoInterface.RequestedRunning);
497− compare(delegateOther.focus, true);
498− compare(delegateOther.application.requestedState, ApplicationInfoInterface.RequestedRunning);
499 }
403 }
500
404
501 function test_foregroundAppIsSuspendedWhenStageIsSuspended() {
405 function test_foregroundAppIsSuspendedWhenStageIsSuspended() {
502 addApps(1);
406 addApps(1);
503
407
504− var delegate = findChild(phoneStage, "spreadDelegate_" + topLevelSurfaceList.idAt(0));
408+ var delegate = findChild(stage, "appDelegate_" + topLevelSurfaceList.idAt(0));
505 verify(delegate);
409 verify(delegate);
506
410
507 compare(delegate.focus, true);
411 compare(delegate.focus, true);
508 compare(delegate.application.requestedState, ApplicationInfoInterface.RequestedRunning);
412 compare(delegate.application.requestedState, ApplicationInfoInterface.RequestedRunning);
509
413
510− phoneStage.suspended = true;
414+ stage.suspended = true;
511
415
512 tryCompare(delegate.application, "requestedState", ApplicationInfoInterface.RequestedSuspended);
416 tryCompare(delegate.application, "requestedState", ApplicationInfoInterface.RequestedSuspended);
513
417
514− phoneStage.suspended = false;
418+ stage.suspended = false;
515
419
516 tryCompare(delegate.application, "requestedState", ApplicationInfoInterface.RequestedRunning);
420 tryCompare(delegate.application, "requestedState", ApplicationInfoInterface.RequestedRunning);
517 }
421 }
518
422
519 function test_mouseEdgePush() {
423 function test_mouseEdgePush() {
520− var spreadView = findChild(phoneStage, "spreadView")
424+ var spreadView = findChild(stage, "spreadView")
521 addApps(1);
425 addApps(1);
522− mouseMove(phoneStage, phoneStage.width - 1, units.gu(10));
426+ mouseMove(stage, stage.width - 1, units.gu(10));
523 for (var i = 0; i < units.gu(10); i++) {
427 for (var i = 0; i < units.gu(10); i++) {
524− phoneStage.pushRightEdge(1);
428+ stage.pushRightEdge(1);
525 }
429 }
526 tryCompare(spreadView, "phase", 2);
430 tryCompare(spreadView, "phase", 2);
527 }
431 }
@@ -538,19 +442,18 @@ Item {
538
442
539 performEdgeSwipeToShowAppSpread();
443 performEdgeSwipeToShowAppSpread();
540
444
541− var appDelegate = findChild(phoneStage, "spreadDelegate_" + surface1Id);
445+ var appDelegate = findChild(stage, "appDelegate_" + surface1Id);
542− verify(appDelegate);
446+ var dragArea = findChild(appDelegate, "dragArea")
543− tryCompare(appDelegate, "swipeToCloseEnabled", true);
447+ verify(dragArea);
448+ tryCompare(dragArea, "closeable", true);
544
449
545 compare(webbrowserApp.surfaceList.count, 2);
450 compare(webbrowserApp.surfaceList.count, 2);
546− compare(webbrowserApp.state, ApplicationInfoInterface.Running);
547
451
548 swipeSurfaceUpwards(surface1Id);
452 swipeSurfaceUpwards(surface1Id);
549
453
550 // Surface must eventually be gone
454 // Surface must eventually be gone
551 tryCompareFunction(function() { return topLevelSurfaceList.indexForId(surface1Id); }, -1);
455 tryCompareFunction(function() { return topLevelSurfaceList.indexForId(surface1Id); }, -1);
552 tryCompare(webbrowserApp.surfaceList, "count", 1);
456 tryCompare(webbrowserApp.surfaceList, "count", 1);
553− compare(webbrowserApp.state, ApplicationInfoInterface.Running);
554 }
457 }
555
458
556 /*
459 /*
@@ -631,11 +534,10 @@ Item {
631
534
632 performEdgeSwipeToShowAppSpread();
535 performEdgeSwipeToShowAppSpread();
633
536
634− {
635− var appDelegate = findChild(phoneStage, "spreadDelegate_" + webbrowserSurfaceId);
537+ var appDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
636− verify(appDelegate);
538+ var dragArea = findChild(appDelegate, "dragArea");
637− tryCompare(appDelegate, "swipeToCloseEnabled", true);
539+ verify(dragArea);
638− }
540+ tryCompare(dragArea, "closeable", true);
639
541
640 swipeSurfaceUpwards(webbrowserSurfaceId);
542 swipeSurfaceUpwards(webbrowserSurfaceId);
641
543