on xenial help sign in
Tablet tests passing!!!
d496e45Michael Zanetti
qml/Shell.qml+1−1
@@ -601,7 +601,7 @@ StyledItem {
601 delayed: dialogs.hasActiveDialog || notifications.hasNotification ||
601 delayed: dialogs.hasActiveDialog || notifications.hasNotification ||
602 inputMethod.visible ||
602 inputMethod.visible ||
603 (launcher.shown && !launcher.lockedVisible) ||
603 (launcher.shown && !launcher.lockedVisible) ||
604− panel.indicators.shown || stage.dragProgress > 0
604+ panel.indicators.shown || stage.rightEdgeDragProgress > 0
605 usageScenario: shell.usageScenario
605 usageScenario: shell.usageScenario
606 lastInputTimestamp: inputFilter.lastInputTimestamp
606 lastInputTimestamp: inputFilter.lastInputTimestamp
607 launcher: launcher
607 launcher: launcher
qml/Stage/Stage.qml+18−18
@@ -29,29 +29,18 @@ AbstractStage {
29 id: root
29 id: root
30 anchors.fill: parent
30 anchors.fill: parent
31
31
32− // functions to be called from outside
32+ // Congifuration
33− function updateFocusedAppOrientation() { /* TODO */ }
34− function updateFocusedAppOrientationAnimated() { /* TODO */}
35− function pushRightEdge(amount) {
36− edgeBarrier.push(amount);
37− }
38− function closeFocusedDelegate() {
39− if (priv.focusedAppDelegate && !priv.focusedAppDelegate.isDash) {
40− priv.focusedAppDelegate.close();
41− }
42− }
43−
44 property string mode: "staged"
33 property string mode: "staged"
45 property real leftEdgeDragProgress: 0
34 property real leftEdgeDragProgress: 0
46
35
47 // Used by the tutorial code
36 // Used by the tutorial code
48 readonly property bool spreadShown: state == "spread"
37 readonly property bool spreadShown: state == "spread"
49− readonly property real dragProgress: rightEdgeDragArea.progress // How far left the stage has been dragged
38+ readonly property real rightEdgeDragProgress: rightEdgeDragArea.progress // How far left the stage has been dragged
50
39
51 // used by the snap windows (edge maximize) feature
40 // used by the snap windows (edge maximize) feature
52 readonly property alias previewRectangle: fakeRectangle
41 readonly property alias previewRectangle: fakeRectangle
53
42
54− property var mainApp: priv.focusedAppDelegate ? priv.focusedAppDelegate.application : null
43+ readonly property var mainApp: priv.focusedAppDelegate ? priv.focusedAppDelegate.application : null
55
44
56 // application windows never rotate independently
45 // application windows never rotate independently
57 property int mainAppWindowOrientationAngle: shellOrientationAngle
46 property int mainAppWindowOrientationAngle: shellOrientationAngle
@@ -90,6 +79,18 @@ AbstractStage {
90
79
91 signal itemSnapshotRequested(Item item)
80 signal itemSnapshotRequested(Item item)
92
81
82+ // functions to be called from outside
83+ function updateFocusedAppOrientation() { /* TODO */ }
84+ function updateFocusedAppOrientationAnimated() { /* TODO */}
85+ function pushRightEdge(amount) {
86+ edgeBarrier.push(amount);
87+ }
88+ function closeFocusedDelegate() {
89+ if (priv.focusedAppDelegate && !priv.focusedAppDelegate.isDash) {
90+ priv.focusedAppDelegate.close();
91+ }
92+ }
93+
93 GlobalShortcut {
94 GlobalShortcut {
94 id: closeFocusedShortcut
95 id: closeFocusedShortcut
95 shortcut: Qt.AltModifier|Qt.Key_F4
96 shortcut: Qt.AltModifier|Qt.Key_F4
@@ -246,12 +247,12 @@ AbstractStage {
246 choseMainStage = true;
247 choseMainStage = true;
247 }
248 }
248 }
249 }
249− if (!choseMainStage) {
250+ if (!choseMainStage && priv.mainStageDelegate) {
250 priv.mainStageDelegate = null;
251 priv.mainStageDelegate = null;
251 priv.mainStageItemId = 0;
252 priv.mainStageItemId = 0;
252 priv.mainStageAppId = "";
253 priv.mainStageAppId = "";
253 }
254 }
254− if (!choseSideStage) {
255+ if (!choseSideStage && priv.sideStageDelegate) {
255 priv.sideStageDelegate = null;
256 priv.sideStageDelegate = null;
256 priv.sideStageItemId = 0;
257 priv.sideStageItemId = 0;
257 priv.sideStageAppId = "";
258 priv.sideStageAppId = "";
@@ -366,7 +367,6 @@ AbstractStage {
366 when: !appRepeater.startingUp && root.parent
367 when: !appRepeater.startingUp && root.parent
367 }
368 }
368
369
369− onStateChanged: print("***************************************state:", state)
370 states: [
370 states: [
371 State {
371 State {
372 name: "spread"; when: priv.goneToSpread
372 name: "spread"; when: priv.goneToSpread
@@ -707,7 +707,6 @@ AbstractStage {
707 Connections {
707 Connections {
708 target: model.surface
708 target: model.surface
709 onFocusRequested: {
709 onFocusRequested: {
710− print("*********************************** focus requested", appId)
711 // Reset spread selection in case there is any
710 // Reset spread selection in case there is any
712 spreadItem.highlightedIndex = -1
711 spreadItem.highlightedIndex = -1
713 claimFocus();
712 claimFocus();
@@ -1729,6 +1728,7 @@ AbstractStage {
1729
1728
1730 TabletSideStageTouchGesture {
1729 TabletSideStageTouchGesture {
1731 id: triGestureArea
1730 id: triGestureArea
1731+ objectName: "triGestureArea"
1732 anchors.fill: parent
1732 anchors.fill: parent
1733 enabled: false
1733 enabled: false
1734 property Item appDelegate
1734 property Item appDelegate
tests/qmltests/Stage/tst_TabletStage.qml+84−188
@@ -36,7 +36,7 @@ Rectangle {
36 property var greeter: { fullyShown: true }
36 property var greeter: { fullyShown: true }
37
37
38 Stage {
38 Stage {
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
68 }
68 }
69
69
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 }
72
72
73 Column {
73 Column {
@@ -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");
84 }
84 }
85 }
85 }
86
86
@@ -123,8 +123,8 @@ Rectangle {
123 name: "TabletStage"
123 name: "TabletStage"
124 when: windowShown
124 when: windowShown
125
125
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
128
128
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");
134
134
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);
143 }
143 }
144 }
144 }
145
145
146 waitUntilAppSurfaceShowsUp(topSurfaceList.idAt(0));
146 waitUntilAppSurfaceShowsUp(topSurfaceList.idAt(0));
147 sideStage.hideNow()
147 sideStage.hideNow()
148+ tryCompare(sideStage, "x", stage.width)
148 }
149 }
149
150
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);
156+
151 killApps();
157 killApps();
158+
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);
163+
164+ sideStage.hideNow();
165+ tryCompare(sideStage, "x", stage.width)
166+ waitForRendering(stage)
167+
152 WindowStateStorage.clear();
168 WindowStateStorage.clear();
169+ wait(100)
153 }
170 }
154
171
155 function waitUntilAppSurfaceShowsUp(surfaceId) {
172 function waitUntilAppSurfaceShowsUp(surfaceId) {
@@ -161,7 +178,7 @@ Rectangle {
161 }
178 }
162
179
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;
167 }
184 }
@@ -180,7 +197,7 @@ Rectangle {
180
197
181 function waitUntilAppDelegateStopsMoving(targetSurfaceId)
198 function waitUntilAppDelegateStopsMoving(targetSurfaceId)
182 {
199 {
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;
186 do {
203 do {
@@ -190,15 +207,9 @@ Rectangle {
190 }
207 }
191
208
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);
196
211
197− var spreadView = findChild(tabletStage, "spreadView");
212+ tryCompare(stage, "state", "spread");
198− verify(spreadView);
199− tryCompare(spreadView, "phase", 2);
200− tryCompare(spreadView, "flicking", false);
201− tryCompare(spreadView, "moving", false);
202 }
213 }
203
214
204 function swipeSurfaceUpwards(surfaceId) {
215 function swipeSurfaceUpwards(surfaceId) {
@@ -214,17 +225,12 @@ Rectangle {
214
225
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);
218
229
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;
221
232
222− multiTouchDragUntil([0,1,2],
233+ multiTouchDragUntil([0,1,2], stage, pos, stage.height / 2, units.gu(3), 0,
223− tabletStage,
224− pos,
225− tabletStage.height / 2,
226− units.gu(3),
227− 0,
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 {
235
241
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);
240
246
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;
243
249
244 multiTouchDragUntil([0,1,2],
250 multiTouchDragUntil([0,1,2],
245− tabletStage,
251+ stage,
246 pos,
252 pos,
247− tabletStage.height / 2,
253+ stage.height / 2,
248 -units.gu(3),
254 -units.gu(3),
249 0,
255 0,
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);
274
280
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);
279
285
@@ -306,17 +312,18 @@ Rectangle {
306
312
307 performEdgeSwipeToShowAppSpread();
313 performEdgeSwipeToShowAppSpread();
308
314
309− var appDelegate = findChild(tabletStage, "appDelegate_" + dialerSurfaceId);
315+ var appDelegate = findChild(stage, "appDelegate_" + dialerSurfaceId);
310− verify(appDelegate);
316+ var dragArea = findChild(appDelegate, "dragArea");
317+ verify(dragArea);
311 compare(appDelegate.stage, ApplicationInfoInterface.SideStage);
318 compare(appDelegate.stage, ApplicationInfoInterface.SideStage);
312− tryCompare(appDelegate, "swipeToCloseEnabled", true);
319+ tryCompare(dragArea, "closeable", true);
313
320
314 swipeSurfaceUpwards(dialerSurfaceId);
321 swipeSurfaceUpwards(dialerSurfaceId);
315
322
316 // Check that dialer-app has been closed
323 // Check that dialer-app has been closed
317
324
318 tryCompareFunction(function() {
325 tryCompareFunction(function() {
319− return findChild(tabletStage, "appWindow_" + dialerCheckBox.appId);
326+ return findChild(stage, "appWindow_" + dialerCheckBox.appId);
320 }, null);
327 }, null);
321
328
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);
334
341
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);
343
350
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)
361
368
362− var stagesPriv = findInvisibleChild(tabletStage, "DesktopStagePrivate");
369+ var stagesPriv = findInvisibleChild(stage, "DesktopStagePrivate");
363 verify(stagesPriv);
370 verify(stagesPriv);
364
371
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);
382
389
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);
394
401
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);
401
408
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);
436
443
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);
443
450
444
451
445 compare(webbrowserApp.requestedState, ApplicationInfoInterface.RequestedRunning);
452 compare(webbrowserApp.requestedState, ApplicationInfoInterface.RequestedRunning);
446 compare(dialerApp.requestedState, ApplicationInfoInterface.RequestedRunning);
453 compare(dialerApp.requestedState, ApplicationInfoInterface.RequestedRunning);
447
454
448− tabletStage.suspended = true;
455+ stage.suspended = true;
449
456
450 tryCompare(webbrowserApp, "requestedState", ApplicationInfoInterface.RequestedSuspended);
457 tryCompare(webbrowserApp, "requestedState", ApplicationInfoInterface.RequestedSuspended);
451 tryCompare(dialerApp, "requestedState", ApplicationInfoInterface.RequestedSuspended);
458 tryCompare(dialerApp, "requestedState", ApplicationInfoInterface.RequestedSuspended);
452
459
453− tabletStage.suspended = false;
460+ stage.suspended = false;
454
461
455 tryCompare(webbrowserApp, "requestedState", ApplicationInfoInterface.RequestedRunning);
462 tryCompare(webbrowserApp, "requestedState", ApplicationInfoInterface.RequestedRunning);
456 tryCompare(dialerApp, "requestedState", ApplicationInfoInterface.RequestedRunning);
463 tryCompare(dialerApp, "requestedState", ApplicationInfoInterface.RequestedRunning);
457 }
464 }
458
465
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);
464− }
465− tryCompare(spreadView, "phase", 2);
466− }
467−
468 function test_threeFingerTapOpensSideStage_data() {
466 function test_threeFingerTapOpensSideStage_data() {
469 return [
467 return [
470 { tag: "1 finger", touchIds: [0], result: false },
468 { tag: "1 finger", touchIds: [0], result: false },
@@ -475,7 +473,7 @@ Rectangle {
475 }
473 }
476
474
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);
481 }
479 }
@@ -493,18 +491,13 @@ Rectangle {
493 function test_threeFingerTapClosesSideStage(data) {
491 function test_threeFingerTapClosesSideStage(data) {
494 sideStage.showNow();
492 sideStage.showNow();
495
493
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);
499 }
497 }
500
498
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,
503− tabletStage,
504− tabletStage.width / 4,
505− tabletStage.height / 4,
506− units.gu(1),
507− 0,
508 function() { return sideStage.shown; });
501 function() { return sideStage.shown; });
509 }
502 }
510
503
@@ -516,7 +509,7 @@ Rectangle {
516 }
509 }
517
510
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);
521
514
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)
542
535
543− var stagesPriv = findInvisibleChild(tabletStage, "DesktopStagePrivate");
536+ var stagesPriv = findInvisibleChild(stage, "DesktopStagePrivate");
544 verify(stagesPriv);
537 verify(stagesPriv);
545
538
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();
567
560
568− var stagesPriv = findInvisibleChild(tabletStage, "DesktopStagePrivate");
561+ var stagesPriv = findInvisibleChild(stage, "DesktopStagePrivate");
569 verify(stagesPriv);
562 verify(stagesPriv);
570
563
571 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
564 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
@@ -588,17 +581,21 @@ Rectangle {
588
581
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);
594
588
589+ print("browser should be focused now")
590+ return;
591+ wait(10000)
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);
598
595
599 dragToSideStage(webbrowserSurfaceId);
596 dragToSideStage(webbrowserSurfaceId);
600
597
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);
604 }
601 }
@@ -610,45 +607,15 @@ Rectangle {
610 webbrowserCheckBox.checked = true;
607 webbrowserCheckBox.checked = true;
611 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
608 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
612
609
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);
616
613
617 dragToMainStage(webbrowserSurfaceId);
614 dragToMainStage(webbrowserSurfaceId);
618
615
619− var spreadView = findChild(tabletStageLoader, "spreadView")
620− tryCompare(spreadView, "surfaceDragging", false);
621 tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
616 tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
622 }
617 }
623
618
624− function test_closeSurfaceOfMultiSurfaceApp() {
625− var surface1Id = topSurfaceList.nextId;
626− webbrowserCheckBox.checked = true;
627− waitUntilAppSurfaceShowsUp(surface1Id);
628− var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
629−
630− var surface2Id = topSurfaceList.nextId;
631− verify(surface1Id !== surface2Id); // sanity checking
632− webbrowserCheckBox.createSurface();
633− waitUntilAppSurfaceShowsUp(surface2Id);
634−
635− performEdgeSwipeToShowAppSpread();
636−
637− var appDelegate = findChild(tabletStage, "appDelegate_" + surface1Id);
638− verify(appDelegate);
639− tryCompare(appDelegate, "swipeToCloseEnabled", true);
640−
641− compare(webbrowserApp.surfaceList.count, 2);
642− compare(webbrowserApp.state, ApplicationInfoInterface.Running);
643−
644− swipeSurfaceUpwards(surface1Id);
645−
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);
650− }
651−
652 /*
619 /*
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);
695 }
662 }
696
663
697− /*
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.
703− */
704− function test_closeZombieSurface()
705− {
706− compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
707− var dashSurfaceId = topSurfaceList.idAt(0);
708− var dashSurface = topSurfaceList.surfaceAt(0);
709−
710− var webbrowserSurfaceId = topSurfaceList.nextId;
711− webbrowserCheckBox.checked = true;
712− waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
713− var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
714−
715− switchToSurface(dashSurfaceId);
716−
717− tryCompare(MirFocusController, "focusedSurface", dashSurface);
718− tryCompare(webbrowserApp, "state", ApplicationInfoInterface.Suspended);
719−
720− compare(webbrowserApp.surfaceList.count, 1);
721−
722− // simulate the suspended app being killed by the out-of-memory daemon
723− webbrowserApp.surfaceList.get(0).setLive(false);
724−
725− // wait until the surface is gone
726− tryCompare(webbrowserApp.surfaceList, "count", 0);
727− compare(topSurfaceList.surfaceAt(topSurfaceList.indexForId(webbrowserSurfaceId)), null);
728−
729− performEdgeSwipeToShowAppSpread();
730−
731− {
732− var appDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
733− verify(appDelegate);
734− tryCompare(appDelegate, "swipeToCloseEnabled", true);
735− }
736−
737− swipeSurfaceUpwards(webbrowserSurfaceId);
738−
739− // webbrowser entry is nowhere to be seen
740− tryCompareFunction(function(){return topSurfaceList.indexForId(webbrowserSurfaceId);}, -1);
741−
742− // nor is its app
743− compare(ApplicationManager.findApplication(webbrowserCheckBox.appId), null);
744−
745− // only unity8-dash surface is left
746− compare(topSurfaceList.count, 1);
747− }
748−
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);
753
668
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);
757
672
@@ -759,9 +674,8 @@ Rectangle {
759
674
760 dragToSideStage(webbrowserSurfaceId);
675 dragToSideStage(webbrowserSurfaceId);
761
676
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);
765 }
679 }
766
680
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);
771
685
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);
775
689
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;
778
692
779− multiTouchDragUntil([0,1,2],
693+ multiTouchDragUntil([0,1,2], stage, pos, stage.height / 2, units.gu(3), 0,
780− tabletStage,
781− pos,
782− tabletStage.height / 2,
783− units.gu(3),
784− 0,
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;
789 });
698 });
790
699
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);
794 }
702 }
795
703
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);
801
709
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);
805
713
806− tabletStage.shellOrientation = Qt.PortraitOrientation;
807− tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
808− }
809−
810− function test_restoreOriginalStageOnRotation() {
811− var webbrowserSurfaceId = topSurfaceList.nextId;
812− webbrowserCheckBox.checked = true;
813− waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
814−
815− var appDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
816− verify(appDelegate);
817−
818 dragToSideStage(webbrowserSurfaceId);
714 dragToSideStage(webbrowserSurfaceId);
819
715
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);
823
719
824− tabletStage.shellOrientation = Qt.LandscapeOrientation;
720+ stage.shellOrientation = Qt.LandscapeOrientation;
825 tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
721 tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
826 }
722 }
827
723
@@ -830,25 +726,25 @@ Rectangle {
830 webbrowserCheckBox.checked = true;
726 webbrowserCheckBox.checked = true;
831 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
727 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
832
728
833− var appDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
729+ var appDelegate = findChild(stage, "appDelegate_" + webbrowserSurfaceId);
834 verify(appDelegate);
730 verify(appDelegate);
835
731
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);
840
736
841 webbrowserCheckBox.checked = false;
737 webbrowserCheckBox.checked = false;
842 tryCompare(ApplicationManager, "count", 1);
738 tryCompare(ApplicationManager, "count", 1);
843
739
844 // back to landscape
740 // back to landscape
845− tabletStage.shellOrientation = Qt.LandscapeOrientation;
741+ stage.shellOrientation = Qt.LandscapeOrientation;
846
742
847 webbrowserSurfaceId = topSurfaceList.nextId;
743 webbrowserSurfaceId = topSurfaceList.nextId;
848 webbrowserCheckBox.checked = true;
744 webbrowserCheckBox.checked = true;
849 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
745 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
850
746
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);
854 }
750 }