on xenial help sign in
Fix up tests
40af579Michael Terry
qml/Launcher/Launcher.qml+4−1
@@ -34,6 +34,7 @@ Item {
34 property real progress: dragArea.dragging && dragArea.touchX > panelWidth ?
34 property real progress: dragArea.dragging && dragArea.touchX > panelWidth ?
35 (width * (dragArea.touchX-panelWidth) / (width - panelWidth)) : 0
35 (width * (dragArea.touchX-panelWidth) / (width - panelWidth)) : 0
36
36
37+ readonly property bool dragging: dragArea.dragging
37 readonly property real dragDistance: dragArea.dragging ? dragArea.touchX : 0
38 readonly property real dragDistance: dragArea.dragging ? dragArea.touchX : 0
38 readonly property real visibleWidth: panel.width + panel.x
39 readonly property real visibleWidth: panel.width + panel.x
39
40
@@ -70,7 +71,7 @@ Item {
70 }
71 }
71
72
72 function tease(interval) {
73 function tease(interval) {
73− if (available && !dragArea.dragging) {
74+ if (available && root.state == "" && !dragArea.dragging) {
74 if (interval === undefined) {
75 if (interval === undefined) {
75 interval = 200;
76 interval = 200;
76 }
77 }
@@ -284,6 +285,8 @@ Item {
284 } else {
285 } else {
285 root.switchToNextState("")
286 root.switchToNextState("")
286 }
287 }
288+ } else {
289+ teaseTimer.stop();
287 }
290 }
288 }
291 }
289 }
292 }
qml/Shell.qml+4−2
@@ -241,8 +241,10 @@ Item {
241 }
241 }
242
242
243 onApplicationAdded: {
243 onApplicationAdded: {
244− if (greeter.shown && appId != "unity8-dash") {
244+ if (appId != "unity8-dash") {
245+ if (greeter.shown) {
245− greeter.startUnlock()
246+ greeter.startUnlock();
247+ }
246
248
247 // If this happens on first boot, we may be in edge
249 // If this happens on first boot, we may be in edge
248 // tutorial or wizard while receiving a call. But a call
250 // tutorial or wizard while receiving a call. But a call
qml/Tutorial/Tutorial.qml+1
@@ -65,6 +65,7 @@ Item {
65
65
66 Loader {
66 Loader {
67 id: loader
67 id: loader
68+ objectName: "tutorialLoader"
68
69
69 property Component target: {
70 property Component target: {
70 if (next) {
71 if (next) {
qml/Tutorial/TutorialLeft.qml+11−13
@@ -32,35 +32,33 @@ TutorialPage {
32 Connections {
32 Connections {
33 target: root.launcher
33 target: root.launcher
34
34
35− property bool maybeDone
36−
37 onStateChanged: {
35 onStateChanged: {
38− if (launcher.state === "visible") {
36+ if (root.launcher.state === "visible") {
39− maybeDone = true;
37+ finishTimer.start();
40 }
38 }
41 }
39 }
42
40
43 onDash: {
41 onDash: {
44− maybeDone = false;
42+ finishTimer.stop();
45 root.showError();
43 root.showError();
46 root.launcher.hide();
44 root.launcher.hide();
47 }
45 }
48−
49− onDragDistanceChanged: {
50− if (root.launcher.dragDistance === 0 && maybeDone) {
51− root.hide();
52− }
53− }
54 }
46 }
55
47
56 Timer {
48 Timer {
57 id: teaseTimer
49 id: teaseTimer
58 interval: UbuntuAnimation.SleepyDuration
50 interval: UbuntuAnimation.SleepyDuration
59 repeat: true
51 repeat: true
60− running: !root.paused
52+ running: !root.paused && !root.launcher.dragging
61 onTriggered: root.launcher.tease(UbuntuAnimation.SleepyDuration)
53 onTriggered: root.launcher.tease(UbuntuAnimation.SleepyDuration)
62 }
54 }
63
55
56+ Timer {
57+ id: finishTimer
58+ interval: 1
59+ onTriggered: root.hide()
60+ }
61+
64 foreground {
62 foreground {
65 children: [
63 children: [
66 LocalComponents.Slider {
64 LocalComponents.Slider {
@@ -70,7 +68,7 @@ TutorialPage {
70 topMargin: root.textBottom + units.gu(3)
68 topMargin: root.textBottom + units.gu(3)
71 }
69 }
72 offset: root.launcher.visibleWidth + root.launcher.progress
70 offset: root.launcher.visibleWidth + root.launcher.progress
73− active: root.launcher.dragDistance > 0
71+ active: root.launcher.dragging
74 shortSwipe: true
72 shortSwipe: true
75 }
73 }
76 ]
74 ]
qml/Tutorial/TutorialLeftFinish.qml+1
@@ -27,6 +27,7 @@ TutorialPage {
27 foreground {
27 foreground {
28 children: [
28 children: [
29 Image {
29 Image {
30+ objectName: "tick"
30 anchors {
31 anchors {
31 horizontalCenter: parent.horizontalCenter
32 horizontalCenter: parent.horizontalCenter
32 top: parent.top
33 top: parent.top
qml/Tutorial/TutorialPage.qml+1
@@ -159,6 +159,7 @@ Showable {
159
159
160 Label {
160 Label {
161 id: errorLabel
161 id: errorLabel
162+ objectName: "errorLabel"
162 anchors {
163 anchors {
163 top: parent.verticalCenter
164 top: parent.verticalCenter
164 topMargin: d.verticalOffset + root.textYOffset
165 topMargin: d.verticalOffset + root.textYOffset
tests/qmltests/Tutorial/tst_Tutorial.qml+26−39
@@ -199,54 +199,28 @@ Item {
199 }
199 }
200
200
201 function goToPage(name) {
201 function goToPage(name) {
202− var page = waitForPage("tutorialIntro");
202+ var page = waitForPage("tutorialLeft");
203− if (name === "tutorialIntro") return page;
204− tap(page);
205−
206− page = waitForPage("tutorialTop");
207− checkLeftEdge();
208− checkRightEdge();
209− checkBottomEdge();
210− if (name === "tutorialTop") return page;
211− touchFlick(shell, halfWidth, 0, halfWidth, shell.height);
212−
213− page = waitForPage("tutorialTopFinish");
214− checkLeftEdge();
215− checkRightEdge();
216− checkBottomEdge();
217− if (name === "tutorialTopFinish") return page;
218− touchFlick(shell, halfWidth, shell.height, halfWidth, 0);
219−
220− page = waitForPage("tutorialLeft");
221 checkTopEdge();
203 checkTopEdge();
222 checkRightEdge();
204 checkRightEdge();
223 checkBottomEdge();
205 checkBottomEdge();
224 if (name === "tutorialLeft") return page;
206 if (name === "tutorialLeft") return page;
225− touchFlick(shell, 0, halfHeight, halfWidth, halfHeight, true, false);
207+ touchFlick(shell, 0, halfHeight, halfWidth, halfHeight);
226
208
227− page = waitForPage("tutorialLeftRelease");
209+ page = waitForPage("tutorialLeftFinish");
228− if (name === "tutorialLeftRelease") return page;
210+ if (name === "tutorialLeftFinish") return page;
229− touchFlick(shell, halfWidth, halfHeight, halfWidth, halfHeight, false, true);
211+ var tick = findChild(page, "tick");
212+ tap(tick);
230
213
231 checkFinished();
214 checkFinished();
232 return null;
215 return null;
233 }
216 }
234
217
235− function test_skippable() {
236− var top = goToPage("tutorialTop");
237−
238− var skipLabel = findChild(top, "skipLabel");
239− tap(skipLabel);
240−
241− checkFinished();
242− }
243−
244 function test_walkthrough() {
218 function test_walkthrough() {
245 goToPage(null);
219 goToPage(null);
246 }
220 }
247
221
248− function test_launcherShortDrags() {
222+ function test_launcherShortDrag() {
249− // goToPage does a full launcher pull. But here we want to test
223+ // goToPage does a normal launcher pull. But here we want to test
250 // just barely pulling the launcher out and letting go (i.e. not
224 // just barely pulling the launcher out and letting go (i.e. not
251 // triggering the "progress" property of Launcher).
225 // triggering the "progress" property of Launcher).
252
226
@@ -263,23 +237,36 @@ Item {
263 touchFlick(shell, 0, halfHeight, launcher.panelWidth * 0.9, halfHeight);
237 touchFlick(shell, 0, halfHeight, launcher.panelWidth * 0.9, halfHeight);
264
238
265 waitForPage("tutorialLeftFinish");
239 waitForPage("tutorialLeftFinish");
266− tap(launcher);
240+ }
267
241
268− checkFinished();
242+ function test_launcherLongDrag() {
243+ // goToPage does a normal launcher pull. But here we want to test
244+ // a full pull across the page.
245+
246+ var left = goToPage("tutorialLeft");
247+
248+ var launcher = findChild(shell, "launcher");
249+ touchFlick(shell, 0, halfHeight, shell.width, halfHeight);
250+
251+ var errorLabel = findChild(left, "errorLabel");
252+ tryCompare(launcher, "state", ""); // launcher goes away
253+ tryCompare(left, "shown", true); // still on left page
254+ tryCompare(errorLabel, "opacity", 1); // show error
269 }
255 }
270
256
271 function test_launcherDragBack() {
257 function test_launcherDragBack() {
272 // goToPage does a full launcher pull. But here we test pulling
258 // goToPage does a full launcher pull. But here we test pulling
273 // all the way out, then dragging back into place.
259 // all the way out, then dragging back into place.
274
260
275− goToPage("tutorialLeftRelease");
261+ var left = goToPage("tutorialLeft");
262+ touchFlick(shell, 0, halfHeight, halfWidth, halfHeight, true, false);
276 touchFlick(shell, halfWidth, halfHeight, 0, halfHeight, false, true);
263 touchFlick(shell, halfWidth, halfHeight, 0, halfHeight, false, true);
277
264
278− checkFinished();
265+ tryCompare(left, "shown", true); // and we should still be on left
279 }
266 }
280
267
281 function test_interrupted() {
268 function test_interrupted() {
282− goToPage("tutorialTop");
269+ goToPage("tutorialLeft");
283 ApplicationManager.startApplication("dialer-app");
270 ApplicationManager.startApplication("dialer-app");
284 checkFinished();
271 checkFinished();
285 }
272 }