@@ -19,6 +19,7 @@ import QtTest 1.0
19import AccountsService 0.1
19import AccountsService 0.1
20import IntegratedLightDM 0.1 as LightDM
20import IntegratedLightDM 0.1 as LightDM
21import Ubuntu.Components 1.1
21import Ubuntu.Components 1.1
22+import Ubuntu.Telephony 0.1 as Telephony
22import Unity.Application 0.1
23import Unity.Application 0.1
23import Unity.Test 0.1 as UT
24import Unity.Test 0.1 as UT
@@ -45,6 +46,11 @@ Item {
49+ Telephony.CallEntry {
51+ phoneNumber: "+447812221111"
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";
@@ -77,13 +83,29 @@ Item {
78 Rectangle {
84 Rectangle {
79 id: buttons
85 id: buttons
80− color: "white"
86+ color: "black"
81 width: units.gu(30)
87 width: units.gu(30)
82 height: shellLoader.height
88 height: shellLoader.height
85 anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
91 anchors { left: parent.left; right: parent.right; top: parent.top; margins: units.gu(1) }
86 spacing: units.gu(1)
92 spacing: units.gu(1)
94+ anchors { left: parent.left; right: parent.right }
98+ if (shellLoader.status !== Loader.Ready)
101+ var greeter = testCase.findChild(shellLoader.item, "greeter");
102+ if (greeter.shown) {
88 anchors { left: parent.left; right: parent.right }
110 anchors { left: parent.left; right: parent.right }
@@ -98,6 +120,62 @@ Item {
125+ anchors { left: parent.left; right: parent.right }
129+ callManager.foregroundCall = phoneCall;
131+ callManager.foregroundCall = null;
137+ anchors.verticalCenter: parent.verticalCenter
142+ anchors { left: parent.left; right: parent.right }
144+ activeFocusOnPress: false
146+ var surface = SurfaceManager.inputMethodSurface();
148+ surface.setState(Mir.RestoredState);
150+ surface.setState(Mir.MinimizedState);
155+ text: "Input Method"
156+ anchors.verticalCenter: parent.verticalCenter
161+ anchors { left: parent.left; right: parent.right }
164+ if (shellLoader.status !== Loader.Ready)
168+ shellLoader.item.usageScenario = "desktop";
170+ shellLoader.item.usageScenario = "phone";
175+ text: "Desktop Mode"
176+ anchors.verticalCenter: parent.verticalCenter
@@ -114,14 +192,16 @@ Item {
114 function init() {
192 function init() {
115 tryCompare(shell, "enabled", true); // enabled by greeter when ready
193 tryCompare(shell, "enabled", true); // enabled by greeter when ready
117− var greeter = findChild(shell, "greeter");
195+ shell.usageScenario = "phone";
118− tryCompare(greeter, "shown", true);
196+ callManager.foregroundCall = null;
120 AccountsService.demoEdges = false;
197 AccountsService.demoEdges = false;
121 AccountsService.demoEdgesCompleted = [];
198 AccountsService.demoEdgesCompleted = [];
122 AccountsService.demoEdges = true;
199 AccountsService.demoEdges = true;
124− tryCompare(greeter, "shown", false);
201+ LightDM.Greeter.hideGreeter();
203+ var tutorialLeft = findChild(shell, "tutorialLeft");
204+ tryCompare(tutorialLeft, "opacity", 1);
127 function cleanup() {
207 function cleanup() {
@@ -485,20 +565,121 @@ Item {
485 tryCompare(tutorialBottom, "shown", true);
565 tryCompare(tutorialBottom, "shown", true);
488− function disabled_test_skipOnDesktop() {
568+ function test_activeCallInterruptsTutorial() {
489− var tutorial = findChild(shell, "tutorial");
569+ var tutorialLeft = findChild(shell, "tutorialLeft");
490− tryCompare(tutorial, "active", true);
570+ verify(tutorialLeft.shown);
491− tryCompare(tutorial, "running", true);
571+ verify(!tutorialLeft.paused);
493− shell.usageScenario = "desktop";
573+ callManager.foregroundCall = phoneCall;
494− tryCompare(tutorial, "active", false);
574+ verify(!tutorialLeft.shown);
495− tryCompare(tutorial, "running", false);
575+ verify(tutorialLeft.paused);
576+ tryCompare(tutorialLeft, "visible", false);
578+ callManager.foregroundCall = null;
579+ verify(tutorialLeft.shown);
580+ verify(!tutorialLeft.paused);
583+ function test_greeterInterruptsTutorial() {
584+ var tutorialLeft = findChild(shell, "tutorialLeft");
585+ verify(tutorialLeft.shown);
586+ verify(!tutorialLeft.paused);
588+ LightDM.Greeter.showGreeter();
589+ verify(!tutorialLeft.shown);
590+ verify(tutorialLeft.paused);
591+ tryCompare(tutorialLeft, "visible", false);
593+ LightDM.Greeter.hideGreeter();
594+ tryCompare(tutorialLeft, "shown", true);
595+ verify(!tutorialLeft.paused);
598+ function test_interruptionChecksReadyStateWhenDone() {
599+ // If we're done with an interruption (like active call), make sure
600+ // that we don't blindly resume the tutorial -- our trigger
601+ // conditions still need to be met. For example, there need to be
602+ // enough apps open for the right edge tutorial.
604+ openTutorialRight();
606+ var tutorialRight = findChild(shell, "tutorialRight");
607+ verify(tutorialRight.isReady);
608+ verify(tutorialRight.shown);
609+ verify(!tutorialRight.paused);
611+ callManager.foregroundCall = phoneCall;
613+ callManager.foregroundCall = null;
615+ verify(!tutorialRight.isReady);
616+ verify(!tutorialRight.shown);
617+ verify(!tutorialRight.paused);
618+ compare(AccountsService.demoEdgesCompleted, ["left", "top"]);
498− function disabled_test_interrupted() {
621+ function test_desktopOnlyShowsTutorialRight() {
499− goToPage("tutorialLeft");
622+ shell.usageScenario = "desktop";
624+ var tutorialLeft = findChild(shell, "tutorialLeft");
625+ var tutorialTop = findChild(shell, "tutorialTop");
626+ var tutorialRight = findChild(shell, "tutorialRight");
627+ var tutorialBottom = findChild(shell, "tutorialBottom");
628+ verify(tutorialLeft.skipped);
629+ verify(tutorialTop.skipped);
630+ verify(!tutorialRight.skipped);
631+ verify(tutorialBottom.skipped);
632+ compare(AccountsService.demoEdgesCompleted, []);
500 ApplicationManager.startApplication("dialer-app");
634 ApplicationManager.startApplication("dialer-app");
501− checkFinished();
635+ ApplicationManager.startApplication("camera-app");
636+ ApplicationManager.startApplication("messaging-app");
637+ tryCompare(tutorialRight, "isReady", true);
638+ tryCompare(tutorialRight, "shown", true);
641+ function test_oskDoesNotHideTutorial() {
642+ var tutorialLeft = findChild(shell, "tutorialLeft");
643+ verify(tutorialLeft.shown);
645+ var surface = SurfaceManager.inputMethodSurface();
646+ surface.setState(Mir.RestoredState);
648+ var inputMethod = findInvisibleChild(shell, "inputMethod");
649+ tryCompare(inputMethod, "state", "shown");
651+ verify(tutorialLeft.shown);
654+ function test_oskPreventsTutorial() {
655+ var surface = SurfaceManager.inputMethodSurface();
656+ var inputMethod = findInvisibleChild(shell, "inputMethod");
658+ AccountsService.demoEdges = false;
659+ surface.setState(Mir.RestoredState);
660+ tryCompare(inputMethod, "state", "shown");
662+ AccountsService.demoEdges = true;
663+ var tutorialLeft = findChild(shell, "tutorialLeft");
664+ verify(!tutorialLeft.shown);
666+ surface.setState(Mir.MinimizedState);
667+ tryCompare(inputMethod, "state", "hidden");
668+ verify(tutorialLeft.shown);
671+ function test_accountsServiceSettings() {
672+ var tutorialLeft = findChild(shell, "tutorialLeft");
673+ verify(tutorialLeft != null);
674+ verify(tutorialLeft.shown);
676+ AccountsService.demoEdges = false;
677+ verify(findChild(shell, "tutorialLeft") == null);
679+ AccountsService.demoEdges = true;
680+ tutorialLeft = findChild(shell, "tutorialLeft");
681+ verify(tutorialLeft != null);
682+ verify(tutorialLeft.shown);