@@ -35,6 +35,8 @@ Rectangle {
36 property var greeter: { fullyShown: true }
36 property var greeter: { fullyShown: true }
38+ readonly property var topLevelSurfaceList: WorkspaceManager.activeWorkspace.windowModel
38 ApplicationMenuDataLoader {
40 ApplicationMenuDataLoader {
39 id: appMenuData
41 id: appMenuData
@@ -54,12 +56,10 @@ Rectangle {
54 focus: true
56 focus: true
55 mode: "stagedWithSideStage"
57 mode: "stagedWithSideStage"
56 applicationManager: ApplicationManager
58 applicationManager: ApplicationManager
57− topLevelSurfaceList: TopLevelWindowModel {
58− id: topLevelSurfaceList
59+ topLevelSurfaceList: root.topLevelSurfaceList
59− applicationManager: ApplicationManager
60+
60− surfaceManager: SurfaceManager
62 Component.onCompleted: {
61 Component.onCompleted: {
62+ print("starting dash")
63 ApplicationManager.startApplication("unity8-dash");
63 ApplicationManager.startApplication("unity8-dash");
@@ -131,21 +131,21 @@ Rectangle {
131 name: "TabletStage"
131 name: "TabletStage"
132 when: windowShown
132 when: windowShown
134− readonly property alias topSurfaceList: stage.topLevelSurfaceList
134+ readonly property alias topLevelSurfaceList: root.topLevelSurfaceList
135 property Item sideStage: stage ? findChild(stage, "sideStage") : null
135 property Item sideStage: stage ? findChild(stage, "sideStage") : null
137 function init() {
137 function init() {
138 stageSaver.clear();
138 stageSaver.clear();
140 ApplicationManager.startApplication("unity8-dash");
140 ApplicationManager.startApplication("unity8-dash");
141− tryCompare(topSurfaceList, "count", 1);
141+ tryCompare(topLevelSurfaceList, "count", 1);
142− compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
142+ compare(topLevelSurfaceList.applicationAt(0).appId, "unity8-dash");
144 // this is very strange, but sometimes the test starts without
144 // this is very strange, but sometimes the test starts without
145 // Stage components having finished loading themselves
145 // Stage components having finished loading themselves
146 var appWindow = null
146 var appWindow = null
147 while (!appWindow) {
147 while (!appWindow) {
148− appWindow = findAppWindowForSurfaceId(topSurfaceList.idAt(0));
148+ appWindow = findAppWindowForSurfaceId(topLevelSurfaceList.idAt(0));
149 if (!appWindow) {
149 if (!appWindow) {
150 console.log("didn't find unity8-dash appWindow in Stage. Trying again...");
150 console.log("didn't find unity8-dash appWindow in Stage. Trying again...");
151 wait(50);
151 wait(50);
@@ -157,7 +157,7 @@ Rectangle {
157 tryCompare(appRepeater, "count", 1);
157 tryCompare(appRepeater, "count", 1);
158 tryCompare(appRepeater.itemAt(0), "x", 0);
158 tryCompare(appRepeater.itemAt(0), "x", 0);
160− waitUntilAppSurfaceShowsUp(topSurfaceList.idAt(0));
160+ waitUntilAppSurfaceShowsUp(topLevelSurfaceList.idAt(0));
161 sideStage.hideNow()
161 sideStage.hideNow()
162 tryCompare(sideStage, "x", stage.width)
162 tryCompare(sideStage, "x", stage.width)
@@ -272,7 +272,7 @@ Rectangle {
272 function test_tappingSwitchesFocusBetweenStages() {
272 function test_tappingSwitchesFocusBetweenStages() {
273 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
273 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
275− var webbrowserSurfaceId = topSurfaceList.nextId;
275+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
276 webbrowserCheckBox.checked = true;
276 webbrowserCheckBox.checked = true;
277 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
277 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
278 var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
278 var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
@@ -283,7 +283,7 @@ Rectangle {
284 tryCompare(webbrowserWindow.surface, "activeFocus", true);
284 tryCompare(webbrowserWindow.surface, "activeFocus", true);
286− var dialerSurfaceId = topSurfaceList.nextId;
286+ var dialerSurfaceId = topLevelSurfaceList.nextId;
287 dialerCheckBox.checked = true;
287 dialerCheckBox.checked = true;
288 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
288 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
@@ -315,7 +315,7 @@ Rectangle {
315 function test_closeAppInSideStage() {
315 function test_closeAppInSideStage() {
316 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
316 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
318− var dialerSurfaceId = topSurfaceList.nextId;
318+ var dialerSurfaceId = topLevelSurfaceList.nextId;
319 dialerCheckBox.checked = true;
319 dialerCheckBox.checked = true;
320 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
320 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
@@ -341,7 +341,7 @@ Rectangle {
343 function test_suspendsAndResumesAppsInMainStage() {
343 function test_suspendsAndResumesAppsInMainStage() {
344− var webbrowserSurfaceId = topSurfaceList.nextId;
344+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
345 webbrowserCheckBox.checked = true;
345 webbrowserCheckBox.checked = true;
346 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
346 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
347 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
347 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
@@ -350,7 +350,7 @@ Rectangle {
351 tryCompare(webbrowserApp, "state", ApplicationInfoInterface.Running);
351 tryCompare(webbrowserApp, "state", ApplicationInfoInterface.Running);
353− var gallerySurfaceId = topSurfaceList.nextId;
353+ var gallerySurfaceId = topLevelSurfaceList.nextId;
354 galleryCheckBox.checked = true;
354 galleryCheckBox.checked = true;
355 waitUntilAppSurfaceShowsUp(gallerySurfaceId);
355 waitUntilAppSurfaceShowsUp(gallerySurfaceId);
356 var galleryApp = ApplicationManager.findApplication(galleryCheckBox.appId);
356 var galleryApp = ApplicationManager.findApplication(galleryCheckBox.appId);
@@ -381,7 +381,7 @@ Rectangle {
381 // launch two main stage apps
381 // launch two main stage apps
382 // gallery will be on foreground and webbrowser on background
382 // gallery will be on foreground and webbrowser on background
384− var webbrowserSurfaceId = topSurfaceList.nextId;
384+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
385 webbrowserCheckBox.checked = true;
385 webbrowserCheckBox.checked = true;
386 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
386 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
387 var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
387 var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
@@ -389,7 +389,7 @@ Rectangle {
389 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
389 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
390 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
390 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
392− var gallerySurfaceId = topSurfaceList.nextId;
392+ var gallerySurfaceId = topLevelSurfaceList.nextId;
393 galleryCheckBox.checked = true;
393 galleryCheckBox.checked = true;
394 waitUntilAppSurfaceShowsUp(gallerySurfaceId);
394 waitUntilAppSurfaceShowsUp(gallerySurfaceId);
395 var galleryApp = ApplicationManager.findApplication(galleryCheckBox.appId);
395 var galleryApp = ApplicationManager.findApplication(galleryCheckBox.appId);
@@ -401,14 +401,14 @@ Rectangle {
401 // then launch two side stage apps
401 // then launch two side stage apps
402 // facebook will be on foreground and dialer on background
402 // facebook will be on foreground and dialer on background
404− var dialerSurfaceId = topSurfaceList.nextId;
404+ var dialerSurfaceId = topLevelSurfaceList.nextId;
405 dialerCheckBox.checked = true;
405 dialerCheckBox.checked = true;
406 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
406 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
407 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
407 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
408 var dialerDelegate = findChild(stage, "appDelegate_" + dialerSurfaceId);
408 var dialerDelegate = findChild(stage, "appDelegate_" + dialerSurfaceId);
409 compare(dialerDelegate.stage, ApplicationInfoInterface.SideStage);
409 compare(dialerDelegate.stage, ApplicationInfoInterface.SideStage);
411− var facebookSurfaceId = topSurfaceList.nextId;
411+ var facebookSurfaceId = topLevelSurfaceList.nextId;
412 facebookCheckBox.checked = true;
412 facebookCheckBox.checked = true;
413 waitUntilAppSurfaceShowsUp(facebookSurfaceId);
413 waitUntilAppSurfaceShowsUp(facebookSurfaceId);
414 var facebookApp = ApplicationManager.findApplication(facebookCheckBox.appId);
414 var facebookApp = ApplicationManager.findApplication(facebookCheckBox.appId);
@@ -443,14 +443,14 @@ Rectangle {
443 function test_foregroundAppsAreSuspendedWhenStageIsSuspended() {
443 function test_foregroundAppsAreSuspendedWhenStageIsSuspended() {
444 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
444 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
446− var webbrowserSurfaceId = topSurfaceList.nextId;
446+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
447 webbrowserCheckBox.checked = true;
447 webbrowserCheckBox.checked = true;
448 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
448 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
449 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
449 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
450 var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
450 var webbrowserDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
451 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
451 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
453− var dialerSurfaceId = topSurfaceList.nextId;
453+ var dialerSurfaceId = topLevelSurfaceList.nextId;
454 dialerCheckBox.checked = true;
454 dialerCheckBox.checked = true;
455 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
455 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
456 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
456 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
@@ -524,7 +524,7 @@ Rectangle {
524 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
524 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
525 tryCompare(stagesPriv, "sideStageAppId", "");
525 tryCompare(stagesPriv, "sideStageAppId", "");
527− var appSurfaceId = topSurfaceList.nextId;
527+ var appSurfaceId = topLevelSurfaceList.nextId;
528 var app = ApplicationManager.startApplication(data.appId);
528 var app = ApplicationManager.startApplication(data.appId);
529 waitUntilAppSurfaceShowsUp(appSurfaceId);
529 waitUntilAppSurfaceShowsUp(appSurfaceId);
@@ -548,7 +548,7 @@ Rectangle {
548 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
548 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
549 tryCompare(stagesPriv, "sideStageAppId", "");
549 tryCompare(stagesPriv, "sideStageAppId", "");
551− var webbrowserSurfaceId = topSurfaceList.nextId;
551+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
552 webbrowserCheckBox.checked = true;
552 webbrowserCheckBox.checked = true;
553 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
553 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
@@ -573,7 +573,7 @@ Rectangle {
573 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
573 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
574 tryCompare(stagesPriv, "sideStageAppId", "");
574 tryCompare(stagesPriv, "sideStageAppId", "");
576− var webbrowserSurfaceId = topSurfaceList.nextId;
576+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
577 webbrowserCheckBox.checked = true;
577 webbrowserCheckBox.checked = true;
578 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
578 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
@@ -591,7 +591,7 @@ Rectangle {
591 function test_loadSideStageByDraggingFromMainStage() {
591 function test_loadSideStageByDraggingFromMainStage() {
592 sideStage.showNow();
592 sideStage.showNow();
593 print("sidestage now shown. launching browser")
593 print("sidestage now shown. launching browser")
594− var webbrowserSurfaceId = topSurfaceList.nextId;
594+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
595 webbrowserCheckBox.checked = true;
595 webbrowserCheckBox.checked = true;
596 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
596 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
@@ -612,7 +612,7 @@ Rectangle {
612 tryCompareFunction(function() {
612 tryCompareFunction(function() {
613 return WindowStateStorage.getStage(webbrowserCheckBox.appId, ApplicationInfoInterface.MainStage) === ApplicationInfoInterface.SideStage
613 return WindowStateStorage.getStage(webbrowserCheckBox.appId, ApplicationInfoInterface.MainStage) === ApplicationInfoInterface.SideStage
614 }, true);
614 }, true);
615− var webbrowserSurfaceId = topSurfaceList.nextId;
615+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
616 webbrowserCheckBox.checked = true;
616 webbrowserCheckBox.checked = true;
617 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
617 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
@@ -628,7 +628,7 @@ Rectangle {
630 1- Suspended app gets killed behind the scenes, causing its surface to go zombie.
630 1- Suspended app gets killed behind the scenes, causing its surface to go zombie.
631− 2- Surface gets screenshotted and removed. Its slot in the topSurfaceList remains,
631+ 2- Surface gets screenshotted and removed. Its slot in the topLevelSurfaceList remains,
632 though (so ApplicationWindow can display the screenshot in its place).
632 though (so ApplicationWindow can display the screenshot in its place).
633 3- User taps on the screenshot of the long-gone surface.
633 3- User taps on the screenshot of the long-gone surface.
@@ -636,11 +636,11 @@ Rectangle {
636 Application gets relaunched. Its new surface will seamlessly replace the screenshot.
636 Application gets relaunched. Its new surface will seamlessly replace the screenshot.
638 function test_selectSuspendedAppWithoutSurface() {
638 function test_selectSuspendedAppWithoutSurface() {
639− compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
639+ compare(topLevelSurfaceList.applicationAt(0).appId, "unity8-dash");
640− var dashSurfaceId = topSurfaceList.idAt(0);
640+ var dashSurfaceId = topLevelSurfaceList.idAt(0);
641− var dashWindow = topSurfaceList.windowAt(0);
641+ var dashWindow = topLevelSurfaceList.windowAt(0);
643− var webbrowserSurfaceId = topSurfaceList.nextId;
643+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
644 webbrowserCheckBox.checked = true;
644 webbrowserCheckBox.checked = true;
645 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
645 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
646 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
646 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
@@ -657,22 +657,22 @@ Rectangle {
658 // wait until the surface is gone
658 // wait until the surface is gone
659 tryCompare(webbrowserApp.surfaceList, "count", 0);
659 tryCompare(webbrowserApp.surfaceList, "count", 0);
660− compare(topSurfaceList.surfaceAt(topSurfaceList.indexForId(webbrowserSurfaceId)), null);
660+ compare(topLevelSurfaceList.surfaceAt(topLevelSurfaceList.indexForId(webbrowserSurfaceId)), null);
662 switchToSurface(webbrowserSurfaceId);
662 switchToSurface(webbrowserSurfaceId);
664 // webbrowser should have been brought to front
664 // webbrowser should have been brought to front
665− tryCompareFunction(function(){return topSurfaceList.idAt(0);}, webbrowserSurfaceId);
665+ tryCompareFunction(function(){return topLevelSurfaceList.idAt(0);}, webbrowserSurfaceId);
667 // and it should eventually get a new surface and get resumed
667 // and it should eventually get a new surface and get resumed
668− tryCompareFunction(function(){return topSurfaceList.surfaceAt(0) !== null;}, true);
668+ tryCompareFunction(function(){return topLevelSurfaceList.surfaceAt(0) !== null;}, true);
669− compare(topSurfaceList.count, 2); // still two top-level items
669+ compare(topLevelSurfaceList.count, 2); // still two top-level items
670 tryCompare(webbrowserApp, "state", ApplicationInfoInterface.Running);
670 tryCompare(webbrowserApp, "state", ApplicationInfoInterface.Running);
671 compare(webbrowserApp.surfaceList.count, 1);
671 compare(webbrowserApp.surfaceList.count, 1);
674 function test_draggingSurfaceKeepsSurfaceFocus() {
674 function test_draggingSurfaceKeepsSurfaceFocus() {
675− var webbrowserSurfaceId = topSurfaceList.nextId;
675+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
676 webbrowserCheckBox.checked = true;
676 webbrowserCheckBox.checked = true;
677 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
677 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
@@ -690,8 +690,8 @@ Rectangle {
691 function test_dashDoesNotDragToSidestage() {
691 function test_dashDoesNotDragToSidestage() {
692 sideStage.showNow();
692 sideStage.showNow();
693− compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
693+ compare(topLevelSurfaceList.applicationAt(0).appId, "unity8-dash");
694− var dashSurfaceId = topSurfaceList.idAt(0);
694+ var dashSurfaceId = topLevelSurfaceList.idAt(0);
696 var appDelegate = findChild(stage, "appDelegate_" + dashSurfaceId);
696 var appDelegate = findChild(stage, "appDelegate_" + dashSurfaceId);
697 verify(appDelegate);
697 verify(appDelegate);
@@ -713,7 +713,7 @@ Rectangle {
714 function test_switchRestoreStageOnRotation() {
714 function test_switchRestoreStageOnRotation() {
715 WindowStateStorage.saveStage(webbrowserCheckBox.appId, ApplicationInfoInterface.SideStage)
715 WindowStateStorage.saveStage(webbrowserCheckBox.appId, ApplicationInfoInterface.SideStage)
716− var webbrowserSurfaceId = topSurfaceList.nextId;
716+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
717 webbrowserCheckBox.checked = true;
717 webbrowserCheckBox.checked = true;
718 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
718 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
@@ -732,7 +732,7 @@ Rectangle {
734 function test_restoreSavedStageOnCloseReopen() {
734 function test_restoreSavedStageOnCloseReopen() {
735− var webbrowserSurfaceId = topSurfaceList.nextId;
735+ var webbrowserSurfaceId = topLevelSurfaceList.nextId;
736 webbrowserCheckBox.checked = true;
736 webbrowserCheckBox.checked = true;
737 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
737 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
@@ -750,7 +750,7 @@ Rectangle {
750 // back to landscape
750 // back to landscape
751 stage.shellOrientation = Qt.LandscapeOrientation;
751 stage.shellOrientation = Qt.LandscapeOrientation;
753− webbrowserSurfaceId = topSurfaceList.nextId;
753+ webbrowserSurfaceId = topLevelSurfaceList.nextId;
754 webbrowserCheckBox.checked = true;
754 webbrowserCheckBox.checked = true;
755 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
755 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);