on xenial help sign in
added some tests
commit852f9bd37cbf30feeaeff3c1e554724354c74ab3 authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 28 Oct 2015, 12:42 (11 years ago) parentb41095b
2 files changed+58
qml/Components/ModeSwitchWarningDialog.qml+1 tests/qmltests/tst_Shell.qml+57
qml/Components/ModeSwitchWarningDialog.qml+1
@@ -6,6 +6,7 @@ import Ubuntu.Components.Popups 1.2
66
77Dialog {
88 id: root
9+ objectName: "modeSwitchWarningDialog"
910
1011 property alias model: appRepeater.model
1112
tests/qmltests/tst_Shell.qml+57
@@ -1817,5 +1817,62 @@ Rectangle {
18171817
18181818 compare(app4.requestedState, ApplicationInfoInterface.RequestedRunning);
18191819 }
1820+
1821+ function test_switchToStagedForcesLegacyAppClosing_data() {
1822+ return [
1823+ {tag: "forceClose", replug: false },
1824+ {tag: "replug", replug: true }
1825+ ];
1826+ }
1827+
1828+ function test_switchToStagedForcesLegacyAppClosing(data) {
1829+ loadShell("desktop")
1830+ shell.usageScenario = "desktop"
1831+ waitForRendering(shell);
1832+
1833+ ApplicationManager.startApplication("camera-app")
1834+
1835+ shell.usageScenario = "phone"
1836+ waitForRendering(shell);
1837+
1838+ // No legacy app running yet... Popup must *not* show.
1839+ var popup = findChild(root, "modeSwitchWarningDialog");
1840+ compare(popup, null);
1841+
1842+ shell.usageScenario = "desktop"
1843+ waitForRendering(shell);
1844+
1845+ // Now start a legacy app
1846+ ApplicationManager.startApplication("libreoffice")
1847+
1848+ shell.usageScenario = "phone"
1849+ waitForRendering(shell);
1850+
1851+ // The popup must appear now
1852+ popup = findChild(root, "modeSwitchWarningDialog");
1853+ compare(popup !== null, true);
1854+
1855+ if (data.replug) {
1856+ shell.usageScenario = "desktop"
1857+ waitForRendering(shell);
1858+
1859+ } else {
1860+ var forceCloseButton = findChild(popup, "forceCloseButton");
1861+ mouseClick(forceCloseButton, forceCloseButton.width / 2, forceCloseButton.height / 2);
1862+ waitForRendering(root);
1863+ }
1864+
1865+ // Popup must be gone now
1866+ popup = findChild(root, "modeSwitchWarningDialog");
1867+ compare(popup !== null, true);
1868+
1869+ if (data.replug) {
1870+ // Libreoffice must still be running
1871+ compare(ApplicationManager.findApplication("libreoffice") !== null, true);
1872+ } else {
1873+ // Libreoffice must be gone now
1874+ compare(ApplicationManager.findApplication("libreoffice") === null, true);
1875+ }
1876+ }
18201877 }
18211878}