on xenial help sign in
enabled tst_TabletStage and fixed some tests
commit903c84b65d348749b815af1f7598d88f1d7fba99 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateWed 14 Sep 2016, 20:51 (10 years ago) parente8fc1d4
3 files changed+56−85
qml/Stage/Stage.qml+2−1 tests/qmltests/CMakeLists.txt+1−1 tests/qmltests/Stage/tst_TabletStage.qml+53−83
qml/Stage/Stage.qml+2−1
@@ -490,6 +490,7 @@ AbstractStage {
490490
491491 SideStage {
492492 id: sideStage
493+ objectName: "sideStage"
493494 shown: false
494495 height: appContainer.height
495496 x: appContainer.width - width
@@ -667,7 +668,7 @@ AbstractStage {
667668 property int stage: ApplicationInfoInterface.MainStage
668669 function saveStage(newStage) {
669670 appDelegate.stage = newStage;
670− WindowStateStorage.saveStage(application.appId, newStage);
671+ WindowStateStorage.saveStage(appId, newStage);
671672 priv.updateMainAndSideStageIndexes()
672673 }
673674
tests/qmltests/CMakeLists.txt+1−1
@@ -91,7 +91,7 @@ add_unity8_qmltest(Stage DesktopStage)
9191add_unity8_qmltest(Stage PhoneStage)
9292add_unity8_qmltest(Stages SpreadDelegate)
9393add_unity8_qmltest(Stage SurfaceContainer)
94−add_unity8_qmltest(Stages TabletStage)
94+add_unity8_qmltest(Stage TabletStage)
9595add_unity8_qmltest(Stage WindowResizeArea)
9696add_unity8_qmltest(Stage Splash)
9797add_unity8_qmltest(Stage DecoratedWindow)
tests/qmltests/Stage/tst_TabletStage.qml+53−83
@@ -24,53 +24,36 @@ import Utils 0.1
2424import WindowManager 0.1
2525
2626import ".."
27−import "../../../qml/Stages"
27+import "../../../qml/Stage"
2828import "../../../qml/Components"
2929
3030Rectangle {
3131 id: root
3232 color: "grey"
33− width: tabletStageLoader.width + controls.width
34− height: tabletStageLoader.height
33+ width: units.gu(160*0.7)
34+ height: units.gu(100*0.7)
3535
3636 property var greeter: { fullyShown: true }
3737
38− TopLevelSurfaceList {
39− id: topSurfaceList
40− applicationsModel: ApplicationManager
41− }
42−
43− Loader {
44− id: tabletStageLoader
45−
46− x: ((root.width - controls.width) - width) / 2
47− y: (root.height - height) / 2
48− width: units.gu(160*0.7)
49− height: units.gu(100*0.7)
50−
38+ Stage {
39+ id: tabletStage
40+ anchors { fill: parent; rightMargin: units.gu(30) }
41+ dragAreaWidth: units.gu(2)
42+ maximizedAppTopMargin: units.gu(3)
43+ interactive: true
44+ shellOrientation: Qt.LandscapeOrientation
45+ nativeWidth: width
46+ nativeHeight: height
47+ orientations: Orientations {
48+ native_: Qt.LandscapeOrientation
49+ primary: Qt.LandscapeOrientation
50+ }
5151 focus: true
52−
53− property bool itemDestroyed: false
54− sourceComponent: Component {
55− TabletStage {
56− anchors.fill: parent
57− Component.onDestruction: {
58− tabletStageLoader.itemDestroyed = true;
59− }
60− dragAreaWidth: units.gu(2)
61− maximizedAppTopMargin: units.gu(3)
62− interactive: true
63− shellOrientation: Qt.LandscapeOrientation
64− nativeWidth: width
65− nativeHeight: height
66− orientations: Orientations {
67− native_: Qt.LandscapeOrientation
68− primary: Qt.LandscapeOrientation
69− }
70− focus: true
71− applicationManager: ApplicationManager
72− topLevelSurfaceList: topSurfaceList
73− }
52+ mode: "stagedWithSideStage"
53+ applicationManager: ApplicationManager
54+ topLevelSurfaceList: TopLevelSurfaceList {
55+ id: topLevelSurfaceList
56+ applicationsModel: ApplicationManager
7457 }
7558 }
7659
@@ -95,9 +78,9 @@ Rectangle {
9578 id: edgeBarrierControls
9679 text: "Drag here to pull out spread"
9780 backgroundColor: "blue"
98− onDragged: { tabletStageLoader.item.pushRightEdge(amount); }
81+ onDragged: { tabletStage.pushRightEdge(amount); }
9982 Component.onCompleted: {
100− edgeBarrierControls.target = testCase.findChild(tabletStageLoader, "edgeBarrierController");
83+ edgeBarrierControls.target = testCase.findChild(tabletStage, "edgeBarrierController");
10184 }
10285 }
10386
@@ -140,13 +123,11 @@ Rectangle {
140123 name: "TabletStage"
141124 when: windowShown
142125
143− property Item tabletStage: tabletStageLoader.status === Loader.Ready ? tabletStageLoader.item : null
126+ readonly property alias topSurfaceList: tabletStage.topLevelSurfaceList
144127 property Item sideStage: tabletStage ? findChild(tabletStage, "sideStage") : null
145128
146129 function init() {
147130 stageSaver.clear();
148− tabletStageLoader.active = true;
149− tryCompare(tabletStageLoader, "status", Loader.Ready);
150131
151132 tryCompare(topSurfaceList, "count", 1);
152133 compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
@@ -167,17 +148,6 @@ Rectangle {
167148 }
168149
169150 function cleanup() {
170− tabletStageLoader.itemDestroyed = false;
171− tabletStageLoader.active = false;
172−
173− tryCompare(tabletStageLoader, "status", Loader.Null);
174− tryCompare(tabletStageLoader, "item", null);
175− // Loader.status might be Loader.Null and Loader.item might be null but the Loader
176− // actually took place. Likely because Loader waits until the next event loop
177− // iteration to do its work. So to ensure the reload, we will wait until the
178− // Shell instance gets destroyed.
179− tryCompare(tabletStageLoader, "itemDestroyed", true);
180−
181151 killApps();
182152 WindowStateStorage.clear();
183153 }
@@ -191,7 +161,7 @@ Rectangle {
191161 }
192162
193163 function findAppWindowForSurfaceId(surfaceId) {
194− var spreadDelegate = findChild(tabletStage, "spreadDelegate_" + surfaceId);
164+ var spreadDelegate = findChild(tabletStage, "appDelegate_" + surfaceId);
195165 if (!spreadDelegate) {
196166 return null;
197167 }
@@ -210,7 +180,7 @@ Rectangle {
210180
211181 function waitUntilAppDelegateStopsMoving(targetSurfaceId)
212182 {
213− var targetAppDelegate = findChild(tabletStage, "spreadDelegate_" + targetSurfaceId);
183+ var targetAppDelegate = findChild(tabletStage, "appDelegate_" + targetSurfaceId);
214184 verify(targetAppDelegate);
215185 var lastValue = undefined;
216186 do {
@@ -244,7 +214,7 @@ Rectangle {
244214
245215 function dragToSideStage(surfaceId) {
246216 sideStage.showNow();
247− var targetAppDelegate = findChild(tabletStage, "spreadDelegate_" + surfaceId);
217+ var targetAppDelegate = findChild(tabletStage, "appDelegate_" + surfaceId);
248218
249219 var pos = tabletStage.width - sideStage.width - (tabletStage.width - sideStage.width) / 2;
250220 var end_pos = tabletStage.width - sideStage.width / 2;
@@ -265,7 +235,7 @@ Rectangle {
265235
266236 function dragToMainStage(surfaceId) {
267237 sideStage.showNow();
268− var targetAppDelegate = findChild(tabletStage, "spreadDelegate_" + surfaceId);
238+ var targetAppDelegate = findChild(tabletStage, "appDelegate_" + surfaceId);
269239 verify(targetAppDelegate);
270240
271241 var pos = tabletStage.width - sideStage.width / 2;
@@ -290,7 +260,7 @@ Rectangle {
290260 var webbrowserSurfaceId = topSurfaceList.nextId;
291261 webbrowserCheckBox.checked = true;
292262 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
293− var webbrowserDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
263+ var webbrowserDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
294264 verify(webbrowserDelegate);
295265 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
296266 var webbrowserWindow = findAppWindowForSurfaceId(webbrowserSurfaceId);
@@ -303,7 +273,7 @@ Rectangle {
303273 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
304274
305275 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
306− var dialerDelegate = findChild(tabletStage, "spreadDelegate_" + dialerSurfaceId);
276+ var dialerDelegate = findChild(tabletStage, "appDelegate_" + dialerSurfaceId);
307277 verify(dialerDelegate);
308278 compare(dialerDelegate.stage, ApplicationInfoInterface.SideStage);
309279
@@ -336,7 +306,7 @@ Rectangle {
336306
337307 performEdgeSwipeToShowAppSpread();
338308
339− var appDelegate = findChild(tabletStage, "spreadDelegate_" + dialerSurfaceId);
309+ var appDelegate = findChild(tabletStage, "appDelegate_" + dialerSurfaceId);
340310 verify(appDelegate);
341311 compare(appDelegate.stage, ApplicationInfoInterface.SideStage);
342312 tryCompare(appDelegate, "swipeToCloseEnabled", true);
@@ -359,7 +329,7 @@ Rectangle {
359329 webbrowserCheckBox.checked = true;
360330 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
361331 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
362− var webbrowserDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
332+ var webbrowserDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
363333 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
364334
365335 tryCompare(webbrowserApp, "state", ApplicationInfoInterface.Running);
@@ -368,7 +338,7 @@ Rectangle {
368338 galleryCheckBox.checked = true;
369339 waitUntilAppSurfaceShowsUp(gallerySurfaceId);
370340 var galleryApp = ApplicationManager.findApplication(galleryCheckBox.appId);
371− var galleryDelegate = findChild(tabletStage, "spreadDelegate_" + gallerySurfaceId);
341+ var galleryDelegate = findChild(tabletStage, "appDelegate_" + gallerySurfaceId);
372342 compare(galleryDelegate.stage, ApplicationInfoInterface.MainStage);
373343
374344 tryCompare(galleryApp, "state", ApplicationInfoInterface.Running);
@@ -389,7 +359,7 @@ Rectangle {
389359 WindowStateStorage.saveStage(facebookCheckBox.appId, ApplicationInfoInterface.SideStage)
390360 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
391361
392− var stagesPriv = findInvisibleChild(tabletStage, "stagesPriv");
362+ var stagesPriv = findInvisibleChild(tabletStage, "DesktopStagePrivate");
393363 verify(stagesPriv);
394364
395365 // launch two main stage apps
@@ -398,7 +368,7 @@ Rectangle {
398368 var webbrowserSurfaceId = topSurfaceList.nextId;
399369 webbrowserCheckBox.checked = true;
400370 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
401− var webbrowserDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
371+ var webbrowserDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
402372 verify(webbrowserDelegate);
403373 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
404374 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
@@ -407,7 +377,7 @@ Rectangle {
407377 galleryCheckBox.checked = true;
408378 waitUntilAppSurfaceShowsUp(gallerySurfaceId);
409379 var galleryApp = ApplicationManager.findApplication(galleryCheckBox.appId);
410− var galleryDelegate = findChild(tabletStage, "spreadDelegate_" + gallerySurfaceId);
380+ var galleryDelegate = findChild(tabletStage, "appDelegate_" + gallerySurfaceId);
411381 compare(galleryDelegate.stage, ApplicationInfoInterface.MainStage);
412382
413383 compare(stagesPriv.mainStageAppId, galleryCheckBox.appId);
@@ -419,14 +389,14 @@ Rectangle {
419389 dialerCheckBox.checked = true;
420390 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
421391 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
422− var dialerDelegate = findChild(tabletStage, "spreadDelegate_" + dialerSurfaceId);
392+ var dialerDelegate = findChild(tabletStage, "appDelegate_" + dialerSurfaceId);
423393 compare(dialerDelegate.stage, ApplicationInfoInterface.SideStage);
424394
425395 var facebookSurfaceId = topSurfaceList.nextId;
426396 facebookCheckBox.checked = true;
427397 waitUntilAppSurfaceShowsUp(facebookSurfaceId);
428398 var facebookApp = ApplicationManager.findApplication(facebookCheckBox.appId);
429− var facebookDelegate = findChild(tabletStage, "spreadDelegate_" + facebookSurfaceId);
399+ var facebookDelegate = findChild(tabletStage, "appDelegate_" + facebookSurfaceId);
430400 compare(facebookDelegate.stage, ApplicationInfoInterface.SideStage);
431401
432402 compare(stagesPriv.sideStageAppId, facebookCheckBox.appId);
@@ -461,14 +431,14 @@ Rectangle {
461431 webbrowserCheckBox.checked = true;
462432 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
463433 var webbrowserApp = ApplicationManager.findApplication(webbrowserCheckBox.appId);
464− var webbrowserDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
434+ var webbrowserDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
465435 compare(webbrowserDelegate.stage, ApplicationInfoInterface.MainStage);
466436
467437 var dialerSurfaceId = topSurfaceList.nextId;
468438 dialerCheckBox.checked = true;
469439 waitUntilAppSurfaceShowsUp(dialerSurfaceId);
470440 var dialerApp = ApplicationManager.findApplication(dialerCheckBox.appId);
471− var dialerDelegate = findChild(tabletStage, "spreadDelegate_" + dialerSurfaceId);
441+ var dialerDelegate = findChild(tabletStage, "appDelegate_" + dialerSurfaceId);
472442 compare(dialerDelegate.stage, ApplicationInfoInterface.SideStage);
473443
474444
@@ -546,7 +516,7 @@ Rectangle {
546516 }
547517
548518 function test_applicationLoadsInDefaultStage(data) {
549− var stagesPriv = findInvisibleChild(tabletStage, "stagesPriv");
519+ var stagesPriv = findInvisibleChild(tabletStage, "DesktopStagePrivate");
550520 verify(stagesPriv);
551521
552522 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
@@ -570,7 +540,7 @@ Rectangle {
570540 function test_applicationLoadsInSavedStage(data) {
571541 WindowStateStorage.saveStage(webbrowserCheckBox.appId, data.stage)
572542
573− var stagesPriv = findInvisibleChild(tabletStage, "stagesPriv");
543+ var stagesPriv = findInvisibleChild(tabletStage, "DesktopStagePrivate");
574544 verify(stagesPriv);
575545
576546 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
@@ -595,7 +565,7 @@ Rectangle {
595565 WindowStateStorage.saveStage(webbrowserCheckBox.appId, data.fromStage);
596566 stageSaver.clear();
597567
598− var stagesPriv = findInvisibleChild(tabletStage, "stagesPriv");
568+ var stagesPriv = findInvisibleChild(tabletStage, "DesktopStagePrivate");
599569 verify(stagesPriv);
600570
601571 tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
@@ -622,7 +592,7 @@ Rectangle {
622592 webbrowserCheckBox.checked = true;
623593 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
624594
625− var appDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
595+ var appDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
626596 verify(appDelegate);
627597 compare(appDelegate.stage, ApplicationInfoInterface.MainStage);
628598
@@ -640,7 +610,7 @@ Rectangle {
640610 webbrowserCheckBox.checked = true;
641611 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
642612
643− var appDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
613+ var appDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
644614 verify(appDelegate);
645615 compare(appDelegate.stage, ApplicationInfoInterface.SideStage);
646616
@@ -664,7 +634,7 @@ Rectangle {
664634
665635 performEdgeSwipeToShowAppSpread();
666636
667− var appDelegate = findChild(tabletStage, "spreadDelegate_" + surface1Id);
637+ var appDelegate = findChild(tabletStage, "appDelegate_" + surface1Id);
668638 verify(appDelegate);
669639 tryCompare(appDelegate, "swipeToCloseEnabled", true);
670640
@@ -759,7 +729,7 @@ Rectangle {
759729 performEdgeSwipeToShowAppSpread();
760730
761731 {
762− var appDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
732+ var appDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
763733 verify(appDelegate);
764734 tryCompare(appDelegate, "swipeToCloseEnabled", true);
765735 }
@@ -781,7 +751,7 @@ Rectangle {
781751 webbrowserCheckBox.checked = true;
782752 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
783753
784− var appDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
754+ var appDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
785755 verify(appDelegate);
786756 compare(appDelegate.stage, ApplicationInfoInterface.MainStage);
787757
@@ -799,7 +769,7 @@ Rectangle {
799769 compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
800770 var dashSurfaceId = topSurfaceList.idAt(0);
801771
802− var appDelegate = findChild(tabletStage, "spreadDelegate_" + dashSurfaceId);
772+ var appDelegate = findChild(tabletStage, "appDelegate_" + dashSurfaceId);
803773 verify(appDelegate);
804774 compare(appDelegate.stage, ApplicationInfoInterface.MainStage);
805775
@@ -829,7 +799,7 @@ Rectangle {
829799 webbrowserCheckBox.checked = true;
830800 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
831801
832− var appDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
802+ var appDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
833803 verify(appDelegate);
834804 compare(appDelegate.stage, ApplicationInfoInterface.SideStage);
835805
@@ -842,7 +812,7 @@ Rectangle {
842812 webbrowserCheckBox.checked = true;
843813 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
844814
845− var appDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
815+ var appDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
846816 verify(appDelegate);
847817
848818 dragToSideStage(webbrowserSurfaceId);
@@ -860,7 +830,7 @@ Rectangle {
860830 webbrowserCheckBox.checked = true;
861831 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
862832
863− var appDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
833+ var appDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
864834 verify(appDelegate);
865835
866836 dragToSideStage(webbrowserSurfaceId);
@@ -878,7 +848,7 @@ Rectangle {
878848 webbrowserCheckBox.checked = true;
879849 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
880850
881− appDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
851+ appDelegate = findChild(tabletStage, "appDelegate_" + webbrowserSurfaceId);
882852 verify(appDelegate);
883853 tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
884854 }