@@ -1,5 +1,5 @@
2− * Copyright (C) 2013,2014,2015 Canonical, Ltd.
2+ * Copyright (C) 2013-2016 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -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";
@@ -231,6 +259,8 @@ Rectangle {
231 prepareShell();
259 prepareShell();
233 var tutorialLeft = findChild(shell, "tutorialLeft");
261 var tutorialLeft = findChild(shell, "tutorialLeft");
262+ var tutorialLeftTimer = findInvisibleChild(tutorialLeft, "tutorialLeftTimer");
263+ tutorialLeftTimer.interval = 0;
234 tryCompare(tutorialLeft, "opacity", 1);
264 tryCompare(tutorialLeft, "opacity", 1);
@@ -260,6 +290,7 @@ Rectangle {
260 // 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
261 shellLoader.active = true;
291 shellLoader.active = true;
293+ mockNotificationsModel.clear();
263 tryCompare(shellLoader, "status", Loader.Ready);
294 tryCompare(shellLoader, "status", Loader.Ready);
264 removeTimeConstraintsFromSwipeAreas(shellLoader.item);
295 removeTimeConstraintsFromSwipeAreas(shellLoader.item);
@@ -300,40 +331,41 @@ Rectangle {
300 var tutorialTopTimer = findInvisibleChild(tutorialTop, "tutorialTopTimer");
331 var tutorialTopTimer = findInvisibleChild(tutorialTop, "tutorialTopTimer");
302 tutorialTopTimer.interval = 1;
333 tutorialTopTimer.interval = 1;
303− AccountsService.demoEdgesCompleted = ["left", "left-long"];
334+ AccountsService.demoEdgesCompleted = ["left"];
305 tryCompare(tutorialLeftLoader, "active", false);
336 tryCompare(tutorialLeftLoader, "active", false);
306 tryCompare(tutorialTop, "shown", true);
337 tryCompare(tutorialTop, "shown", true);
307 tryCompare(tutorialTop, "opacity", 1);
338 tryCompare(tutorialTop, "opacity", 1);
341+ function openTutorialLeftLong() {
342+ var tutorialLeftLong = findChild(shell, "tutorialLeftLong");
343+ var tutorialLeftLongTimer = findChild(tutorialLeftLong, "tutorialLeftLongTimer");
345+ AccountsService.demoEdgesCompleted = ["left", "top"];
346+ ApplicationManager.startApplication("gallery-app");
348+ tutorialLeftLongTimer.interval = 1;
349+ tryCompare(tutorialLeftLong, "shown", true);
350+ tryCompare(tutorialLeftLong, "opacity", 1);
310 function openTutorialRight() {
353 function openTutorialRight() {
311 var tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
354 var tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
312 var tutorialRight = findChild(shell, "tutorialRight");
355 var tutorialRight = findChild(shell, "tutorialRight");
356+ var tutorialRightTimer = findChild(tutorialRight, "tutorialRightTimer");
314− AccountsService.demoEdgesCompleted = ["left", "left-long", "top"];
358+ AccountsService.demoEdgesCompleted = ["left", "top", "left-long"];
315 ApplicationManager.startApplication("gallery-app");
359 ApplicationManager.startApplication("gallery-app");
316 ApplicationManager.startApplication("facebook-webapp");
360 ApplicationManager.startApplication("facebook-webapp");
361+ ApplicationManager.startApplication("camera-app");
318 tryCompare(tutorialLeftLoader, "active", false);
363 tryCompare(tutorialLeftLoader, "active", false);
364+ tutorialRightTimer.interval = 1;
319 tryCompare(tutorialRight, "shown", true);
365 tryCompare(tutorialRight, "shown", true);
320 tryCompare(tutorialRight, "opacity", 1);
366 tryCompare(tutorialRight, "opacity", 1);
323− function openTutorialBottom() {
324− var tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
325− var tutorialBottom = findChild(shell, "tutorialBottom");
327− AccountsService.demoEdgesCompleted = ["left", "left-long", "top", "right"];
328− tryCompare(tutorialLeftLoader, "active", false);
330− ApplicationManager.startApplication("dialer-app");
331− ApplicationManager.requestFocusApplication("dialer-app");
333− tryCompare(tutorialBottom, "shown", true);
334− tryCompare(tutorialBottom, "opacity", 1);
337 function test_tutorialLeftEdges() {
369 function test_tutorialLeftEdges() {
338 var tutorial = findChild(shell, "tutorial");
370 var tutorial = findChild(shell, "tutorial");
339 var tutorialLeft = findChild(tutorial, "tutorialLeft");
371 var tutorialLeft = findChild(tutorial, "tutorialLeft");
@@ -396,19 +428,21 @@ Rectangle {
396 tryCompare(launcher, "state", "visible");
428 tryCompare(launcher, "state", "visible");
399− function test_tutorialLeftLongDrag() {
431+ function test_tutorialLeftLongFinish() {
400− // Just confirm that a long drag ("dash" drag) doesn't confuse us
432+ AccountsService.demoEdgesCompleted = ["left", "top"];
434+ var tutorialLeftLongTimer = findInvisibleChild(shell, "tutorialLeftLongTimer");
435+ tutorialLeftLongTimer.interval = 1;
402− // So that we actually switch to dash and launcher hides
403 ApplicationManager.startApplication("gallery-app");
437 ApplicationManager.startApplication("gallery-app");
405− var launcher = findChild(shell, "launcher");
439+ var tutorialLeftLongLoader = findChild(shell, "tutorialLeftLongLoader");
406− var tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
440+ tryCompare(tutorialLeftLongLoader, "shown", true);
408 touchFlick(shell, 0, halfHeight, shell.width, halfHeight);
442 touchFlick(shell, 0, halfHeight, shell.width, halfHeight);
410− tryCompare(tutorialLeftLoader, "shown", false);
444+ tryCompare(tutorialLeftLongLoader, "shown", false);
411− tryCompare(AccountsService, "demoEdgesCompleted", ["left", "left-long"]);
445+ tryCompare(AccountsService, "demoEdgesCompleted", ["left", "top", "left-long"]);
414 function test_tutorialLeftAutoSkipped() {
448 function test_tutorialLeftAutoSkipped() {
@@ -423,6 +457,24 @@ Rectangle {
423 tryCompare(AccountsService, "demoEdgesCompleted", ["left"]);
457 tryCompare(AccountsService, "demoEdgesCompleted", ["left"]);
460+ function test_tutorialLongLeftSwipeDisabled() {
461+ // Test that a long left swipe is disabled until we get to or pass
462+ // the long left tutorial.
463+ var tutorial = findChild(shell, "tutorial");
465+ verify(!tutorial.launcherLongSwipeEnabled);
467+ openTutorialLeftLong();
468+ verify(tutorial.launcherLongSwipeEnabled);
470+ openTutorialRight();
471+ verify(tutorial.launcherLongSwipeEnabled);
473+ AccountsService.demoEdges = false;
474+ tryCompare(tutorial, "running", false);
475+ verify(tutorial.launcherLongSwipeEnabled);
426 function test_tutorialTopEdges() {
478 function test_tutorialTopEdges() {
427 var tutorial = findChild(shell, "tutorial");
479 var tutorial = findChild(shell, "tutorial");
428 var tutorialTop = findChild(tutorial, "tutorialTop");
480 var tutorialTop = findChild(tutorial, "tutorialTop");
@@ -451,7 +503,7 @@ Rectangle {
451 touchFlick(shell, halfWidth, 0, halfWidth, shell.height);
503 touchFlick(shell, halfWidth, 0, halfWidth, shell.height);
453 tryCompare(tutorialTopLoader, "shown", false);
505 tryCompare(tutorialTopLoader, "shown", false);
454− tryCompare(AccountsService, "demoEdgesCompleted", ["left", "left-long", "top"]);
506+ tryCompare(AccountsService, "demoEdgesCompleted", ["left", "top"]);
455 tryCompare(panel.indicators, "fullyOpened", true);
507 tryCompare(panel.indicators, "fullyOpened", true);
@@ -477,12 +529,12 @@ Rectangle {
478 var tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
530 var tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
479 var tutorialTopLoader = findChild(shell, "tutorialTopLoader");
531 var tutorialTopLoader = findChild(shell, "tutorialTopLoader");
480− AccountsService.demoEdgesCompleted = ["left", "left-long"];
532+ AccountsService.demoEdgesCompleted = ["left"];
481 tryCompare(tutorialLeftLoader, "active", false);
533 tryCompare(tutorialLeftLoader, "active", false);
482 verify(!tutorialTopLoader.shown);
534 verify(!tutorialTopLoader.shown);
484 touchFlick(shell, halfWidth, 0, halfWidth, shell.height);
536 touchFlick(shell, halfWidth, 0, halfWidth, shell.height);
485− tryCompare(AccountsService, "demoEdgesCompleted", ["left", "left-long", "top"]);
537+ tryCompare(AccountsService, "demoEdgesCompleted", ["left", "top"]);
488 function test_tutorialRightEdges() {
540 function test_tutorialRightEdges() {
@@ -505,15 +557,11 @@ Rectangle {
507 function test_tutorialRightFinish() {
559 function test_tutorialRightFinish() {
508− var tutorial = findChild(shell, "tutorial");
509− var tutorialRightLoader = findChild(tutorial, "tutorialRightLoader");
510− var stage = findChild(shell, "stage");
512 openTutorialRight();
560 openTutorialRight();
513 touchFlick(shell, shell.width, halfHeight, 0, halfHeight);
561 touchFlick(shell, shell.width, halfHeight, 0, halfHeight);
515− tryCompare(tutorialRightLoader, "shown", false);
516− tryCompare(AccountsService, "demoEdgesCompleted", ["left", "left-long", "top", "right"]);
563+ tryCompare(AccountsService, "demoEdgesCompleted", ["left", "top", "left-long", "right"]);
564+ tryCompare(AccountsService, "demoEdges", false);
519 function test_tutorialRightShortDrag() {
567 function test_tutorialRightShortDrag() {
@@ -537,17 +585,18 @@ Rectangle {
537 // Test that if we exit the top tutorial, we don't immediately
585 // Test that if we exit the top tutorial, we don't immediately
538 // jump into right tutorial.
586 // jump into right tutorial.
539 var tutorialRightLoader = findChild(shell, "tutorialRightLoader");
587 var tutorialRightLoader = findChild(shell, "tutorialRightLoader");
540− var tutorialRightTimer = findInvisibleChild(tutorialRightLoader, "tutorialRightInactivityTimer");
588+ var tutorialRightTimer = findInvisibleChild(tutorialRightLoader, "tutorialRightTimer");
542− tutorialRightTimer.interval = 1;
543 openTutorialTop();
590 openTutorialTop();
544 ApplicationManager.startApplication("gallery-app");
591 ApplicationManager.startApplication("gallery-app");
545 ApplicationManager.startApplication("facebook-webapp");
592 ApplicationManager.startApplication("facebook-webapp");
593+ ApplicationManager.startApplication("camera-app");
546− tryCompare(ApplicationManager, "count", 3);
594+ tryCompare(ApplicationManager, "count", 4);
548− AccountsService.demoEdgesCompleted = ["left", "left-long", "top"];
596+ AccountsService.demoEdgesCompleted = ["left", "top", "left-long"];
549− verify(tutorialRightTimer.running, true);
597+ verify(tutorialRightTimer.running);
550 verify(!tutorialRightLoader.shown);
598 verify(!tutorialRightLoader.shown);
599+ tutorialRightTimer.interval = 1;
551 tryCompare(tutorialRightLoader, "shown", true);
600 tryCompare(tutorialRightLoader, "shown", true);
@@ -555,112 +604,11 @@ Rectangle {
555 // Test that we skip the tutorial if user uses right edge themselves
604 // Test that we skip the tutorial if user uses right edge themselves
557 var tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
606 var tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
558− AccountsService.demoEdgesCompleted = ["left", "left-long"];
607+ AccountsService.demoEdgesCompleted = ["left"];
559 tryCompare(tutorialLeftLoader, "active", false);
608 tryCompare(tutorialLeftLoader, "active", false);
561 touchFlick(shell, shell.width, halfHeight, 0, halfHeight);
610 touchFlick(shell, shell.width, halfHeight, 0, halfHeight);
562− tryCompare(AccountsService, "demoEdgesCompleted", ["left", "left-long", "right"]);
611+ tryCompare(AccountsService, "demoEdgesCompleted", ["left", "right"]);
565− function test_tutorialBottomEdges() {
566− var tutorial = findChild(shell, "tutorial");
567− var tutorialBottom = findChild(tutorial, "tutorialBottom");
568− var tutorialLabel = findChild(tutorialBottom, "tutorialLabel");
569− var launcher = findChild(shell, "launcher");
570− var stage = findChild(shell, "stage");
571− var panel = findChild(shell, "panel");
573− openTutorialBottom();
575− tryCompare(tutorial, "running", true);
576− verify(!tutorial.launcherEnabled);
577− verify(!tutorial.spreadEnabled);
578− verify(!tutorial.panelEnabled);
579− verify(tutorialBottom.shown);
580− verify(!launcher.available);
581− verify(!stage.spreadEnabled);
582− verify(!panel.indicators.available);
583− compare(tutorialLabel.text, "Swipe up for recent calls");
586− function test_tutorialBottomFinish() {
587− var tutorial = findChild(shell, "tutorial");
588− var tutorialBottomLoader = findChild(tutorial, "tutorialBottomLoader");
590− openTutorialBottom();
591− touchFlick(shell, halfWidth, shell.height, halfWidth, halfHeight);
593− tryCompare(tutorialBottomLoader, "shown", false);
594− tryCompare(AccountsService, "demoEdgesCompleted", ["left", "left-long", "top", "right", "bottom-dialer-app"]);
596− // OK, we did one, just confirm that when all are done, we mark whole tutorial as done.
597− verify(AccountsService.demoEdges);
598− AccountsService.demoEdgesCompleted = ["left", "left-long", "top", "right",
599− "bottom-address-book-app",
600− "bottom-com.ubuntu.calculator_calculator",
601− "bottom-dialer-app",
602− "bottom-messaging-app"];
603− verify(!AccountsService.demoEdges);
606− function test_tutorialBottomAppearsBeforeRight() {
607− // Confirm that if bottom edge and right edge would appear on the
608− // the same app open, bottom edge appears first. (this is a lightly
609− // edited version of openTutorialRight)
610− var tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
611− var tutorialRight = findChild(shell, "tutorialRight");
612− var tutorialBottom = findChild(shell, "tutorialBottom");
614− AccountsService.demoEdgesCompleted = ["left", "left-long", "top"];
615− ApplicationManager.startApplication("gallery-app");
616− ApplicationManager.startApplication("dialer-app");
618− tryCompare(tutorialLeftLoader, "active", false);
619− tryCompare(tutorialBottom, "shown", true);
620− tryCompare(tutorialBottom, "opacity", 1);
621− tryCompare(tutorialRight, "visible", false);
624− function test_tutorialBottomOnlyCoversSideStageOnTablet() {
625− loadShell("tablet");
627− var tutorialBottom = findChild(shell, "tutorialBottom");
628− var targetHeight = shell.height - units.gu(4);
629− var mainStageX = units.gu(20);
630− var sideStageX = shell.width - units.gu(20);
632− WindowStateStorage.saveStage("dialer-app", ApplicationInfoInterface.SideStage);
633− openTutorialBottom();
635− touchFlick(shell, mainStageX, shell.height, mainStageX, targetHeight, true, false);
636− compare(tutorialBottom.opacity, 1);
637− touchFlick(shell, mainStageX, shell.height, mainStageX, targetHeight, false, true);
639− touchFlick(shell, sideStageX, shell.height, sideStageX, targetHeight, true, false);
640− verify(tutorialBottom.opacity < 1);
641− touchFlick(shell, sideStageX, shell.height, sideStageX, targetHeight, false, true);
644− function test_tutorialBottomOnlyCoversMainStageOnTablet() {
645− loadShell("tablet");
647− var tutorialBottom = findChild(shell, "tutorialBottom");
648− var targetHeight = shell.height - units.gu(4);
649− var mainStageX = units.gu(20);
650− var sideStageX = shell.width - units.gu(20);
652− WindowStateStorage.saveStage("notes-app", ApplicationInfoInterface.SideStage);
653− ApplicationManager.startApplication("notes-app");
655− openTutorialBottom();
657− touchFlick(shell, sideStageX, shell.height, sideStageX, targetHeight, true, false);
658− compare(tutorialBottom.opacity, 1);
659− touchFlick(shell, sideStageX, shell.height, sideStageX, targetHeight, false, true);
661− touchFlick(shell, mainStageX, shell.height, mainStageX, targetHeight, true, false);
662− verify(tutorialBottom.opacity < 1);
663− touchFlick(shell, mainStageX, shell.height, mainStageX, targetHeight, false, true);
666 function test_activeCallInterruptsTutorial() {
614 function test_activeCallInterruptsTutorial() {
@@ -678,31 +626,6 @@ Rectangle {
678 verify(!tutorialLeft.paused);
626 verify(!tutorialLeft.paused);
681− function test_dialerInterruptionWithNoOverlappingTutorials() {
682− var tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
683− var tutorialBottomLoader = findChild(shell, "tutorialBottomLoader");
684− verify(tutorialLeftLoader.shown);
686− // Start call, hiding left tutorial
687− callManager.foregroundCall = phoneCall;
688− tryCompare(tutorialLeftLoader, "shown", false);
691− ApplicationManager.startApplication("dialer-app");
692− tryCompare(ApplicationManager, "focusedApplicationId", "dialer-app");
693− verify(!tutorialBottomLoader.shown);
695− // Dismiss call, bottom tutorial should appear
696− callManager.foregroundCall = null;
697− tryCompare(tutorialBottomLoader, "shown", true);
698− verify(!tutorialLeftLoader.shown);
700− // Get rid of bottom tutorial, left should now be shown
701− touchFlick(shell, halfWidth, shell.height, halfWidth, halfHeight);
702− tryCompare(tutorialBottomLoader, "shown", false);
703− tryCompare(tutorialLeftLoader, "shown", true);
706 function test_greeterInterruptsTutorial() {
629 function test_greeterInterruptsTutorial() {
707 var tutorialLeft = findChild(shell, "tutorialLeft");
630 var tutorialLeft = findChild(shell, "tutorialLeft");
708 verify(tutorialLeft.shown);
631 verify(tutorialLeft.shown);
@@ -738,7 +661,7 @@ Rectangle {
738 verify(!tutorialRight.isReady);
661 verify(!tutorialRight.isReady);
739 verify(!tutorialRight.shown);
662 verify(!tutorialRight.shown);
740 verify(!tutorialRight.paused);
663 verify(!tutorialRight.paused);
741− compare(AccountsService.demoEdgesCompleted, ["left", "left-long", "top"]);
664+ compare(AccountsService.demoEdgesCompleted, ["left", "top", "left-long"]);
744 function test_desktopOnlyShowsTutorialRight() {
667 function test_desktopOnlyShowsTutorialRight() {
@@ -746,17 +669,22 @@ Rectangle {
747 var tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
670 var tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
748 var tutorialTopLoader = findChild(shell, "tutorialTopLoader");
671 var tutorialTopLoader = findChild(shell, "tutorialTopLoader");
672+ var tutorialLeftLongLoader = findChild(shell, "tutorialLeftLongLoader");
749 var tutorialRightLoader = findChild(shell, "tutorialRightLoader");
673 var tutorialRightLoader = findChild(shell, "tutorialRightLoader");
750− var tutorialBottomLoader = findChild(shell, "tutorialBottomLoader");
751 verify(!tutorialLeftLoader.active);
674 verify(!tutorialLeftLoader.active);
752 verify(!tutorialTopLoader.active);
675 verify(!tutorialTopLoader.active);
676+ verify(!tutorialLeftLongLoader.active);
753 verify(tutorialRightLoader.active);
677 verify(tutorialRightLoader.active);
754− verify(!tutorialBottomLoader.active);
755 compare(AccountsService.demoEdgesCompleted, []);
678 compare(AccountsService.demoEdgesCompleted, []);
680+ var tutorialRightTimer = findInvisibleChild(tutorialRightLoader, "tutorialRightTimer");
681+ tutorialRightTimer.interval = 1;
757 ApplicationManager.startApplication("dialer-app");
683 ApplicationManager.startApplication("dialer-app");
758 ApplicationManager.startApplication("camera-app");
684 ApplicationManager.startApplication("camera-app");
685+ ApplicationManager.startApplication("facebook-webapp");
759 tryCompare(tutorialRightLoader.item, "isReady", true);
686 tryCompare(tutorialRightLoader.item, "isReady", true);
760 tryCompare(tutorialRightLoader, "shown", true);
688 tryCompare(tutorialRightLoader, "shown", true);
@@ -764,8 +692,11 @@ Rectangle {
764 loadShell("desktop");
692 loadShell("desktop");
766 var tutorialRightLoader = findChild(shell, "tutorialRightLoader");
694 var tutorialRightLoader = findChild(shell, "tutorialRightLoader");
695+ var tutorialRightTimer = findInvisibleChild(tutorialRightLoader, "tutorialRightTimer");
696+ tutorialRightTimer.interval = 1;
767 ApplicationManager.startApplication("dialer-app");
697 ApplicationManager.startApplication("dialer-app");
768 ApplicationManager.startApplication("camera-app");
698 ApplicationManager.startApplication("camera-app");
699+ ApplicationManager.startApplication("facebook-webapp");
769 tryCompare(tutorialRightLoader, "shown", true);
700 tryCompare(tutorialRightLoader, "shown", true);
771 var stage = findChild(shell, "stage");
702 var stage = findChild(shell, "stage");
@@ -789,24 +720,60 @@ Rectangle {
789 verify(tutorialLeftLoader.shown);
720 verify(tutorialLeftLoader.shown);
792− function test_oskPreventsTutorial() {
723+ function test_oskDelaysTutorial() {
793− var surface = SurfaceManager.inputMethodSurface;
724+ var tutorial = findChild(shell, "tutorial");
794− var inputMethod = findInvisibleChild(shell, "inputMethod");
725+ verify(!tutorial.delayed);
796− AccountsService.demoEdges = false;
797− surface.setState(Mir.RestoredState);
727+ SurfaceManager.inputMethodSurface.setState(Mir.RestoredState);
798− tryCompare(inputMethod, "state", "shown");
729+ tryCompare(tutorial, "delayed", true);
732+ function test_notificationDelaysTutorial() {
800 var tutorial = findChild(shell, "tutorial");
733 var tutorial = findChild(shell, "tutorial");
801− tryCompare(tutorial, "keyboardVisible", true);
734+ verify(!tutorial.delayed);
803− AccountsService.demoEdges = true;
736+ var notifications = findChild(shell, "notificationList");
804− var tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
737+ notifications.model = mockNotificationsModel;
805− verify(!tutorialLeftLoader.shown);
738+ addNotification(); // placeholder
807− surface.setState(Mir.MinimizedState);
741+ tryCompare(tutorial, "delayed", true);
808− tryCompare(inputMethod, "state", "hidden");
742+ }
809− tryCompare(tutorialLeftLoader, "shown", false);
743+
744+ function test_dialogDelaysTutorial() {
745+ var tutorial = findChild(shell, "tutorial");
746+ verify(!tutorial.delayed);
748+ var dialogs = findChild(shell, "dialogs");
749+ dialogs.showPowerDialog();
751+ verify(tutorial.delayed);
754+ function test_delayedTutorial() {
755+ var tutorial = findChild(shell, "tutorial");
756+ var tutorialTop = findChild(tutorial, "tutorialTop");
757+ var tutorialTopTimer = findChild(tutorialTop, "tutorialTopTimer");
759+ // Get top tutorial ready
760+ AccountsService.demoEdgesCompleted = ["left"];
761+ verify(tutorialTop.isReady);
762+ verify(tutorialTopTimer.running);
764+ // Confirm that we become unready when delayed, but timer still goes
765+ tutorial.delayed = true;
766+ verify(!tutorialTop.isReady);
767+ verify(tutorialTopTimer.running);
769+ // Confirm that we don't open the tutorial when delayed
770+ tutorialTopTimer.interval = 1;
772+ verify(!tutorialTop.shown);
774+ // Confirm we go back to normal when undelayed
775+ tutorial.delayed = false;
776+ tryCompare(tutorialTop, "shown", true);
812 function test_accountsServiceSettings() {
779 function test_accountsServiceSettings() {
@@ -818,7 +785,8 @@ Rectangle {
819 AccountsService.demoEdges = true;
786 AccountsService.demoEdges = true;
820 tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
787 tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
821− tryCompare(tutorialLeftLoader, "shown", true);
788+ var tutorialLeftTimer = findChild(tutorialLeftLoader, "tutorialLeftTimer");
789+ verify(tutorialLeftTimer.running);