@@ -0,0 +1,136 @@
2+ * Copyright (C) 2015 Canonical, Ltd.
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
18+import Ubuntu.Components 1.1
20+import LightDM 0.1 as LightDM
21+import Unity.Application 0.1
22+import Unity.Test 0.1 as UT
28+ width: contentRow.width
29+ height: contentRow.height
31+ Component.onCompleted: {
32+ // must set the mock mode before loading the Shell
33+ LightDM.Greeter.mockMode = "single-passphrase";
34+ LightDM.Users.mockMode = "single-passphrase";
35+ shellLoader.active = true;
39+ id: applicationArguments
41+ function hasGeometry() {
64+ property bool itemDestroyed: false
65+ sourceComponent: Component {
67+ property string indicatorProfile: "phone"
69+ Component.onDestruction: {
70+ shellLoader.itemDestroyed = true;
79+ height: shellLoader.height
82+ anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
85+ anchors { left: parent.left; right: parent.right }
87+ onClicked: LightDM.Greeter.showGreeter()
95+ name: "ShellWithPassphrase"
98+ property Item shell: shellLoader.status === Loader.Ready ? shellLoader.item : null
101+ tryCompare(shell, "enabled", true); // will be enabled when greeter is all ready
104+ function cleanup() {
105+ tryCompare(shell, "enabled", true); // make sure greeter didn't leave us in disabled state
107+ shellLoader.itemDestroyed = false;
108+ shellLoader.active = false;
109+ tryCompare(shellLoader, "status", Loader.Null);
110+ tryCompare(shellLoader, "item", null);
111+ // Loader.status might be Loader.Null and Loader.item might be null but the Loader
112+ // item might still be alive. So if we set Loader.active back to true
113+ // again right now we will get the very same Shell instance back. So no reload
114+ // actually took place. Likely because Loader waits until the next event loop
115+ // iteration to do its work. So to ensure the reload, we will wait until the
116+ // Shell instance gets destroyed.
117+ tryCompare(shellLoader, "itemDestroyed", true);
120+ LightDM.Greeter.authenticate(""); // reset greeter
122+ // reload our test subject to get it in a fresh state once again
123+ shellLoader.active = true;
124+ tryCompare(shellLoader, "status", Loader.Ready);
125+ removeTimeConstraintsFromDirectionalDragAreas(shellLoader.item);
128+ function killApps() {
129+ while (ApplicationManager.count > 1) {
130+ var appIndex = ApplicationManager.get(0).appId == "unity8-dash" ? 1 : 0;
131+ ApplicationManager.stopApplication(ApplicationManager.get(appIndex).appId);
133+ compare(ApplicationManager.count, 1);