on xenial help sign in
Stop long left swipe until tutorial has been done
commitabeab1619c86f1cd9e76a6996561d387cfcb50e0 authorMichael Terry <michael.terry@canonical.com> dateThu 28 Apr 2016, 13:24 (10 years ago) parent0f42dae
4 files changed+36−1
qml/Shell.qml+2−1 qml/Tutorial/Tutorial.qml+1 qml/Tutorial/TutorialContent.qml+3 tests/qmltests/Tutorial/tst_Tutorial.qml+30
qml/Shell.qml+2−1
@@ -496,7 +496,8 @@ Item {
496496 launcher.fadeOut();
497497 }
498498
499− if (!greeter.locked && ApplicationManager.focusedApplicationId != "unity8-dash") {
499+ if (!greeter.locked && tutorial.launcherLongSwipeEnabled
500+ && ApplicationManager.focusedApplicationId != "unity8-dash") {
500501 ApplicationManager.requestFocusApplication("unity8-dash")
501502 launcher.fadeOut();
502503 }
qml/Tutorial/Tutorial.qml+1
@@ -37,6 +37,7 @@ Item {
3737 property int lastInputTimestamp
3838
3939 readonly property bool launcherEnabled: loader.item ? loader.item.launcherEnabled : true
40+ readonly property bool launcherLongSwipeEnabled: loader.item ? loader.item.launcherLongSwipeEnabled : true
4041 readonly property bool spreadEnabled: loader.item ? loader.item.spreadEnabled : true
4142 readonly property bool panelEnabled: loader.item ? loader.item.panelEnabled : true
4243 readonly property bool running: loader.item ? loader.item.running : false
qml/Tutorial/TutorialContent.qml+3
@@ -33,9 +33,12 @@ Item {
3333 readonly property bool launcherEnabled: !running
3434 || tutorialLeftLoader.shown
3535 || tutorialLeftLongLoader.shown
36+ readonly property bool launcherLongSwipeEnabled: tutorialLeftLongLoader.shown
37+ || tutorialLeftLongLoader.skipped
3638 readonly property bool spreadEnabled: !running || tutorialRightLoader.shown
3739 readonly property bool panelEnabled: !running || tutorialTopLoader.shown
3840 readonly property bool running: tutorialLeftLoader.shown
41+ || tutorialLeftLongLoader.shown
3942 || tutorialTopLoader.shown
4043 || tutorialRightLoader.shown
4144
tests/qmltests/Tutorial/tst_Tutorial.qml+30
@@ -309,6 +309,18 @@ Rectangle {
309309 tryCompare(tutorialTop, "opacity", 1);
310310 }
311311
312+ function openTutorialLeftLong() {
313+ var tutorialLeftLong = findChild(shell, "tutorialLeftLong");
314+ var tutorialLeftLongTimer = findChild(tutorialLeftLong, "tutorialLeftLongTimer");
315+
316+ AccountsService.demoEdgesCompleted = ["left", "top"];
317+ ApplicationManager.startApplication("gallery-app");
318+
319+ tutorialLeftLongTimer.interval = 1;
320+ tryCompare(tutorialLeftLong, "shown", true);
321+ tryCompare(tutorialLeftLong, "opacity", 1);
322+ }
323+
312324 function openTutorialRight() {
313325 var tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
314326 var tutorialRight = findChild(shell, "tutorialRight");
@@ -414,6 +426,24 @@ Rectangle {
414426 tryCompare(AccountsService, "demoEdgesCompleted", ["left"]);
415427 }
416428
429+ function test_tutorialLongLeftSwipeDisabled() {
430+ // Test that a long left swipe is disabled until we get to or pass
431+ // the long left tutorial.
432+ var tutorial = findChild(shell, "tutorial");
433+
434+ verify(!tutorial.launcherLongSwipeEnabled);
435+
436+ openTutorialLeftLong();
437+ verify(tutorial.launcherLongSwipeEnabled);
438+
439+ openTutorialRight();
440+ verify(tutorial.launcherLongSwipeEnabled);
441+
442+ AccountsService.demoEdges = false;
443+ tryCompare(tutorial, "running", false);
444+ verify(tutorial.launcherLongSwipeEnabled);
445+ }
446+
417447 function test_tutorialTopEdges() {
418448 var tutorial = findChild(shell, "tutorial");
419449 var tutorialTop = findChild(tutorial, "tutorialTop");