@@ -436,7 +436,7 @@ Rectangle {
436 // Open an application and focus
436 // Open an application and focus
437 waitUntilApplicationWindowIsFullyVisible(app);
437 waitUntilApplicationWindowIsFullyVisible(app);
438 ApplicationManager.focusApplication(app);
438 ApplicationManager.focusApplication(app);
439− tryCompare(app.session.surface, "activeFocus", true);
439+ tryCompare(app.session.lastSurface, "activeFocus", true);
441 notifications.model = mockNotificationsModel;
441 notifications.model = mockNotificationsModel;
@@ -458,7 +458,7 @@ Rectangle {
458 waitForRendering(notification);
458 waitForRendering(notification);
460 // Make sure activeFocus went away from the app window
460 // Make sure activeFocus went away from the app window
461− tryCompare(app.session.surface, "activeFocus", false);
461+ tryCompare(app.session.lastSurface, "activeFocus", false);
462 tryCompare(stage, "interactive", false);
462 tryCompare(stage, "interactive", false);
464 // Clicking the button should dismiss the notification and return focus
464 // Clicking the button should dismiss the notification and return focus
@@ -466,7 +466,7 @@ Rectangle {
466 mouseClick(buttonAccept);
466 mouseClick(buttonAccept);
468 // Make sure we're back to normal
468 // Make sure we're back to normal
469− tryCompare(app.session.surface, "activeFocus", true);
469+ tryCompare(app.session.lastSurface, "activeFocus", true);
470 compare(stage.interactive, true, "Stages not interactive again after modal notification has closed");
470 compare(stage.interactive, true, "Stages not interactive again after modal notification has closed");
@@ -476,8 +476,8 @@ Rectangle {
476 hints: {"x-canonical-private-affirmative-tint": "true"},
476 hints: {"x-canonical-private-affirmative-tint": "true"},
477 summary: "Tom Ato",
477 summary: "Tom Ato",
478 body: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.",
478 body: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.",
479− icon: "../graphics/avatars/funky.png",
479+ icon: "../../tests/graphics/avatars/funky.png",
480− secondaryIcon: "../graphics/applicationIcons/facebook.png",
480+ secondaryIcon: "../../tests/graphics/applicationIcons/facebook.png",
481 actions: [{ id: "ok_id", label: "Ok"},
481 actions: [{ id: "ok_id", label: "Ok"},
482 { id: "cancel_id", label: "Cancel"},
482 { id: "cancel_id", label: "Cancel"},
483 { id: "notreally_id", label: "Not really"},
483 { id: "notreally_id", label: "Not really"},
@@ -798,7 +798,7 @@ Rectangle {
798 var app = ApplicationManager.startApplication("dialer-app");
798 var app = ApplicationManager.startApplication("dialer-app");
799 waitUntilAppWindowIsFullyLoaded(app);
799 waitUntilAppWindowIsFullyLoaded(app);
801− tryCompare(app.session.surface, "activeFocus", true);
801+ tryCompare(app.session.lastSurface, "activeFocus", true);
803 // Drag the indicators panel half-open
803 // Drag the indicators panel half-open
804 var touchX = shell.width / 2;
804 var touchX = shell.width / 2;
@@ -809,7 +809,7 @@ Rectangle {
809 true /* beginTouch */, false /* endTouch */);
809 true /* beginTouch */, false /* endTouch */);
810 verify(indicators.partiallyOpened);
810 verify(indicators.partiallyOpened);
812− tryCompare(app.session.surface, "activeFocus", false);
812+ tryCompare(app.session.lastSurface, "activeFocus", false);
814 // And finish getting it open
814 // And finish getting it open
815 touchFlick(indicators,
815 touchFlick(indicators,
@@ -818,11 +818,11 @@ Rectangle {
818 false /* beginTouch */, true /* endTouch */);
818 false /* beginTouch */, true /* endTouch */);
819 tryCompare(indicators, "fullyOpened", true);
819 tryCompare(indicators, "fullyOpened", true);
821− tryCompare(app.session.surface, "activeFocus", false);
821+ tryCompare(app.session.lastSurface, "activeFocus", false);
823 dragToCloseIndicatorsPanel();
823 dragToCloseIndicatorsPanel();
825− tryCompare(app.session.surface, "activeFocus", true);
825+ tryCompare(app.session.lastSurface, "activeFocus", true);
828 function test_launchedAppHasActiveFocus_data() {
828 function test_launchedAppHasActiveFocus_data() {
@@ -843,9 +843,9 @@ Rectangle {
843 verify(webApp);
843 verify(webApp);
844 waitUntilAppSurfaceShowsUp("webbrowser-app")
844 waitUntilAppSurfaceShowsUp("webbrowser-app")
846− verify(webApp.session.surface);
846+ verify(webApp.session.lastSurface);
848− tryCompare(webApp.session.surface, "activeFocus", true);
848+ tryCompare(webApp.session.lastSurface, "activeFocus", true);
851 function test_launchedAppKeepsActiveFocusOnUsageModeChange() {
851 function test_launchedAppKeepsActiveFocusOnUsageModeChange() {
@@ -856,9 +856,9 @@ Rectangle {
856 verify(webApp);
856 verify(webApp);
857 waitUntilAppSurfaceShowsUp("webbrowser-app")
857 waitUntilAppSurfaceShowsUp("webbrowser-app")
859− verify(webApp.session.surface);
859+ verify(webApp.session.lastSurface);
861− tryCompare(webApp.session.surface, "activeFocus", true);
861+ tryCompare(webApp.session.lastSurface, "activeFocus", true);
863 shell.usageScenario = "desktop";
863 shell.usageScenario = "desktop";
@@ -868,7 +868,7 @@ Rectangle {
868 verify(desktopWindow);
868 verify(desktopWindow);
871− tryCompare(webApp.session.surface, "activeFocus", true);
871+ tryCompare(webApp.session.lastSurface, "activeFocus", true);
873 shell.usageScenario = "tablet";
873 shell.usageScenario = "tablet";
@@ -878,7 +878,7 @@ Rectangle {
878 verify(desktopWindow);
878 verify(desktopWindow);
881− tryCompare(webApp.session.surface, "activeFocus", true);
881+ tryCompare(webApp.session.lastSurface, "activeFocus", true);
884 function waitUntilAppSurfaceShowsUp(appId) {
884 function waitUntilAppSurfaceShowsUp(appId) {
@@ -999,7 +999,7 @@ Rectangle {
1000 var app = ApplicationManager.startApplication("dialer-app");
1000 var app = ApplicationManager.startApplication("dialer-app");
1001 // wait until the app is fully loaded (ie, real surface replaces splash screen)
1001 // wait until the app is fully loaded (ie, real surface replaces splash screen)
1002− tryCompareFunction(function() { return app.session !== null && app.session.surface !== null }, true);
1002+ tryCompareFunction(function() { return app.session !== null && app.session.lastSurface !== null }, true);
1004 // Minimize the application we just launched
1004 // Minimize the application we just launched
1005 swipeFromLeftEdge(shell.width * 0.75);
1005 swipeFromLeftEdge(shell.width * 0.75);
@@ -1436,9 +1436,9 @@ Rectangle {
1436 waitUntilAppWindowIsFullyLoaded(app3);
1436 waitUntilAppWindowIsFullyLoaded(app3);
1438 // Do a quick alt-tab and see if focus changes
1438 // Do a quick alt-tab and see if focus changes
1439− tryCompare(app3.session.surface, "activeFocus", true)
1439+ tryCompare(app3.session.lastSurface, "activeFocus", true)
1440 keyClick(Qt.Key_Tab, Qt.AltModifier)
1440 keyClick(Qt.Key_Tab, Qt.AltModifier)
1441− tryCompare(app2.session.surface, "activeFocus", true)
1441+ tryCompare(app2.session.lastSurface, "activeFocus", true)
1443 var desktopSpread = findChild(shell, "spread")
1443 var desktopSpread = findChild(shell, "spread")
@@ -1454,7 +1454,7 @@ Rectangle {
1454 tryCompare(desktopSpread, "state", "")
1454 tryCompare(desktopSpread, "state", "")
1456 // Focus should have switched back now
1456 // Focus should have switched back now
1457− tryCompare(app3.session.surface, "activeFocus", true)
1457+ tryCompare(app3.session.lastSurface, "activeFocus", true)
1460 function test_altTabWrapAround() {
1460 function test_altTabWrapAround() {
@@ -1503,7 +1503,7 @@ Rectangle {
1503 tryCompare(desktopSpread, "state", "")
1503 tryCompare(desktopSpread, "state", "")
1505 // Make sure that after wrapping around once, we have the same one focused as at the beginning
1505 // Make sure that after wrapping around once, we have the same one focused as at the beginning
1506− tryCompare(focused.session.surface, "activeFocus", true)
1506+ tryCompare(focused.session.lastSurface, "activeFocus", true)
1509 function test_altBackTabNavigation() {
1509 function test_altBackTabNavigation() {
@@ -1762,6 +1762,7 @@ Rectangle {
1763 if (!data.launcherLocked) {
1763 if (!data.launcherLocked) {
1764 revealLauncherByEdgePushWithMouse();
1764 revealLauncherByEdgePushWithMouse();
1765+ tryCompare(launcher, "x", 0);
1765 waitForRendering(shell)
1766 waitForRendering(shell)
@@ -1892,21 +1893,28 @@ Rectangle {
1892 loadShell(data.formFactor);
1893 loadShell(data.formFactor);
1893 shell.usageScenario = data.usageScenario;
1894 shell.usageScenario = data.usageScenario;
1896+ // Add two main stage apps, the second in order to suspend the first.
1897+ // LibreOffice has isTouchApp set to false by our mocks.
1895 var app1 = ApplicationManager.startApplication("libreoffice");
1898 var app1 = ApplicationManager.startApplication("libreoffice");
1896 waitUntilAppWindowIsFullyLoaded(app1);
1899 waitUntilAppWindowIsFullyLoaded(app1);
1897− var app2 = ApplicationManager.startApplication("dialer-app");
1900+ var app2 = ApplicationManager.startApplication("gallery-app");
1898 waitUntilAppWindowIsFullyLoaded(app2);
1901 waitUntilAppWindowIsFullyLoaded(app2);
1900− // Make sure app1 is unfocused but still running
1903+ // Sanity checking
1901− compare(app1.session.surface.activeFocus, false);
1904+ compare(app1.stage, ApplicationInfoInterface.MainStage);
1902− compare(app1.isTouchApp, false); // sanity check our mock, which sets this for us
1905+ compare(app2.stage, ApplicationInfoInterface.MainStage);
1906+ verify(!app1.isTouchApp);
1907+ verify(!app1.session.lastSurface.activeFocus);
1909+ // Make sure app1 is exempt with a requested suspend
1910+ verify(app1.exemptFromLifecycle);
1903− compare(app1.requestedState, ApplicationInfoInterface.RequestedRunning);
1911+ compare(app1.requestedState, ApplicationInfoInterface.RequestedSuspended);
1906 function test_lifecyclePolicyExemption_data() {
1914 function test_lifecyclePolicyExemption_data() {
1907 return [
1915 return [
1908− {tag: "phone", formFactor: "phone", usageScenario: "phone", suspendsApps: true},
1916+ {tag: "phone", formFactor: "phone", usageScenario: "phone"},
1909− {tag: "tablet", formFactor: "tablet", usageScenario: "tablet", suspendsApps: true}
1917+ {tag: "tablet", formFactor: "tablet", usageScenario: "tablet"}
@@ -1916,14 +1924,20 @@ Rectangle {
1917 GSettingsController.setLifecycleExemptAppids(["webbrowser-app"]);
1925 GSettingsController.setLifecycleExemptAppids(["webbrowser-app"]);
1927+ // Add two main stage apps, the second in order to suspend the first
1919 var app1 = ApplicationManager.startApplication("webbrowser-app");
1928 var app1 = ApplicationManager.startApplication("webbrowser-app");
1920 waitUntilAppWindowIsFullyLoaded(app1);
1929 waitUntilAppWindowIsFullyLoaded(app1);
1921− var app2 = ApplicationManager.startApplication("dialer-app");
1930+ var app2 = ApplicationManager.startApplication("gallery-app");
1922 waitUntilAppWindowIsFullyLoaded(app2);
1931 waitUntilAppWindowIsFullyLoaded(app2);
1924− // Make sure app1 is unfocused but still running
1933+ // Sanity checking
1925− compare(app1.session.surface.activeFocus, false);
1934+ compare(app1.stage, ApplicationInfoInterface.MainStage);
1935+ compare(app2.stage, ApplicationInfoInterface.MainStage);
1936+ verify(!app1.session.lastSurface.activeFocus);
1938+ // Make sure app1 is exempt with a requested suspend
1939+ verify(app1.exemptFromLifecycle);
1926− compare(app1.requestedState, ApplicationInfoInterface.RequestedRunning);
1940+ compare(app1.requestedState, ApplicationInfoInterface.RequestedSuspended);
1929 function test_switchToStagedForcesLegacyAppClosing_data() {
1943 function test_switchToStagedForcesLegacyAppClosing_data() {