on xenial help sign in
Move tests to tst_Tutorial.qml
8ec63d2Michael Terry
tests/qmltests/Tutorial/tst_Tutorial.qml+22−5
@@ -17,6 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtTest 1.0
18import QtTest 1.0
19import AccountsService 0.1
19import AccountsService 0.1
20+import GSettings 1.0
20import LightDM 0.1 as LightDM
21import LightDM 0.1 as LightDM
21import Ubuntu.Components 1.1
22import Ubuntu.Components 1.1
22import Unity.Application 0.1
23import Unity.Application 0.1
@@ -45,6 +46,11 @@ Item {
45 }
46 }
46 }
47 }
47
48
49+ GSettings {
50+ id: unity8Settings
51+ schema.id: "com.canonical.Unity8"
52+ }
53+
48 Component.onCompleted: {
54 Component.onCompleted: {
49 // must set the mock mode before loading the Shell
55 // must set the mock mode before loading the Shell
50 LightDM.Greeter.mockMode = "single-pin";
56 LightDM.Greeter.mockMode = "single-pin";
@@ -112,6 +118,7 @@ Item {
112
118
113 function init() {
119 function init() {
114 tryCompare(shell, "enabled", true); // enabled by greeter when ready
120 tryCompare(shell, "enabled", true); // enabled by greeter when ready
121+ unity8Settings.usageMode = "Staged";
115 AccountsService.demoEdges = false;
122 AccountsService.demoEdges = false;
116 AccountsService.demoEdges = true;
123 AccountsService.demoEdges = true;
117 swipeAwayGreeter();
124 swipeAwayGreeter();
@@ -185,17 +192,19 @@ Item {
185 }
192 }
186
193
187 function checkRightEdge() {
194 function checkRightEdge() {
195+ if (unity8Settings.usageMode === "Staged") {
188− touchFlick(shell, shell.width, halfHeight, halfWidth, halfHeight);
196+ touchFlick(shell, shell.width, halfHeight, halfWidth, halfHeight);
189
197
190− var stage = findChild(shell, "stage");
198+ var stage = findChild(shell, "stage");
191− var spreadView = findChild(stage, "spreadView");
199+ var spreadView = findChild(stage, "spreadView");
192− tryCompare(spreadView, "phase", 0);
200+ tryCompare(spreadView, "phase", 0);
201+ }
193 }
202 }
194
203
195 function checkBottomEdge() {
204 function checkBottomEdge() {
196 // Can't actually check effect of swipe, since dash isn't really loaded
205 // Can't actually check effect of swipe, since dash isn't really loaded
197 var applicationsDisplayLoader = findChild(shell, "applicationsDisplayLoader");
206 var applicationsDisplayLoader = findChild(shell, "applicationsDisplayLoader");
198− tryCompare(applicationsDisplayLoader.item, "interactive", false);
207+ tryCompare(applicationsDisplayLoader, "interactive", false);
199 }
208 }
200
209
201 function checkFinished() {
210 function checkFinished() {
@@ -256,6 +265,14 @@ Item {
256 goToPage(null);
265 goToPage(null);
257 }
266 }
258
267
268+ function test_walkthroughOnDesktop() {
269+ unity8Settings.usageMode = "Windowed";
270+ var page = goToPage("tutorialLeftFinish");
271+ var tick = findChild(page, "tick");
272+ tap(tick);
273+ checkFinished();
274+ }
275+
259 function test_launcherShortDrag() {
276 function test_launcherShortDrag() {
260 // goToPage does a normal launcher pull. But here we want to test
277 // goToPage does a normal launcher pull. But here we want to test
261 // just barely pulling the launcher out and letting go (i.e. not
278 // just barely pulling the launcher out and letting go (i.e. not
tests/qmltests/tst_Shell.qml−40
@@ -64,11 +64,6 @@ Rectangle {
64 }
64 }
65 }
65 }
66
66
67− GSettings {
68− id: unity8Settings
69− schema.id: "com.canonical.Unity8"
70− }
71−
72 Item {
67 Item {
73 anchors.left: root.left
68 anchors.left: root.left
74 anchors.right: controls.left
69 anchors.right: controls.left
@@ -89,10 +84,6 @@ Rectangle {
89 width: units.gu(40)
84 width: units.gu(40)
90 height: units.gu(71)
85 height: units.gu(71)
91 }
86 }
92− PropertyChanges {
93− target: unity8Settings
94− usageMode: "Staged"
95− }
96 },
87 },
97 State {
88 State {
98 name: "tablet"
89 name: "tablet"
@@ -101,22 +92,6 @@ Rectangle {
101 width: units.gu(100)
92 width: units.gu(100)
102 height: units.gu(71)
93 height: units.gu(71)
103 }
94 }
104− PropertyChanges {
105− target: unity8Settings
106− usageMode: "Staged"
107− }
108− },
109− State {
110− name: "desktop"
111− PropertyChanges {
112− target: shellLoader
113− width: units.gu(100)
114− height: units.gu(71)
115− }
116− PropertyChanges {
117− target: unity8Settings
118− usageMode: "Windowed"
119− }
120 }
95 }
121 ]
96 ]
122
97
@@ -1015,21 +990,6 @@ Rectangle {
1015 compare(tutorial.running, false);
990 compare(tutorial.running, false);
1016 }
991 }
1017
992
1018− function test_tutorialDesktopMode_data() {
1019− return [
1020− {tag: "phone", formFactor: "phone", usingDrag: true},
1021− {tag: "tablet", formFactor: "tablet", usingDrag: true},
1022− {tag: "desktop", formFactor: "desktop", usingDrag: false},
1023− ];
1024− }
1025− function test_tutorialDesktopMode(data) {
1026− AccountsService.demoEdges = true;
1027− loadShell(data.formFactor);
1028−
1029− var tutorial = findChild(shell, "tutorial");
1030− compare(tutorial.useEdgeDragArea, data.usingDrag);
1031− }
1032−
1033 function test_tapOnRightEdgeReachesApplicationSurface() {
993 function test_tapOnRightEdgeReachesApplicationSurface() {
1034 loadShell("phone");
994 loadShell("phone");
1035 swipeAwayGreeter();
995 swipeAwayGreeter();