@@ -36,7 +36,7 @@ Rectangle {
36 property var greeter: { fullyShown: true }
36 property var greeter: { fullyShown: true }
39− id: tabletStage
39+ id: stage
40 anchors { fill: parent; rightMargin: units.gu(30) }
40 anchors { fill: parent; rightMargin: units.gu(30) }
41 dragAreaWidth: units.gu(2)
41 dragAreaWidth: units.gu(2)
42 maximizedAppTopMargin: units.gu(3)
42 maximizedAppTopMargin: units.gu(3)
@@ -67,7 +67,7 @@ Rectangle {
67 right: parent.right
67 right: parent.right
70− // don't let mouse clicks in the controls area disturb the TabletStage behind it
70+ // don't let mouse clicks in the controls area disturb the Stage behind it
71 MouseArea { anchors.fill: parent }
71 MouseArea { anchors.fill: parent }
@@ -78,9 +78,9 @@ Rectangle {
78 id: edgeBarrierControls
78 id: edgeBarrierControls
79 text: "Drag here to pull out spread"
79 text: "Drag here to pull out spread"
80 backgroundColor: "blue"
80 backgroundColor: "blue"
81− onDragged: { tabletStage.pushRightEdge(amount); }
81+ onDragged: { stage.pushRightEdge(amount); }
82 Component.onCompleted: {
82 Component.onCompleted: {
83− edgeBarrierControls.target = testCase.findChild(tabletStage, "edgeBarrierController");
83+ edgeBarrierControls.target = testCase.findChild(stage, "edgeBarrierController");
@@ -123,8 +123,8 @@ Rectangle {
123 name: "TabletStage"
123 name: "TabletStage"
124 when: windowShown
124 when: windowShown
126− readonly property alias topSurfaceList: tabletStage.topLevelSurfaceList
126+ readonly property alias topSurfaceList: stage.topLevelSurfaceList
127− property Item sideStage: tabletStage ? findChild(tabletStage, "sideStage") : null
127+ property Item sideStage: stage ? findChild(stage, "sideStage") : null
129 function init() {
129 function init() {
130 stageSaver.clear();
130 stageSaver.clear();
@@ -133,23 +133,40 @@ Rectangle {
133 compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
133 compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
135 // this is very strange, but sometimes the test starts without
135 // this is very strange, but sometimes the test starts without
136− // TabletStage components having finished loading themselves
136+ // Stage components having finished loading themselves
137 var appWindow = null
137 var appWindow = null
138 while (!appWindow) {
138 while (!appWindow) {
139 appWindow = findAppWindowForSurfaceId(topSurfaceList.idAt(0));
139 appWindow = findAppWindowForSurfaceId(topSurfaceList.idAt(0));
140 if (!appWindow) {
140 if (!appWindow) {
141− console.log("didn't find unity8-dash appWindow in " + tabletStage + ". Trying again...");
141+ console.log("didn't find unity8-dash appWindow in Stage. Trying again...");
142 wait(50);
142 wait(50);
146 waitUntilAppSurfaceShowsUp(topSurfaceList.idAt(0));
146 waitUntilAppSurfaceShowsUp(topSurfaceList.idAt(0));
147 sideStage.hideNow()
147 sideStage.hideNow()
148+ tryCompare(sideStage, "x", stage.width)
150 function cleanup() {
151 function cleanup() {
152+ ApplicationManager.requestFocusApplication("unity8-dash");
153+ tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
154+ tryCompare(stage, "state", "stagedWithSideStage");
155+ waitForRendering(stage);
151 killApps();
157 killApps();
159+ // wait for Stage to stabilize back into its initial state
160+ var appRepeater = findChild(stage, "appRepeater");
161+ tryCompare(appRepeater, "count", 1);
162+ tryCompare(appRepeater.itemAt(0), "x", 0);
164+ sideStage.hideNow();
165+ tryCompare(sideStage, "x", stage.width)
166+ waitForRendering(stage)
152 WindowStateStorage.clear();
168 WindowStateStorage.clear();
155 function waitUntilAppSurfaceShowsUp(surfaceId) {
172 function waitUntilAppSurfaceShowsUp(surfaceId) {
@@ -161,7 +178,7 @@ Rectangle {
163 function findAppWindowForSurfaceId(surfaceId) {
180 function findAppWindowForSurfaceId(surfaceId) {
164− var spreadDelegate = findChild(tabletStage, "appDelegate_" + surfaceId);
181+ var spreadDelegate = findChild(stage, "appDelegate_" + surfaceId);
165 if (!spreadDelegate) {
182 if (!spreadDelegate) {
166 return null;
183 return null;
@@ -180,7 +197,7 @@ Rectangle {
181 function waitUntilAppDelegateStopsMoving(targetSurfaceId)
198 function waitUntilAppDelegateStopsMoving(targetSurfaceId)
183− var targetAppDelegate = findChild(tabletStage, "appDelegate_" + targetSurfaceId);
200+ var targetAppDelegate = findChild(stage, "appDelegate_" + targetSurfaceId);
184 verify(targetAppDelegate);
201 verify(targetAppDelegate);
185 var lastValue = undefined;
202 var lastValue = undefined;
@@ -190,15 +207,9 @@ Rectangle {
192 function performEdgeSwipeToShowAppSpread() {
209 function performEdgeSwipeToShowAppSpread() {
193− touchFlick(tabletStage,
210+ touchFlick(stage, stage.width - (stage.dragAreaWidth / 2), stage.height / 2, stage.x + 1, stage.height / 2);
194− tabletStage.width - (tabletStage.dragAreaWidth / 2), tabletStage.height / 2,
195− tabletStage.x + 1, tabletStage.height / 2);
197− var spreadView = findChild(tabletStage, "spreadView");
212+ tryCompare(stage, "state", "spread");
199− tryCompare(spreadView, "phase", 2);
200− tryCompare(spreadView, "flicking", false);
201− tryCompare(spreadView, "moving", false);
204 function swipeSurfaceUpwards(surfaceId) {
215 function swipeSurfaceUpwards(surfaceId) {
@@ -214,17 +225,12 @@ Rectangle {
215 function dragToSideStage(surfaceId) {
226 function dragToSideStage(surfaceId) {
216 sideStage.showNow();
227 sideStage.showNow();
217− var targetAppDelegate = findChild(tabletStage, "appDelegate_" + surfaceId);
228+ var targetAppDelegate = findChild(stage, "appDelegate_" + surfaceId);
219− var pos = tabletStage.width - sideStage.width - (tabletStage.width - sideStage.width) / 2;
230+ var pos = stage.width - sideStage.width - (stage.width - sideStage.width) / 2;
220− var end_pos = tabletStage.width - sideStage.width / 2;
231+ var end_pos = stage.width - sideStage.width / 2;
222− multiTouchDragUntil([0,1,2],
233+ multiTouchDragUntil([0,1,2], stage, pos, stage.height / 2, units.gu(3), 0,
225− tabletStage.height / 2,
228 function() {
234 function() {
229 pos += units.gu(3);
235 pos += units.gu(3);
230 return sideStage.shown && !sideStage.showAnimation.running &&
236 return sideStage.shown && !sideStage.showAnimation.running &&
@@ -235,16 +241,16 @@ Rectangle {
236 function dragToMainStage(surfaceId) {
242 function dragToMainStage(surfaceId) {
237 sideStage.showNow();
243 sideStage.showNow();
238− var targetAppDelegate = findChild(tabletStage, "appDelegate_" + surfaceId);
244+ var targetAppDelegate = findChild(stage, "appDelegate_" + surfaceId);
239 verify(targetAppDelegate);
245 verify(targetAppDelegate);
241− var pos = tabletStage.width - sideStage.width / 2;
247+ var pos = stage.width - sideStage.width / 2;
242− var end_pos = tabletStage.width - sideStage.width - (tabletStage.width - sideStage.width) / 2;
248+ var end_pos = stage.width - sideStage.width - (stage.width - sideStage.width) / 2;
244 multiTouchDragUntil([0,1,2],
250 multiTouchDragUntil([0,1,2],
245− tabletStage,
251+ stage,
247− tabletStage.height / 2,
253+ stage.height / 2,
248 -units.gu(3),
254 -units.gu(3),
250 function() {
256 function() {
@@ -260,7 +266,7 @@ Rectangle {
260 var webbrowserSurfaceId = topSurfaceList.nextId;
266 var webbrowserSurfaceId = topSurfaceList.nextId;
261 webbrowserCheckBox.checked = true;
267 webbrowserCheckBox.checked = true;
262 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
268 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
263− var webbrowserDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
269+ var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
264 verify(webbrowserDelegate);
270 verify(webbrowserDelegate);
265 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
271 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
266 var webbrowserWindow = findAppWindowForSurfaceId(webbrowserSurfaceId);
272 var webbrowserWindow = findAppWindowForSurfaceId(webbrowserSurfaceId);
@@ -273,7 +279,7 @@ Rectangle {
273 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
279 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
275 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
281 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
276− var dialerDelegate = findChild(tabletStage, "appDelegate_" + dialerSurfaceId);
282+ var dialerDelegate = findChild(stage, "appDelegate_" + dialerSurfaceId);
277 verify(dialerDelegate);
283 verify(dialerDelegate);
278 compare(dialerDelegate.stage, ApplicationInfoInterface.SideStage);
284 compare(dialerDelegate.stage, ApplicationInfoInterface.SideStage);
@@ -306,17 +312,18 @@ Rectangle {
307 performEdgeSwipeToShowAppSpread();
313 performEdgeSwipeToShowAppSpread();
309− var appDelegate = findChild(tabletStage, "appDelegate_" + dialerSurfaceId);
315+ var appDelegate = findChild(stage, "appDelegate_" + dialerSurfaceId);
310− verify(appDelegate);
316+ var dragArea = findChild(appDelegate, "dragArea");
311 compare(appDelegate.stage, ApplicationInfoInterface.SideStage);
318 compare(appDelegate.stage, ApplicationInfoInterface.SideStage);
312− tryCompare(appDelegate, "swipeToCloseEnabled", true);
319+ tryCompare(dragArea, "closeable", true);
314 swipeSurfaceUpwards(dialerSurfaceId);
321 swipeSurfaceUpwards(dialerSurfaceId);
316 // Check that dialer-app has been closed
323 // Check that dialer-app has been closed
318 tryCompareFunction(function() {
325 tryCompareFunction(function() {
319− return findChild(tabletStage, "appWindow_" + dialerCheckBox.appId);
326+ return findChild(stage, "appWindow_" + dialerCheckBox.appId);
320 }, null);
327 }, null);
322 tryCompareFunction(function() {
329 tryCompareFunction(function() {
@@ -329,7 +336,7 @@ Rectangle {
329 webbrowserCheckBox.checked = true;
336 webbrowserCheckBox.checked = true;
330 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
337 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
331 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
338 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
332− var webbrowserDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
339+ var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
333 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
340 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
335 tryCompare(webbrowserApp, "state", ApplicationInfoInterface.Running);
342 tryCompare(webbrowserApp, "state", ApplicationInfoInterface.Running);
@@ -338,7 +345,7 @@ Rectangle {
338 galleryCheckBox.checked = true;
345 galleryCheckBox.checked = true;
339 waitUntilAppSurfaceShowsUp(gallerySurfaceId);
346 waitUntilAppSurfaceShowsUp(gallerySurfaceId);
340 var galleryApp = ApplicationManager.findApplication(galleryCheckBox.appId);
347 var galleryApp = ApplicationManager.findApplication(galleryCheckBox.appId);
341− var galleryDelegate = findChild(tabletStage, "appDelegate_" + gallerySurfaceId);
348+ var galleryDelegate = findChild(stage, "appDelegate_" + gallerySurfaceId);
342 compare(galleryDelegate.stage, ApplicationInfoInterface.MainStage);
349 compare(galleryDelegate.stage, ApplicationInfoInterface.MainStage);
344 tryCompare(galleryApp, "state", ApplicationInfoInterface.Running);
351 tryCompare(galleryApp, "state", ApplicationInfoInterface.Running);
@@ -359,7 +366,7 @@ Rectangle {
359 WindowStateStorage.saveStage(facebookCheckBox.appId, ApplicationInfoInterface.SideStage)
366 WindowStateStorage.saveStage(facebookCheckBox.appId, ApplicationInfoInterface.SideStage)
360 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
367 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
362− var stagesPriv = findInvisibleChild(tabletStage, "DesktopStagePrivate");
369+ var stagesPriv = findInvisibleChild(stage, "DesktopStagePrivate");
363 verify(stagesPriv);
370 verify(stagesPriv);
365 // launch two main stage apps
372 // launch two main stage apps
@@ -368,7 +375,7 @@ Rectangle {
368 var webbrowserSurfaceId = topSurfaceList.nextId;
375 var webbrowserSurfaceId = topSurfaceList.nextId;
369 webbrowserCheckBox.checked = true;
376 webbrowserCheckBox.checked = true;
370 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
377 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
371− var webbrowserDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
378+ var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
372 verify(webbrowserDelegate);
379 verify(webbrowserDelegate);
373 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
380 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
374 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
381 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
@@ -377,7 +384,7 @@ Rectangle {
377 galleryCheckBox.checked = true;
384 galleryCheckBox.checked = true;
378 waitUntilAppSurfaceShowsUp(gallerySurfaceId);
385 waitUntilAppSurfaceShowsUp(gallerySurfaceId);
379 var galleryApp = ApplicationManager.findApplication(galleryCheckBox.appId);
386 var galleryApp = ApplicationManager.findApplication(galleryCheckBox.appId);
380− var galleryDelegate = findChild(tabletStage, "appDelegate_" + gallerySurfaceId);
387+ var galleryDelegate = findChild(stage, "appDelegate_" + gallerySurfaceId);
381 compare(galleryDelegate.stage, ApplicationInfoInterface.MainStage);
388 compare(galleryDelegate.stage, ApplicationInfoInterface.MainStage);
383 compare(stagesPriv.mainStageAppId, galleryCheckBox.appId);
390 compare(stagesPriv.mainStageAppId, galleryCheckBox.appId);
@@ -389,14 +396,14 @@ Rectangle {
389 dialerCheckBox.checked = true;
396 dialerCheckBox.checked = true;
390 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
397 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
391 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
398 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
392− var dialerDelegate = findChild(tabletStage, "appDelegate_" + dialerSurfaceId);
399+ var dialerDelegate = findChild(stage, "appDelegate_" + dialerSurfaceId);
393 compare(dialerDelegate.stage, ApplicationInfoInterface.SideStage);
400 compare(dialerDelegate.stage, ApplicationInfoInterface.SideStage);
395 var facebookSurfaceId = topSurfaceList.nextId;
402 var facebookSurfaceId = topSurfaceList.nextId;
396 facebookCheckBox.checked = true;
403 facebookCheckBox.checked = true;
397 waitUntilAppSurfaceShowsUp(facebookSurfaceId);
404 waitUntilAppSurfaceShowsUp(facebookSurfaceId);
398 var facebookApp = ApplicationManager.findApplication(facebookCheckBox.appId);
405 var facebookApp = ApplicationManager.findApplication(facebookCheckBox.appId);
399− var facebookDelegate = findChild(tabletStage, "appDelegate_" + facebookSurfaceId);
406+ var facebookDelegate = findChild(stage, "appDelegate_" + facebookSurfaceId);
400 compare(facebookDelegate.stage, ApplicationInfoInterface.SideStage);
407 compare(facebookDelegate.stage, ApplicationInfoInterface.SideStage);
402 compare(stagesPriv.sideStageAppId, facebookCheckBox.appId);
409 compare(stagesPriv.sideStageAppId, facebookCheckBox.appId);
@@ -431,40 +438,31 @@ Rectangle {
431 webbrowserCheckBox.checked = true;
438 webbrowserCheckBox.checked = true;
432 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
439 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
433 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
440 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
434− var webbrowserDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
441+ var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
435 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
442 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
437 var dialerSurfaceId = topSurfaceList.nextId;
444 var dialerSurfaceId = topSurfaceList.nextId;
438 dialerCheckBox.checked = true;
445 dialerCheckBox.checked = true;
439 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
446 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
440 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
447 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
441− var dialerDelegate = findChild(tabletStage, "appDelegate_" + dialerSurfaceId);
448+ var dialerDelegate = findChild(stage, "appDelegate_" + dialerSurfaceId);
442 compare(dialerDelegate.stage, ApplicationInfoInterface.SideStage);
449 compare(dialerDelegate.stage, ApplicationInfoInterface.SideStage);
445 compare(webbrowserApp.requestedState, ApplicationInfoInterface.RequestedRunning);
452 compare(webbrowserApp.requestedState, ApplicationInfoInterface.RequestedRunning);
446 compare(dialerApp.requestedState, ApplicationInfoInterface.RequestedRunning);
453 compare(dialerApp.requestedState, ApplicationInfoInterface.RequestedRunning);
448− tabletStage.suspended = true;
455+ stage.suspended = true;
450 tryCompare(webbrowserApp, "requestedState", ApplicationInfoInterface.RequestedSuspended);
457 tryCompare(webbrowserApp, "requestedState", ApplicationInfoInterface.RequestedSuspended);
451 tryCompare(dialerApp, "requestedState", ApplicationInfoInterface.RequestedSuspended);
458 tryCompare(dialerApp, "requestedState", ApplicationInfoInterface.RequestedSuspended);
453− tabletStage.suspended = false;
460+ stage.suspended = false;
455 tryCompare(webbrowserApp, "requestedState", ApplicationInfoInterface.RequestedRunning);
462 tryCompare(webbrowserApp, "requestedState", ApplicationInfoInterface.RequestedRunning);
456 tryCompare(dialerApp, "requestedState", ApplicationInfoInterface.RequestedRunning);
463 tryCompare(dialerApp, "requestedState", ApplicationInfoInterface.RequestedRunning);
459− function test_mouseEdgePush() {
460− var spreadView = findChild(tabletStageLoader, "spreadView")
461− mouseMove(tabletStageLoader, tabletStageLoader.width - 1, units.gu(10));
462− for (var i = 0; i < units.gu(10); i++) {
463− tabletStageLoader.item.pushRightEdge(1);
465− tryCompare(spreadView, "phase", 2);
468 function test_threeFingerTapOpensSideStage_data() {
466 function test_threeFingerTapOpensSideStage_data() {
470 { tag: "1 finger", touchIds: [0], result: false },
468 { tag: "1 finger", touchIds: [0], result: false },
@@ -475,7 +473,7 @@ Rectangle {
477 function test_threeFingerTapOpensSideStage(data) {
475 function test_threeFingerTapOpensSideStage(data) {
478− multiTouchTap(data.touchIds, tabletStage, tabletStage.width / 2, tabletStage.height / 2);
476+ multiTouchTap(data.touchIds, stage, stage.width / 2, stage.height / 2);
479 wait(200);
477 wait(200);
480 tryCompare(sideStage, "shown", data.result);
478 tryCompare(sideStage, "shown", data.result);
@@ -493,18 +491,13 @@ Rectangle {
493 function test_threeFingerTapClosesSideStage(data) {
491 function test_threeFingerTapClosesSideStage(data) {
494 sideStage.showNow();
492 sideStage.showNow();
496− multiTouchTap(data.touchIds, tabletStage, tabletStage.width / 2, tabletStage.height / 2);
494+ multiTouchTap(data.touchIds, stage, stage.width / 2, stage.height / 2);
497 wait(200);
495 wait(200);
498 tryCompare(sideStage, "shown", data.result);
496 tryCompare(sideStage, "shown", data.result);
501 function test_threeFingerDragOpensSidestage() {
499 function test_threeFingerDragOpensSidestage() {
502− multiTouchDragUntil([0,1,2],
500+ multiTouchDragUntil([0,1,2], stage, stage.width / 4, stage.height / 4, units.gu(1), 0,
504− tabletStage.width / 4,
505− tabletStage.height / 4,
508 function() { return sideStage.shown; });
501 function() { return sideStage.shown; });
@@ -516,7 +509,7 @@ Rectangle {
518 function test_applicationLoadsInDefaultStage(data) {
511 function test_applicationLoadsInDefaultStage(data) {
519− var stagesPriv = findInvisibleChild(tabletStage, "DesktopStagePrivate");
512+ var stagesPriv = findInvisibleChild(stage, "DesktopStagePrivate");
520 verify(stagesPriv);
513 verify(stagesPriv);
522 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
515 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
@@ -540,7 +533,7 @@ Rectangle {
540 function test_applicationLoadsInSavedStage(data) {
533 function test_applicationLoadsInSavedStage(data) {
541 WindowStateStorage.saveStage(webbrowserCheckBox.appId, data.stage)
534 WindowStateStorage.saveStage(webbrowserCheckBox.appId, data.stage)
543− var stagesPriv = findInvisibleChild(tabletStage, "DesktopStagePrivate");
536+ var stagesPriv = findInvisibleChild(stage, "DesktopStagePrivate");
544 verify(stagesPriv);
537 verify(stagesPriv);
546 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
539 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
@@ -565,7 +558,7 @@ Rectangle {
565 WindowStateStorage.saveStage(webbrowserCheckBox.appId, data.fromStage);
558 WindowStateStorage.saveStage(webbrowserCheckBox.appId, data.fromStage);
566 stageSaver.clear();
559 stageSaver.clear();
568− var stagesPriv = findInvisibleChild(tabletStage, "DesktopStagePrivate");
561+ var stagesPriv = findInvisibleChild(stage, "DesktopStagePrivate");
569 verify(stagesPriv);
562 verify(stagesPriv);
571 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
564 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
@@ -588,17 +581,21 @@ Rectangle {
589 function test_loadSideStageByDraggingFromMainStage() {
582 function test_loadSideStageByDraggingFromMainStage() {
590 sideStage.showNow();
583 sideStage.showNow();
584+ print("sidestage now shown. launching browser")
591 var webbrowserSurfaceId = topSurfaceList.nextId;
585 var webbrowserSurfaceId = topSurfaceList.nextId;
592 webbrowserCheckBox.checked = true;
586 webbrowserCheckBox.checked = true;
593 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
587 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
589+ print("browser should be focused now")
595− var appDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
592+ var appDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
596 verify(appDelegate);
593 verify(appDelegate);
597 compare(appDelegate.stage, ApplicationInfoInterface.MainStage);
594 compare(appDelegate.stage, ApplicationInfoInterface.MainStage);
599 dragToSideStage(webbrowserSurfaceId);
596 dragToSideStage(webbrowserSurfaceId);
601− var spreadView = findChild(tabletStageLoader, "spreadView")
598+ var spreadView = findChild(stageLoader, "spreadView")
602 tryCompare(spreadView, "surfaceDragging", false);
599 tryCompare(spreadView, "surfaceDragging", false);
603 tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
600 tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
@@ -610,45 +607,15 @@ Rectangle {
610 webbrowserCheckBox.checked = true;
607 webbrowserCheckBox.checked = true;
611 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
608 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
613− var appDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
610+ var appDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
614 verify(appDelegate);
611 verify(appDelegate);
615 compare(appDelegate.stage, ApplicationInfoInterface.SideStage);
612 compare(appDelegate.stage, ApplicationInfoInterface.SideStage);
617 dragToMainStage(webbrowserSurfaceId);
614 dragToMainStage(webbrowserSurfaceId);
619− var spreadView = findChild(tabletStageLoader, "spreadView")
620− tryCompare(spreadView, "surfaceDragging", false);
621 tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
616 tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
624− function test_closeSurfaceOfMultiSurfaceApp() {
625− var surface1Id = topSurfaceList.nextId;
626− webbrowserCheckBox.checked = true;
627− waitUntilAppSurfaceShowsUp(surface1Id);
628− var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
630− var surface2Id = topSurfaceList.nextId;
631− verify(surface1Id !== surface2Id); // sanity checking
632− webbrowserCheckBox.createSurface();
633− waitUntilAppSurfaceShowsUp(surface2Id);
635− performEdgeSwipeToShowAppSpread();
637− var appDelegate = findChild(tabletStage, "appDelegate_" + surface1Id);
638− verify(appDelegate);
639− tryCompare(appDelegate, "swipeToCloseEnabled", true);
641− compare(webbrowserApp.surfaceList.count, 2);
642− compare(webbrowserApp.state, ApplicationInfoInterface.Running);
644− swipeSurfaceUpwards(surface1Id);
646− // Surface must eventually be gone
647− tryCompareFunction(function() { return topSurfaceList.indexForId(surface1Id); }, -1);
648− tryCompare(webbrowserApp.surfaceList, "count", 1);
649− compare(webbrowserApp.state, ApplicationInfoInterface.Running);
653 1- Suspended app gets killed behind the scenes, causing its surface to go zombie.
620 1- Suspended app gets killed behind the scenes, causing its surface to go zombie.
654 2- Surface gets screenshotted and removed. Its slot in the topSurfaceList remains,
621 2- Surface gets screenshotted and removed. Its slot in the topSurfaceList remains,
@@ -694,64 +661,12 @@ Rectangle {
694 compare(webbrowserApp.surfaceList.count, 1);
661 compare(webbrowserApp.surfaceList.count, 1);
698− 1 - user suspends an application (ie, focus a surface from a different application)
699− 2 - That suspended application gets killed, causing its surface to go zombie
700− 3 - user goes to spread and closes that zombie surface. Actually, by that time
701− Tablet shell will be displaying a screenshot of it instead, so there's no
702− MirSurface whatsoever backing it up.
704− function test_closeZombieSurface()
706− compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
707− var dashSurfaceId = topSurfaceList.idAt(0);
708− var dashSurface = topSurfaceList.surfaceAt(0);
710− var webbrowserSurfaceId = topSurfaceList.nextId;
711− webbrowserCheckBox.checked = true;
712− waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
713− var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
715− switchToSurface(dashSurfaceId);
717− tryCompare(MirFocusController, "focusedSurface", dashSurface);
718− tryCompare(webbrowserApp, "state", ApplicationInfoInterface.Suspended);
720− compare(webbrowserApp.surfaceList.count, 1);
722− // simulate the suspended app being killed by the out-of-memory daemon
723− webbrowserApp.surfaceList.get(0).setLive(false);
725− // wait until the surface is gone
726− tryCompare(webbrowserApp.surfaceList, "count", 0);
727− compare(topSurfaceList.surfaceAt(topSurfaceList.indexForId(webbrowserSurfaceId)), null);
729− performEdgeSwipeToShowAppSpread();
732− var appDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
733− verify(appDelegate);
734− tryCompare(appDelegate, "swipeToCloseEnabled", true);
737− swipeSurfaceUpwards(webbrowserSurfaceId);
739− // webbrowser entry is nowhere to be seen
740− tryCompareFunction(function(){return topSurfaceList.indexForId(webbrowserSurfaceId);}, -1);
743− compare(ApplicationManager.findApplication(webbrowserCheckBox.appId), null);
745− // only unity8-dash surface is left
746− compare(topSurfaceList.count, 1);
749 function test_draggingSurfaceKeepsSurfaceFocus() {
664 function test_draggingSurfaceKeepsSurfaceFocus() {
750 var webbrowserSurfaceId = topSurfaceList.nextId;
665 var webbrowserSurfaceId = topSurfaceList.nextId;
751 webbrowserCheckBox.checked = true;
666 webbrowserCheckBox.checked = true;
752 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
667 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
754− var appDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
669+ var appDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
755 verify(appDelegate);
670 verify(appDelegate);
756 compare(appDelegate.stage, ApplicationInfoInterface.MainStage);
671 compare(appDelegate.stage, ApplicationInfoInterface.MainStage);
@@ -759,9 +674,8 @@ Rectangle {
760 dragToSideStage(webbrowserSurfaceId);
675 dragToSideStage(webbrowserSurfaceId);
762− var spreadView = findChild(tabletStageLoader, "spreadView")
763− tryCompare(spreadView, "surfaceDragging", false);
764 tryCompare(appDelegate.surface, "activeFocus", true);
677 tryCompare(appDelegate.surface, "activeFocus", true);
678+ tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
767 function test_dashDoesNotDragToSidestage() {
681 function test_dashDoesNotDragToSidestage() {
@@ -769,59 +683,41 @@ Rectangle {
769 compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
683 compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
770 var dashSurfaceId = topSurfaceList.idAt(0);
684 var dashSurfaceId = topSurfaceList.idAt(0);
772− var appDelegate = findChild(tabletStage, "appDelegate_" + dashSurfaceId);
686+ var appDelegate = findChild(stage, "appDelegate_" + dashSurfaceId);
773 verify(appDelegate);
687 verify(appDelegate);
774 compare(appDelegate.stage, ApplicationInfoInterface.MainStage);
688 compare(appDelegate.stage, ApplicationInfoInterface.MainStage);
776− var pos = tabletStage.width - sideStage.width - (tabletStage.width - sideStage.width) / 2;
690+ var pos = stage.width - sideStage.width - (stage.width - sideStage.width) / 2;
777− var end_pos = tabletStage.width - sideStage.width / 2;
691+ var end_pos = stage.width - sideStage.width / 2;
779− multiTouchDragUntil([0,1,2],
693+ multiTouchDragUntil([0,1,2], stage, pos, stage.height / 2, units.gu(3), 0,
782− tabletStage.height / 2,
785 function() {
694 function() {
786 pos += units.gu(3);
695 pos += units.gu(3);
787 return sideStage.shown && !sideStage.showAnimation.running &&
696 return sideStage.shown && !sideStage.showAnimation.running &&
788 pos >= end_pos;
697 pos >= end_pos;
791− var spreadView = findChild(tabletStageLoader, "spreadView")
700+ waitForRendering(stage);
792− tryCompare(spreadView, "surfaceDragging", false);
793 tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
701 tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
796− function test_switchStageOnRotation() {
704+ function test_switchRestoreStageOnRotation() {
797 WindowStateStorage.saveStage(webbrowserCheckBox.appId, ApplicationInfoInterface.SideStage)
705 WindowStateStorage.saveStage(webbrowserCheckBox.appId, ApplicationInfoInterface.SideStage)
798 var webbrowserSurfaceId = topSurfaceList.nextId;
706 var webbrowserSurfaceId = topSurfaceList.nextId;
799 webbrowserCheckBox.checked = true;
707 webbrowserCheckBox.checked = true;
800 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
708 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
802− var appDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
710+ var appDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
803 verify(appDelegate);
711 verify(appDelegate);
804 compare(appDelegate.stage, ApplicationInfoInterface.SideStage);
712 compare(appDelegate.stage, ApplicationInfoInterface.SideStage);
806− tabletStage.shellOrientation = Qt.PortraitOrientation;
807− tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
810− function test_restoreOriginalStageOnRotation() {
811− var webbrowserSurfaceId = topSurfaceList.nextId;
812− webbrowserCheckBox.checked = true;
813− waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
815− var appDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
816− verify(appDelegate);
818 dragToSideStage(webbrowserSurfaceId);
714 dragToSideStage(webbrowserSurfaceId);
820 // will be in sidestage now
716 // will be in sidestage now
821− tabletStage.shellOrientation = Qt.PortraitOrientation;
717+ stage.shellOrientation = Qt.PortraitOrientation;
822 tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
718 tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
824− tabletStage.shellOrientation = Qt.LandscapeOrientation;
720+ stage.shellOrientation = Qt.LandscapeOrientation;
825 tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
721 tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
@@ -830,25 +726,25 @@ Rectangle {
830 webbrowserCheckBox.checked = true;
726 webbrowserCheckBox.checked = true;
831 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
727 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
833− var appDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
729+ var appDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
834 verify(appDelegate);
730 verify(appDelegate);
836 dragToSideStage(webbrowserSurfaceId);
732 dragToSideStage(webbrowserSurfaceId);
837 // will be in sidestage now
733 // will be in sidestage now
838− tabletStage.shellOrientation = Qt.PortraitOrientation;
734+ stage.shellOrientation = Qt.PortraitOrientation;
839 tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
735 tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
841 webbrowserCheckBox.checked = false;
737 webbrowserCheckBox.checked = false;
842 tryCompare(ApplicationManager, "count", 1);
738 tryCompare(ApplicationManager, "count", 1);
844 // back to landscape
740 // back to landscape
845− tabletStage.shellOrientation = Qt.LandscapeOrientation;
741+ stage.shellOrientation = Qt.LandscapeOrientation;
847 webbrowserSurfaceId = topSurfaceList.nextId;
743 webbrowserSurfaceId = topSurfaceList.nextId;
848 webbrowserCheckBox.checked = true;
744 webbrowserCheckBox.checked = true;
849 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
745 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
851− appDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
747+ appDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
852 verify(appDelegate);
748 verify(appDelegate);
853 tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
749 tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);