on xenial help sign in
Update more tst_Shell tests
6fb9fecDaniel d'Andrada
tests/qmltests/tst_Shell.qml+18−21
@@ -529,10 +529,10 @@ Rectangle {
529 loadShell("phone");
529 loadShell("phone");
530 swipeAwayGreeter();
530 swipeAwayGreeter();
531 var notifications = findChild(shell, "notificationList");
531 var notifications = findChild(shell, "notificationList");
532+ var appSurfaceId = topLevelSurfaceList.nextId;
532 var app = ApplicationManager.startApplication("camera-app");
533 var app = ApplicationManager.startApplication("camera-app");
534+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
533 var stage = findChild(shell, "stage")
535 var stage = findChild(shell, "stage")
534− // Open an application
535− waitUntilApplicationWindowIsFullyVisible(app);
536
536
537 var appSurface = app.surfaceList.get(0);
537 var appSurface = app.surfaceList.get(0);
538 verify(appSurface);
538 verify(appSurface);
@@ -625,10 +625,9 @@ Rectangle {
625 loadShell("phone");
625 loadShell("phone");
626 swipeAwayGreeter();
626 swipeAwayGreeter();
627 dragLauncherIntoView();
627 dragLauncherIntoView();
628+ var appSurfaceId = topLevelSurfaceList.nextId;
628 tapOnAppIconInLauncher();
629 tapOnAppIconInLauncher();
629− waitUntilApplicationWindowIsFullyVisible();
630+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
630− ApplicationManager.focusApplication(data.focusedApp)
631− waitUntilApplicationWindowIsFullyVisible();
632
631
633 var greeter = findChild(shell, "greeter");
632 var greeter = findChild(shell, "greeter");
634 if (data.greeterShown) {
633 if (data.greeterShown) {
@@ -644,7 +643,6 @@ Rectangle {
644 waitUntilDashIsFocused();
643 waitUntilDashIsFocused();
645 tryCompare(greeter, "shown", false);
644 tryCompare(greeter, "shown", false);
646 } else {
645 } else {
647− waitUntilApplicationWindowIsFullyVisible();
648 compare(greeter.fullyShown, data.greeterShown);
646 compare(greeter.fullyShown, data.greeterShown);
649 }
647 }
650
648
@@ -683,10 +681,11 @@ Rectangle {
683 dragLauncherIntoView();
681 dragLauncherIntoView();
684 dashCommunicatorSpy.clear();
682 dashCommunicatorSpy.clear();
685
683
684+ var appSurfaceId = topLevelSurfaceList.nextId;
686 tapOnAppIconInLauncher();
685 tapOnAppIconInLauncher();
687− waitUntilApplicationWindowIsFullyVisible();
686+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
688
687
689− verify(ApplicationManager.focusedApplicationId !== "unity8-dash")
688+ tryCompareFunction(function() { return ApplicationManager.focusedApplicationId !== "unity8-dash"; }, true);
690
689
691 //Long left swipe
690 //Long left swipe
692 swipeFromLeftEdge(units.gu(30));
691 swipeFromLeftEdge(units.gu(30));
@@ -719,8 +718,9 @@ Rectangle {
719
718
720 // Launch an app from the launcher
719 // Launch an app from the launcher
721 dragLauncherIntoView();
720 dragLauncherIntoView();
721+ var appSurfaceId = topLevelSurfaceList.nextId;
722 tapOnAppIconInLauncher();
722 tapOnAppIconInLauncher();
723− waitUntilApplicationWindowIsFullyVisible();
723+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
724
724
725 var mainAppId = ApplicationManager.focusedApplicationId;
725 var mainAppId = ApplicationManager.focusedApplicationId;
726 verify(mainAppId != "");
726 verify(mainAppId != "");
@@ -845,9 +845,9 @@ Rectangle {
845 dragLauncherIntoView();
845 dragLauncherIntoView();
846
846
847 // Launch an app from the launcher
847 // Launch an app from the launcher
848+ var appSurfaceId = topLevelSurfaceList.nextId;
848 tapOnAppIconInLauncher();
849 tapOnAppIconInLauncher();
849−
850+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
850− waitUntilApplicationWindowIsFullyVisible();
851
851
852 verify(ApplicationManager.focusedApplicationId !== "unity8-dash")
852 verify(ApplicationManager.focusedApplicationId !== "unity8-dash")
853
853
@@ -1040,12 +1040,6 @@ Rectangle {
1040 }
1040 }
1041 }
1041 }
1042
1042
1043− function waitUntilApplicationWindowIsFullyVisible() {
1044− var appDelegate = findChild(shell, "spreadDelegate_" + topLevelSurfaceList.idAt(0));
1045− var surfaceContainer = findChild(appDelegate, "surfaceContainer");
1046− tryCompareFunction(function() { return surfaceContainer.surface !== null; }, true);
1047− }
1048−
1049 function waitUntilDashIsFocused() {
1043 function waitUntilDashIsFocused() {
1050 tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
1044 tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
1051 }
1045 }
@@ -1102,8 +1096,9 @@ Rectangle {
1102 swipeAwayGreeter();
1096 swipeAwayGreeter();
1103 var greeter = findChild(shell, "greeter");
1097 var greeter = findChild(shell, "greeter");
1104
1098
1099+ var appSurfaceId = topLevelSurfaceList.nextId;
1105 var app = ApplicationManager.startApplication("dialer-app");
1100 var app = ApplicationManager.startApplication("dialer-app");
1106− waitUntilApplicationWindowIsFullyVisible(app);
1101+ waitUntilAppWindowIsFullyLoaded(appSurfaceId);
1107
1102
1108 // Minimize the application we just launched
1103 // Minimize the application we just launched
1109 swipeFromLeftEdge(shell.width * 0.75);
1104 swipeFromLeftEdge(shell.width * 0.75);
@@ -1164,11 +1159,13 @@ Rectangle {
1164 swipeAwayGreeter();
1159 swipeAwayGreeter();
1165 var panel = findChild(shell, "panel");
1160 var panel = findChild(shell, "panel");
1166 compare(panel.fullscreenMode, false);
1161 compare(panel.fullscreenMode, false);
1162+ var cameraSurfaceId = topLevelSurfaceList.nextId;
1167 var cameraApp = ApplicationManager.startApplication("camera-app");
1163 var cameraApp = ApplicationManager.startApplication("camera-app");
1168− waitUntilApplicationWindowIsFullyVisible(cameraApp);
1164+ waitUntilAppWindowIsFullyLoaded(cameraSurfaceId);
1169 tryCompare(panel, "fullscreenMode", true);
1165 tryCompare(panel, "fullscreenMode", true);
1166+ var dialerSurfaceId = topLevelSurfaceList.nextId;
1170 var dialerApp = ApplicationManager.startApplication("dialer-app");
1167 var dialerApp = ApplicationManager.startApplication("dialer-app");
1171− waitUntilApplicationWindowIsFullyVisible(dialerApp);
1168+ waitUntilAppWindowIsFullyLoaded(dialerSurfaceId);
1172 tryCompare(panel, "fullscreenMode", false);
1169 tryCompare(panel, "fullscreenMode", false);
1173 ApplicationManager.requestFocusApplication(cameraApp.appId);
1170 ApplicationManager.requestFocusApplication(cameraApp.appId);
1174 tryCompare(panel, "fullscreenMode", true);
1171 tryCompare(panel, "fullscreenMode", true);
@@ -2037,7 +2034,7 @@ Rectangle {
2037 waitForRendering(shell)
2034 waitForRendering(shell)
2038
2035
2039 // Make sure the newly started one is at index 0 again
2036 // Make sure the newly started one is at index 0 again
2040− tryCompare(topLevelSurfaceList.applicationAt(0), "appId", application.appId);
2037+ tryCompareFunction(function () { return topLevelSurfaceList.applicationAt(0).appId; }, application.appId);
2041
2038
2042 appDelegate = appRepeater.itemAt(0);
2039 appDelegate = appRepeater.itemAt(0);
2043 compare(appDelegate.y >= PanelState.panelHeight, true);
2040 compare(appDelegate.y >= PanelState.panelHeight, true);