on xenial help sign in
Add some tests
f6767c9Michael Terry
qml/Shell.qml+7
@@ -305,6 +305,11 @@ FocusScope {
305
305
306 source: shell.sideStageEnabled ? "Stages/StageWithSideStage.qml" : "Stages/PhoneStage.qml"
306 source: shell.sideStageEnabled ? "Stages/StageWithSideStage.qml" : "Stages/PhoneStage.qml"
307
307
308+ Binding {
309+ target: applicationsDisplayLoader.item
310+ property: "objectName"
311+ value: "stage"
312+ }
308 Binding {
313 Binding {
309 target: applicationsDisplayLoader.item
314 target: applicationsDisplayLoader.item
310 property: "moving"
315 property: "moving"
@@ -554,6 +559,7 @@ FocusScope {
554
559
555 Panel {
560 Panel {
556 id: panel
561 id: panel
562+ objectName: "panel"
557 anchors.fill: parent //because this draws indicator menus
563 anchors.fill: parent //because this draws indicator menus
558 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
564 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
559 indicators {
565 indicators {
@@ -589,6 +595,7 @@ FocusScope {
589
595
590 Launcher {
596 Launcher {
591 id: launcher
597 id: launcher
598+ objectName: "launcher"
592
599
593 readonly property bool dashSwipe: progress > 0
600 readonly property bool dashSwipe: progress > 0
594
601
tests/qmltests/Greeter/tst_Lockscreen.qml+3−3
@@ -57,10 +57,10 @@ Rectangle {
57 target: LightDM.Greeter
57 target: LightDM.Greeter
58
58
59 onShowPrompt: {
59 onShowPrompt: {
60− if (text == "PIN") {
60+ if (text === "PIN") {
61− pinPadCheckBox.checked = true
62− } else {
63 pinPadCheckBox.checked = false
61 pinPadCheckBox.checked = false
62+ } else {
63+ pinPadCheckBox.checked = true
64 }
64 }
65 lockscreen.placeholderText = text;
65 lockscreen.placeholderText = text;
66 }
66 }
tests/qmltests/tst_Shell.qml−1
@@ -99,7 +99,6 @@ Item {
99 swipeAwayGreeter();
99 swipeAwayGreeter();
100
100
101 sessionSpy.target = findChild(shell, "greeter")
101 sessionSpy.target = findChild(shell, "greeter")
102− sessionSpy.clear()
103 }
102 }
104
103
105 function cleanup() {
104 function cleanup() {
tests/qmltests/tst_ShellWithPin.qml+63−32
@@ -93,10 +93,27 @@ Item {
93
93
94 verify(ok);
94 verify(ok);
95
95
96− swipeAwayGreeter();
97−
98 sessionSpy.target = findChild(shell, "greeter")
96 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)
100 }
117 }
101
118
102 function swipeAwayGreeter() {
119 function swipeAwayGreeter() {
@@ -126,45 +143,59 @@ Item {
126 }
143 }
127 }
144 }
128
145
129− function dragLauncherIntoView() {
146+ function test_login() {
130− var launcherPanel = findChild(shell, "launcherPanel");
147+ tryCompare(sessionSpy, "count", 0)
131− verify(launcherPanel.x = - launcherPanel.width);
148+ enterPin("1234")
132−
149+ tryCompare(sessionSpy, "count", 1)
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);
138 }
150 }
139
151
140− function tapOnAppIconInLauncher() {
152+ function test_emergencyCall() {
141− var launcherPanel = findChild(shell, "launcherPanel");
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")
142
160
143− // pick the first icon, the one at the bottom.
161+ mouseClick(emergencyButton, units.gu(1), units.gu(1))
144− var appIcon = findChild(launcherPanel, "launcherDelegate0")
145
162
146− // Swipe upwards over the launcher to ensure that this icon
163+ tryCompare(lockscreen, "shown", false)
147− // at the bottom is not folded and faded away.
164+ tryCompare(greeter, "fakeActiveForApp", "dialer-app")
148− var touchStartX = launcherPanel.width / 2;
165+ tryCompare(panel, "fullscreenMode", true)
149− var touchStartY = launcherPanel.height / 2;
166+ tryCompare(indicators, "available", false)
150− touchFlick(launcherPanel, touchStartX, touchStartY, touchStartX, 0);
167+ tryCompare(launcher, "available", false)
151− tryCompare(launcherPanel, "moving", false);
168+ tryCompare(stage, "spreadEnabled", false)
152
169
153− // NB tapping (i.e., using touch events) doesn't activate the icon... go figure...
170+ // Cancel emergency mode, and go back to normal
154− mouseClick(appIcon, appIcon.width / 2, appIcon.height / 2);
171+ LightDM.Greeter.showGreeter()
155− }
156
172
157− function test_login() {
173+ tryCompare(lockscreen, "shown", true)
158− tryCompare(sessionSpy, "count", 0)
174+ tryCompare(greeter, "shown", true)
159− enterPin("1234")
175+ tryCompare(greeter, "fakeActiveForApp", "")
160− tryCompare(sessionSpy, "count", 1)
176+ tryCompare(panel, "fullscreenMode", false)
177+ tryCompare(indicators, "available", true)
178+ tryCompare(launcher, "available", true)
179+ tryCompare(stage, "spreadEnabled", true)
161 }
180 }
162
181
163− function test_emergencyCall() {
182+ function test_emergencyCallCrash() {
164− dragLauncherIntoView()
183+ var lockscreen = findChild(shell, "lockscreen")
165− tapOnAppIconInLauncher()
184+ var emergencyButton = findChild(lockscreen, "emergencyCallIcon")
185+ mouseClick(emergencyButton, units.gu(1), units.gu(1))
166
186
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() {
167 var lockscreen = findChild(shell, "lockscreen")
193 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)
168 tryCompare(lockscreen, "shown", true)
199 tryCompare(lockscreen, "shown", true)
169 }
200 }
170 }
201 }