@@ -93,10 +93,27 @@ Item {
9393
9494 verify(ok);
9595
96− swipeAwayGreeter();
97−
9896 sessionSpy.target = findChild(shell, "greeter")
99− sessionSpy.clear()
97+ }
98+
99+ function init() {
100+ swipeAwayGreeter()
101+ }
102+
103+ function cleanup() {
104+ LightDM.Greeter.showGreeter()
105+ var greeter = findChild(shell, "greeter")
106+ tryCompare(greeter, "showProgress", 1)
107+
108+ // kill all (fake) running apps
109+ killApps()
110+ }
111+
112+ function killApps() {
113+ while (ApplicationManager.count > 0) {
114+ ApplicationManager.stopApplication(ApplicationManager.get(0).appId)
115+ }
116+ compare(ApplicationManager.count, 0)
100117 }
101118
102119 function swipeAwayGreeter() {
@@ -126,45 +143,59 @@ Item {
126143 }
127144 }
128145
129− function dragLauncherIntoView() {
130− var launcherPanel = findChild(shell, "launcherPanel");
131− verify(launcherPanel.x = - launcherPanel.width);
132−
133− var touchStartX = 2;
134− var touchStartY = shell.height / 2;
135− touchFlick(shell, touchStartX, touchStartY, launcherPanel.width + units.gu(1), touchStartY);
136−
137− tryCompare(launcherPanel, "x", 0);
146+ function test_login() {
147+ tryCompare(sessionSpy, "count", 0)
148+ enterPin("1234")
149+ tryCompare(sessionSpy, "count", 1)
138150 }
139151
140− function tapOnAppIconInLauncher() {
141− var launcherPanel = findChild(shell, "launcherPanel");
152+ function test_emergencyCall() {
153+ var greeter = findChild(shell, "greeter")
154+ var lockscreen = findChild(shell, "lockscreen")
155+ var emergencyButton = findChild(lockscreen, "emergencyCallIcon")
156+ var panel = findChild(shell, "panel")
157+ var indicators = findChild(shell, "indicators")
158+ var launcher = findChild(shell, "launcher")
159+ var stage = findChild(shell, "stage")
142160
143− // pick the first icon, the one at the bottom.
144− var appIcon = findChild(launcherPanel, "launcherDelegate0")
161+ mouseClick(emergencyButton, units.gu(1), units.gu(1))
145162
146− // Swipe upwards over the launcher to ensure that this icon
147− // at the bottom is not folded and faded away.
148− var touchStartX = launcherPanel.width / 2;
149− var touchStartY = launcherPanel.height / 2;
150− touchFlick(launcherPanel, touchStartX, touchStartY, touchStartX, 0);
151− tryCompare(launcherPanel, "moving", false);
163+ tryCompare(lockscreen, "shown", false)
164+ tryCompare(greeter, "fakeActiveForApp", "dialer-app")
165+ tryCompare(panel, "fullscreenMode", true)
166+ tryCompare(indicators, "available", false)
167+ tryCompare(launcher, "available", false)
168+ tryCompare(stage, "spreadEnabled", false)
152169
153− // NB tapping (i.e., using touch events) doesn't activate the icon... go figure...
154− mouseClick(appIcon, appIcon.width / 2, appIcon.height / 2);
155− }
170+ // Cancel emergency mode, and go back to normal
171+ LightDM.Greeter.showGreeter()
156172
157− function test_login() {
158− tryCompare(sessionSpy, "count", 0)
159− enterPin("1234")
160− tryCompare(sessionSpy, "count", 1)
173+ tryCompare(lockscreen, "shown", true)
174+ tryCompare(greeter, "shown", true)
175+ tryCompare(greeter, "fakeActiveForApp", "")
176+ tryCompare(panel, "fullscreenMode", false)
177+ tryCompare(indicators, "available", true)
178+ tryCompare(launcher, "available", true)
179+ tryCompare(stage, "spreadEnabled", true)
161180 }
162181
163− function test_emergencyCall() {
164− dragLauncherIntoView()
165− tapOnAppIconInLauncher()
182+ function test_emergencyCallCrash() {
183+ var lockscreen = findChild(shell, "lockscreen")
184+ var emergencyButton = findChild(lockscreen, "emergencyCallIcon")
185+ mouseClick(emergencyButton, units.gu(1), units.gu(1))
166186
187+ tryCompare(lockscreen, "shown", false)
188+ killApps() // kill dialer-app, as if it crashed
189+ tryCompare(lockscreen, "shown", true)
190+ }
191+
192+ function test_emergencyCallAppLaunch() {
167193 var lockscreen = findChild(shell, "lockscreen")
194+ var emergencyButton = findChild(lockscreen, "emergencyCallIcon")
195+ mouseClick(emergencyButton, units.gu(1), units.gu(1))
196+
197+ tryCompare(lockscreen, "shown", false)
198+ ApplicationManager.startApplication("gallery-app", ApplicationManager.NoFlag)
168199 tryCompare(lockscreen, "shown", true)
169200 }
170201 }