@@ -1817,5 +1817,62 @@ Rectangle {
1818 compare(app4.requestedState, ApplicationInfoInterface.RequestedRunning);
1818 compare(app4.requestedState, ApplicationInfoInterface.RequestedRunning);
1821+ function test_switchToStagedForcesLegacyAppClosing_data() {
1823+ {tag: "forceClose", replug: false },
1824+ {tag: "replug", replug: true }
1828+ function test_switchToStagedForcesLegacyAppClosing(data) {
1829+ loadShell("desktop")
1830+ shell.usageScenario = "desktop"
1831+ waitForRendering(shell);
1833+ ApplicationManager.startApplication("camera-app")
1835+ shell.usageScenario = "phone"
1836+ waitForRendering(shell);
1838+ // No legacy app running yet... Popup must *not* show.
1839+ var popup = findChild(root, "modeSwitchWarningDialog");
1840+ compare(popup, null);
1842+ shell.usageScenario = "desktop"
1843+ waitForRendering(shell);
1845+ // Now start a legacy app
1846+ ApplicationManager.startApplication("libreoffice")
1848+ shell.usageScenario = "phone"
1849+ waitForRendering(shell);
1851+ // The popup must appear now
1852+ popup = findChild(root, "modeSwitchWarningDialog");
1853+ compare(popup !== null, true);
1856+ shell.usageScenario = "desktop"
1857+ waitForRendering(shell);
1860+ var forceCloseButton = findChild(popup, "forceCloseButton");
1861+ mouseClick(forceCloseButton, forceCloseButton.width / 2, forceCloseButton.height / 2);
1862+ waitForRendering(root);
1865+ // Popup must be gone now
1866+ popup = findChild(root, "modeSwitchWarningDialog");
1867+ compare(popup !== null, true);
1870+ // Libreoffice must still be running
1871+ compare(ApplicationManager.findApplication("libreoffice") !== null, true);
1873+ // Libreoffice must be gone now
1874+ compare(ApplicationManager.findApplication("libreoffice") === null, true);