@@ -53,14 +53,10 @@ Item {
54 focus: true
54 focus: true
56− property bool itemDestroyed: false
57 sourceComponent: Component {
56 sourceComponent: Component {
58 DesktopStage {
57 DesktopStage {
59 color: "darkblue"
58 color: "darkblue"
60 anchors.fill: parent
59 anchors.fill: parent
61− Component.onDestruction: {
62− desktopStageLoader.itemDestroyed = true;
@@ -95,16 +91,10 @@ Item {
95 property Item desktopStage: desktopStageLoader.status === Loader.Ready ? desktopStageLoader.item : null
91 property Item desktopStage: desktopStageLoader.status === Loader.Ready ? desktopStageLoader.item : null
97 function cleanup() {
93 function cleanup() {
98− desktopStageLoader.itemDestroyed = false;
99 desktopStageLoader.active = false;
94 desktopStageLoader.active = false;
101 tryCompare(desktopStageLoader, "status", Loader.Null);
96 tryCompare(desktopStageLoader, "status", Loader.Null);
102 tryCompare(desktopStageLoader, "item", null);
97 tryCompare(desktopStageLoader, "item", null);
103− // Loader.status might be Loader.Null and Loader.item might be null but the Loader
104− // actually took place. Likely because Loader waits until the next event loop
105− // iteration to do its work. So to ensure the reload, we will wait until the
106− // Shell instance gets destroyed.
107− tryCompare(desktopStageLoader, "itemDestroyed", true);
109 killAllRunningApps();
99 killAllRunningApps();
@@ -117,7 +107,7 @@ Item {
117 var appIndex = ApplicationManager.get(0).appId == "unity8-dash" ? 1 : 0
107 var appIndex = ApplicationManager.get(0).appId == "unity8-dash" ? 1 : 0
118 ApplicationManager.stopApplication(ApplicationManager.get(appIndex).appId);
108 ApplicationManager.stopApplication(ApplicationManager.get(appIndex).appId);
120− compare(ApplicationManager.count, 1)
110+ compare(ApplicationManager.count, 1);
123 function waitUntilAppSurfaceShowsUp(appId) {
113 function waitUntilAppSurfaceShowsUp(appId) {
@@ -241,5 +231,30 @@ Item {
241 mouseClick(toAppDecoration);
231 mouseClick(toAppDecoration);
242 tryCompare(ApplicationManager.findApplication(data.apps[data.focusTo]).session.surface, "activeFocus", true);
232 tryCompare(ApplicationManager.findApplication(data.apps[data.focusTo]).session.surface, "activeFocus", true);
235+ function test_maximizeApp() {
236+ var apps = ["unity8-dash", "dialer-app", "camera-app"];
237+ apps.forEach(startApplication);
238+ var appName = "dialer-app";
239+ var appDelegate = findChild(desktopStage, "appDelegate_" + appName);
240+ verify(appDelegate);
241+ ApplicationManager.focusApplication(appName);
242+ keyClick(Qt.Key_Up, Qt.MetaModifier|Qt.ControlModifier); // Ctrl+Super+Up shortcut to maximize
243+ tryCompare(appDelegate, "maximized", true);
244+ tryCompare(appDelegate, "minimized", false);
247+ function test_minimizeApp() {
248+ var apps = ["unity8-dash", "dialer-app", "camera-app"];
249+ apps.forEach(startApplication);
250+ var appName = "dialer-app";
251+ var appDelegate = findChild(desktopStage, "appDelegate_" + appName);
252+ verify(appDelegate);
253+ ApplicationManager.focusApplication(appName);
254+ keyClick(Qt.Key_Down, Qt.MetaModifier|Qt.ControlModifier); // Ctrl+Super+Down shortcut to minimize
255+ tryCompare(appDelegate, "maximized", false);
256+ tryCompare(appDelegate, "minimized", true);
257+ verify(ApplicationManager.focusedApplicationId != ""); // verify we don't lose focus when minimizing an app