@@ -1,136 +0,0 @@
1−/*
2− * Copyright (C) 2015 Canonical, Ltd.
3− *
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.
7− *
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.
12− *
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/>.
15− */
16−
17−import QtQuick 2.3
18−import Ubuntu.Components 1.1
19−import QtTest 1.0
20−import LightDM 0.1 as LightDM
21−import Unity.Application 0.1
22−import Unity.Test 0.1 as UT
23−
24−import "../../qml"
25−
26−Item {
27− id: root
28− width: contentRow.width
29− height: contentRow.height
30−
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;
36− }
37−
38− QtObject {
39− id: applicationArguments
40−
41− function hasGeometry() {
42− return false;
43− }
44−
45− function width() {
46− return 0;
47− }
48−
49− function height() {
50− return 0;
51− }
52− }
53−
54− Row {
55− id: contentRow
56−
57− Loader {
58− id: shellLoader
59− active: false
60−
61− width: units.gu(40)
62− height: units.gu(71)
63−
64− property bool itemDestroyed: false
65− sourceComponent: Component {
66− Shell {
67− property string indicatorProfile: "phone"
68−
69− Component.onDestruction: {
70− shellLoader.itemDestroyed = true;
71− }
72− }
73− }
74− }
75−
76− Rectangle {
77− color: "white"
78− width: units.gu(30)
79− height: shellLoader.height
80−
81− Column {
82− anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
83− spacing: units.gu(1)
84− Button {
85− anchors { left: parent.left; right: parent.right }
86− text: "Show Greeter"
87− onClicked: LightDM.Greeter.showGreeter()
88− }
89− }
90− }
91− }
92−
93− UT.UnityTestCase {
94− id: testCase
95− name: "ShellWithPassphrase"
96− when: windowShown
97−
98− property Item shell: shellLoader.status === Loader.Ready ? shellLoader.item : null
99−
100− function init() {
101− tryCompare(shell, "enabled", true); // will be enabled when greeter is all ready
102− }
103−
104− function cleanup() {
105− tryCompare(shell, "enabled", true); // make sure greeter didn't leave us in disabled state
106−
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);
118−
119− killApps();
120− LightDM.Greeter.authenticate(""); // reset greeter
121−
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);
126− }
127−
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);
132− }
133− compare(ApplicationManager.count, 1);
134− }
135− }
136−}