on xenial help sign in
Move tests to tst_Tutorial.qml
commit8ec63d2412a8cd1a48714973b71d7a15ddfc3299 authorMichael Terry <michael.terry@canonical.com> dateMon 23 Mar 2015, 14:54 (12 years ago) parent4511c9e
2 files changed+22−45
tests/qmltests/Tutorial/tst_Tutorial.qml+22−5 tests/qmltests/tst_Shell.qml−40
tests/qmltests/Tutorial/tst_Tutorial.qml+22−5
@@ -17,6 +17,7 @@
1717import QtQuick 2.0
1818import QtTest 1.0
1919import AccountsService 0.1
20+import GSettings 1.0
2021import LightDM 0.1 as LightDM
2122import Ubuntu.Components 1.1
2223import Unity.Application 0.1
@@ -45,6 +46,11 @@ Item {
4546 }
4647 }
4748
49+ GSettings {
50+ id: unity8Settings
51+ schema.id: "com.canonical.Unity8"
52+ }
53+
4854 Component.onCompleted: {
4955 // must set the mock mode before loading the Shell
5056 LightDM.Greeter.mockMode = "single-pin";
@@ -112,6 +118,7 @@ Item {
112118
113119 function init() {
114120 tryCompare(shell, "enabled", true); // enabled by greeter when ready
121+ unity8Settings.usageMode = "Staged";
115122 AccountsService.demoEdges = false;
116123 AccountsService.demoEdges = true;
117124 swipeAwayGreeter();
@@ -185,17 +192,19 @@ Item {
185192 }
186193
187194 function checkRightEdge() {
188− touchFlick(shell, shell.width, halfHeight, halfWidth, halfHeight);
195+ if (unity8Settings.usageMode === "Staged") {
196+ touchFlick(shell, shell.width, halfHeight, halfWidth, halfHeight);
189197
190− var stage = findChild(shell, "stage");
191− var spreadView = findChild(stage, "spreadView");
192− tryCompare(spreadView, "phase", 0);
198+ var stage = findChild(shell, "stage");
199+ var spreadView = findChild(stage, "spreadView");
200+ tryCompare(spreadView, "phase", 0);
201+ }
193202 }
194203
195204 function checkBottomEdge() {
196205 // Can't actually check effect of swipe, since dash isn't really loaded
197206 var applicationsDisplayLoader = findChild(shell, "applicationsDisplayLoader");
198− tryCompare(applicationsDisplayLoader.item, "interactive", false);
207+ tryCompare(applicationsDisplayLoader, "interactive", false);
199208 }
200209
201210 function checkFinished() {
@@ -256,6 +265,14 @@ Item {
256265 goToPage(null);
257266 }
258267
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+
259276 function test_launcherShortDrag() {
260277 // goToPage does a normal launcher pull. But here we want to test
261278 // just barely pulling the launcher out and letting go (i.e. not
tests/qmltests/tst_Shell.qml−40
@@ -64,11 +64,6 @@ Rectangle {
6464 }
6565 }
6666
67− GSettings {
68− id: unity8Settings
69− schema.id: "com.canonical.Unity8"
70− }
71−
7267 Item {
7368 anchors.left: root.left
7469 anchors.right: controls.left
@@ -89,10 +84,6 @@ Rectangle {
8984 width: units.gu(40)
9085 height: units.gu(71)
9186 }
92− PropertyChanges {
93− target: unity8Settings
94− usageMode: "Staged"
95− }
9687 },
9788 State {
9889 name: "tablet"
@@ -101,22 +92,6 @@ Rectangle {
10192 width: units.gu(100)
10293 height: units.gu(71)
10394 }
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− }
12095 }
12196 ]
12297
@@ -1015,21 +990,6 @@ Rectangle {
1015990 compare(tutorial.running, false);
1016991 }
1017992
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−
1033993 function test_tapOnRightEdgeReachesApplicationSurface() {
1034994 loadShell("phone");
1035995 swipeAwayGreeter();