@@ -92,13 +92,11 @@ Rectangle {
93 anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
93 anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
94 spacing: units.gu(1)
94 spacing: units.gu(1)
95− ApplicationCheckBox {
95+ Repeater {
96− id: webbrowserCheckBox
96+ model: ApplicationManager.availableApplications
97− appId: "webbrowser-app"
97+ ApplicationCheckBox {
99− ApplicationCheckBox {
@@ -125,14 +123,20 @@ Rectangle {
125 // Shell instance gets destroyed.
123 // Shell instance gets destroyed.
126 tryCompare(desktopStageLoader, "itemDestroyed", true);
124 tryCompare(desktopStageLoader, "itemDestroyed", true);
128− // kill all (fake) running apps
126+ killAllRunningApps();
129− webbrowserCheckBox.checked = false;
130− dialerCheckBox.checked = false;
132 desktopStageLoader.active = true;
128 desktopStageLoader.active = true;
133 tryCompare(desktopStageLoader, "status", Loader.Ready);
129 tryCompare(desktopStageLoader, "status", Loader.Ready);
132+ function killAllRunningApps() {
133+ while (ApplicationManager.count > 1) {
134+ var appIndex = ApplicationManager.get(0).appId == "unity8-dash" ? 1 : 0
135+ ApplicationManager.stopApplication(ApplicationManager.get(appIndex).appId);
137+ compare(ApplicationManager.count, 1)
136 function waitUntilAppSurfaceShowsUp(appId) {
140 function waitUntilAppSurfaceShowsUp(appId) {
137 var appWindow = findChild(desktopStage, "appWindow_" + appId);
141 var appWindow = findChild(desktopStage, "appWindow_" + appId);
138 verify(appWindow);
142 verify(appWindow);
@@ -141,7 +145,7 @@ Rectangle {
141 tryCompare(appWindowStates, "state", "surface");
145 tryCompare(appWindowStates, "state", "surface");
144− function rectsOverlap(aLocal, bLocal) {
148+ function rectsIntersect(aLocal, bLocal) {
146 var a = aLocal.mapToItem(null, 0, 0, aLocal.width, aLocal.height);
150 var a = aLocal.mapToItem(null, 0, 0, aLocal.width, aLocal.height);
147 var b = bLocal.mapToItem(null, 0, 0, bLocal.width, bLocal.height);
151 var b = bLocal.mapToItem(null, 0, 0, bLocal.width, bLocal.height);
@@ -153,16 +157,16 @@ Rectangle {
155 function test_tappingOnWindowChangesFocusedApp() {
159 function test_tappingOnWindowChangesFocusedApp() {
156− webbrowserCheckBox.checked = true;
160+ ApplicationManager.startApplication("webbrowser-app");
157− waitUntilAppSurfaceShowsUp(webbrowserCheckBox.appId);
161+ waitUntilAppSurfaceShowsUp("webbrowser-app");
159− var webbrowserWindow = findChild(desktopStage, "appWindow_" + webbrowserCheckBox.appId);
163+ var webbrowserWindow = findChild(desktopStage, "appWindow_webbrowser-app");
160 verify(webbrowserWindow);
164 verify(webbrowserWindow);
161 var dashWindow = findChild(desktopStage, "appWindow_unity8-dash");
165 var dashWindow = findChild(desktopStage, "appWindow_unity8-dash");
162 verify(dashWindow);
166 verify(dashWindow);
164 // some sanity check
168 // some sanity check
165− compare(rectsOverlap(dashWindow, webbrowserWindow), false);
169+ compare(rectsIntersect(dashWindow, webbrowserWindow), false);
167 tap(dashWindow);
171 tap(dashWindow);
168 compare(dashWindow.application.session.surface.activeFocus, true);
172 compare(dashWindow.application.session.surface.activeFocus, true);
@@ -172,10 +176,10 @@ Rectangle {
174 function test_tappingOnWindowTitleChangesFocusedApp() {
178 function test_tappingOnWindowTitleChangesFocusedApp() {
175− webbrowserCheckBox.checked = true;
179+ ApplicationManager.startApplication("webbrowser-app");
176− waitUntilAppSurfaceShowsUp(webbrowserCheckBox.appId);
180+ waitUntilAppSurfaceShowsUp("webbrowser-app");
178− var webbrowserWindow = findChild(desktopStage, "decoratedWindow_" + webbrowserCheckBox.appId);
182+ var webbrowserWindow = findChild(desktopStage, "decoratedWindow_webbrowser-app");
179 verify(webbrowserWindow);
183 verify(webbrowserWindow);
180 var webbrowserWindowTitle = findChild(webbrowserWindow, "windowDecorationTitle");
184 var webbrowserWindowTitle = findChild(webbrowserWindow, "windowDecorationTitle");
181 verify(webbrowserWindowTitle);
185 verify(webbrowserWindowTitle);
@@ -185,7 +189,7 @@ Rectangle {
185 verify(dashWindowTitle);
189 verify(dashWindowTitle);
187 // some sanity check
191 // some sanity check
188− compare(rectsOverlap(dashWindow, webbrowserWindow), false);
192+ compare(rectsIntersect(dashWindow, webbrowserWindow), false);
190 tap(dashWindowTitle);
194 tap(dashWindowTitle);
191 compare(dashWindow.application.session.surface.activeFocus, true);
195 compare(dashWindow.application.session.surface.activeFocus, true);