@@ -22,6 +22,7 @@ import Ubuntu.Components 1.3
22import Ubuntu.Components.ListItems 1.3
22import Ubuntu.Components.ListItems 1.3
23import Ubuntu.Telephony 0.1 as Telephony
23import Ubuntu.Telephony 0.1 as Telephony
24import Unity.Application 0.1
24import Unity.Application 0.1
25+import Unity.Notifications 1.0
25import Unity.Test 0.1 as UT
26import Unity.Test 0.1 as UT
26import Utils 0.1
27import Utils 0.1
@@ -55,6 +56,33 @@ Rectangle {
55 phoneNumber: "+447812221111"
56 phoneNumber: "+447812221111"
65+ id: mockNotificationsModel
67+ function getRaw(id) {
68+ return mockNotification.createObject(mockNotificationsModel)
72+ function addNotification() {
74+ type: Notification.Confirmation,
83+ mockNotificationsModel.append(n);
58 Component.onCompleted: {
86 Component.onCompleted: {
59 // must set the mock mode before loading the Shell
87 // must set the mock mode before loading the Shell
60 LightDM.Greeter.mockMode = "single-pin";
88 LightDM.Greeter.mockMode = "single-pin";
@@ -262,6 +290,7 @@ Rectangle {
262 // reload our test subject to get it in a fresh state once again
290 // reload our test subject to get it in a fresh state once again
263 shellLoader.active = true;
291 shellLoader.active = true;
293+ mockNotificationsModel.clear();
265 tryCompare(shellLoader, "status", Loader.Ready);
294 tryCompare(shellLoader, "status", Loader.Ready);
266 removeTimeConstraintsFromDirectionalDragAreas(shellLoader.item);
295 removeTimeConstraintsFromDirectionalDragAreas(shellLoader.item);
@@ -690,24 +719,59 @@ Rectangle {
690 verify(tutorialLeft.shown);
719 verify(tutorialLeft.shown);
693− function test_oskPreventsTutorial() {
722+ function test_oskDelaysTutorial() {
694− var surface = SurfaceManager.inputMethodSurface;
723+ var tutorial = findChild(shell, "tutorial");
695− var inputMethod = findInvisibleChild(shell, "inputMethod");
724+ verify(!tutorial.delayed);
697− AccountsService.demoEdges = false;
698− surface.setState(Mir.RestoredState);
726+ SurfaceManager.inputMethodSurface.setState(Mir.RestoredState);
699− tryCompare(inputMethod, "state", "shown");
728+ tryCompare(tutorial, "delayed", true);
731+ function test_notificationDelaysTutorial() {
701 var tutorial = findChild(shell, "tutorial");
732 var tutorial = findChild(shell, "tutorial");
702− tryCompare(tutorial, "keyboardVisible", true);
733+ verify(!tutorial.delayed);
704− AccountsService.demoEdges = true;
735+ var notifications = findChild(shell, "notificationList");
705− var tutorialLeft = findChild(shell, "tutorialLeft");
736+ notifications.model = mockNotificationsModel;
706− verify(!tutorialLeft.shown);
737+ addNotification();
708− surface.setState(Mir.MinimizedState);
739+ tryCompare(tutorial, "delayed", true);
709− tryCompare(inputMethod, "state", "hidden");
740+ }
710− tryCompare(tutorialLeft, "shown", false);
741+
742+ function test_dialogDelaysTutorial() {
743+ var tutorial = findChild(shell, "tutorial");
744+ verify(!tutorial.delayed);
746+ var dialogs = findChild(shell, "dialogs");
747+ dialogs.showPowerDialog();
749+ verify(tutorial.delayed);
752+ function test_delayedTutorial() {
753+ var tutorial = findChild(shell, "tutorial");
754+ var tutorialTop = findChild(tutorial, "tutorialTop");
755+ var tutorialTopTimer = findChild(tutorialTop, "tutorialTopTimer");
757+ // Get top tutorial ready
758+ AccountsService.demoEdgesCompleted = ["left"];
759+ verify(tutorialTop.isReady);
760+ verify(tutorialTopTimer.running);
762+ // Confirm that we become unready when delayed, but timer still goes
763+ tutorial.delayed = true;
764+ verify(!tutorialTop.isReady);
765+ verify(tutorialTopTimer.running);
767+ // Confirm that we don't open the tutorial when delayed
768+ tutorialTopTimer.interval = 1;
770+ verify(!tutorialTop.shown);
772+ // Confirm we go back to normal when undelayed
773+ tutorial.delayed = false;
774+ tryCompare(tutorialTop, "shown", true);
713 function test_accountsServiceSettings() {
777 function test_accountsServiceSettings() {