on xenial help sign in
Robustify tutorial qmltests
04e7bbbMichael Terry
tests/qmltests/Tutorial/tst_Tutorial.qml+42−44
@@ -353,12 +353,12 @@ Rectangle {
353
353
354 function test_tutorialLeftFinish() {
354 function test_tutorialLeftFinish() {
355 var tutorial = findChild(shell, "tutorial");
355 var tutorial = findChild(shell, "tutorial");
356− var tutorialLeft = findChild(tutorial, "tutorialLeft");
356+ var tutorialLeftLoader = findChild(tutorial, "tutorialLeftLoader");
357 var launcher = findChild(shell, "launcher");
357 var launcher = findChild(shell, "launcher");
358
358
359 touchFlick(shell, 0, halfHeight, halfWidth, halfHeight);
359 touchFlick(shell, 0, halfHeight, halfWidth, halfHeight);
360
360
361− tryCompare(tutorialLeft, "shown", false);
361+ tryCompare(tutorialLeftLoader, "shown", false);
362 tryCompare(AccountsService, "demoEdgesCompleted", ["left"]);
362 tryCompare(AccountsService, "demoEdgesCompleted", ["left"]);
363 tryCompare(launcher, "state", "visible");
363 tryCompare(launcher, "state", "visible");
364 }
364 }
@@ -368,6 +368,7 @@ Rectangle {
368 // letting go (i.e. not triggering the "progress" property of
368 // letting go (i.e. not triggering the "progress" property of
369 // Launcher).
369 // Launcher).
370 var tutorialLeft = findChild(shell, "tutorialLeft");
370 var tutorialLeft = findChild(shell, "tutorialLeft");
371+ var tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
371 var launcher = findChild(shell, "launcher");
372 var launcher = findChild(shell, "launcher");
372
373
373 // Confirm fade during drag
374 // Confirm fade during drag
@@ -384,13 +385,13 @@ Rectangle {
384 // out much.
385 // out much.
385 touchFlick(shell, 0, halfHeight, launcher.panelWidth * 0.4, halfHeight);
386 touchFlick(shell, 0, halfHeight, launcher.panelWidth * 0.4, halfHeight);
386 tryCompare(launcher, "state", ""); // should remain hidden
387 tryCompare(launcher, "state", ""); // should remain hidden
387− tryCompare(tutorialLeft, "shown", true); // and we should still be on left
388+ tryCompare(tutorialLeftLoader, "shown", true); // and we should still be on left
388
389
389
390
390 // Now drag out but not past launcher itself
391 // Now drag out but not past launcher itself
391 touchFlick(shell, 0, halfHeight, launcher.panelWidth * 0.9, halfHeight);
392 touchFlick(shell, 0, halfHeight, launcher.panelWidth * 0.9, halfHeight);
392
393
393− tryCompare(tutorialLeft, "shown", false);
394+ tryCompare(tutorialLeftLoader, "shown", false);
394 tryCompare(AccountsService, "demoEdgesCompleted", ["left"]);
395 tryCompare(AccountsService, "demoEdgesCompleted", ["left"]);
395 tryCompare(launcher, "state", "visible");
396 tryCompare(launcher, "state", "visible");
396 }
397 }
@@ -402,12 +403,11 @@ Rectangle {
402 ApplicationManager.startApplication("gallery-app");
403 ApplicationManager.startApplication("gallery-app");
403
404
404 var launcher = findChild(shell, "launcher");
405 var launcher = findChild(shell, "launcher");
405− var tutorialLeft = findChild(shell, "tutorialLeftLoader");
406+ var tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
406− verify(tutorialLeft);
407
407
408 touchFlick(shell, 0, halfHeight, shell.width, halfHeight);
408 touchFlick(shell, 0, halfHeight, shell.width, halfHeight);
409
409
410− tryCompare(tutorialLeft, "shown", false);
410+ tryCompare(tutorialLeftLoader, "shown", false);
411 tryCompare(AccountsService, "demoEdgesCompleted", ["left", "left-long"]);
411 tryCompare(AccountsService, "demoEdgesCompleted", ["left", "left-long"]);
412 }
412 }
413
413
@@ -444,13 +444,13 @@ Rectangle {
444
444
445 function test_tutorialTopFinish() {
445 function test_tutorialTopFinish() {
446 var tutorial = findChild(shell, "tutorial");
446 var tutorial = findChild(shell, "tutorial");
447− var tutorialTop = findChild(tutorial, "tutorialTop");
447+ var tutorialTopLoader = findChild(tutorial, "tutorialTopLoader");
448 var panel = findChild(shell, "panel");
448 var panel = findChild(shell, "panel");
449
449
450 openTutorialTop();
450 openTutorialTop();
451 touchFlick(shell, halfWidth, 0, halfWidth, shell.height);
451 touchFlick(shell, halfWidth, 0, halfWidth, shell.height);
452
452
453− tryCompare(tutorialTop, "shown", false);
453+ tryCompare(tutorialTopLoader, "shown", false);
454 tryCompare(AccountsService, "demoEdgesCompleted", ["left", "left-long", "top"]);
454 tryCompare(AccountsService, "demoEdgesCompleted", ["left", "left-long", "top"]);
455 tryCompare(panel.indicators, "fullyOpened", true);
455 tryCompare(panel.indicators, "fullyOpened", true);
456 }
456 }
@@ -476,10 +476,10 @@ Rectangle {
476 // Test that we skip the tutorial if user uses top edge themselves
476 // Test that we skip the tutorial if user uses top edge themselves
477
477
478 var tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
478 var tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
479− var tutorialTop = findChild(shell, "tutorialTop");
479+ var tutorialTopLoader = findChild(shell, "tutorialTopLoader");
480 AccountsService.demoEdgesCompleted = ["left", "left-long"];
480 AccountsService.demoEdgesCompleted = ["left", "left-long"];
481 tryCompare(tutorialLeftLoader, "active", false);
481 tryCompare(tutorialLeftLoader, "active", false);
482− verify(!tutorialTop.shown);
482+ verify(!tutorialTopLoader.shown);
483
483
484 touchFlick(shell, halfWidth, 0, halfWidth, shell.height);
484 touchFlick(shell, halfWidth, 0, halfWidth, shell.height);
485 tryCompare(AccountsService, "demoEdgesCompleted", ["left", "left-long", "top"]);
485 tryCompare(AccountsService, "demoEdgesCompleted", ["left", "left-long", "top"]);
@@ -506,13 +506,13 @@ Rectangle {
506
506
507 function test_tutorialRightFinish() {
507 function test_tutorialRightFinish() {
508 var tutorial = findChild(shell, "tutorial");
508 var tutorial = findChild(shell, "tutorial");
509− var tutorialRight = findChild(tutorial, "tutorialRight");
509+ var tutorialRightLoader = findChild(tutorial, "tutorialRightLoader");
510 var stage = findChild(shell, "stage");
510 var stage = findChild(shell, "stage");
511
511
512 openTutorialRight();
512 openTutorialRight();
513 touchFlick(shell, shell.width, halfHeight, 0, halfHeight);
513 touchFlick(shell, shell.width, halfHeight, 0, halfHeight);
514
514
515− tryCompare(tutorialRight, "shown", false);
515+ tryCompare(tutorialRightLoader, "shown", false);
516 tryCompare(AccountsService, "demoEdgesCompleted", ["left", "left-long", "top", "right"]);
516 tryCompare(AccountsService, "demoEdgesCompleted", ["left", "left-long", "top", "right"]);
517 }
517 }
518
518
@@ -536,8 +536,8 @@ Rectangle {
536 function test_tutorialRightDelay() {
536 function test_tutorialRightDelay() {
537 // Test that if we exit the top tutorial, we don't immediately
537 // Test that if we exit the top tutorial, we don't immediately
538 // jump into right tutorial.
538 // jump into right tutorial.
539− var tutorialRight = findChild(shell, "tutorialRight");
539+ var tutorialRightLoader = findChild(shell, "tutorialRightLoader");
540− var tutorialRightTimer = findInvisibleChild(tutorialRight, "tutorialRightInactivityTimer");
540+ var tutorialRightTimer = findInvisibleChild(tutorialRightLoader, "tutorialRightInactivityTimer");
541
541
542 tutorialRightTimer.interval = 1;
542 tutorialRightTimer.interval = 1;
543 openTutorialTop();
543 openTutorialTop();
@@ -547,8 +547,8 @@ Rectangle {
547
547
548 AccountsService.demoEdgesCompleted = ["left", "left-long", "top"];
548 AccountsService.demoEdgesCompleted = ["left", "left-long", "top"];
549 verify(tutorialRightTimer.running, true);
549 verify(tutorialRightTimer.running, true);
550− verify(!tutorialRight.shown);
550+ verify(!tutorialRightLoader.shown);
551− tryCompare(tutorialRight, "shown", true);
551+ tryCompare(tutorialRightLoader, "shown", true);
552 }
552 }
553
553
554 function test_tutorialRightAutoSkipped() {
554 function test_tutorialRightAutoSkipped() {
@@ -585,12 +585,12 @@ Rectangle {
585
585
586 function test_tutorialBottomFinish() {
586 function test_tutorialBottomFinish() {
587 var tutorial = findChild(shell, "tutorial");
587 var tutorial = findChild(shell, "tutorial");
588− var tutorialBottom = findChild(tutorial, "tutorialBottom");
588+ var tutorialBottomLoader = findChild(tutorial, "tutorialBottomLoader");
589
589
590 openTutorialBottom();
590 openTutorialBottom();
591 touchFlick(shell, halfWidth, shell.height, halfWidth, halfHeight);
591 touchFlick(shell, halfWidth, shell.height, halfWidth, halfHeight);
592
592
593− tryCompare(tutorialBottom, "shown", false);
593+ tryCompare(tutorialBottomLoader, "shown", false);
594 tryCompare(AccountsService, "demoEdgesCompleted", ["left", "left-long", "top", "right", "bottom-dialer-app"]);
594 tryCompare(AccountsService, "demoEdgesCompleted", ["left", "left-long", "top", "right", "bottom-dialer-app"]);
595
595
596 // OK, we did one, just confirm that when all are done, we mark whole tutorial as done.
596 // OK, we did one, just confirm that when all are done, we mark whole tutorial as done.
@@ -679,28 +679,28 @@ Rectangle {
679 }
679 }
680
680
681 function test_dialerInterruptionWithNoOverlappingTutorials() {
681 function test_dialerInterruptionWithNoOverlappingTutorials() {
682− var tutorialLeft = findChild(shell, "tutorialLeft");
682+ var tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
683− var tutorialBottom = findChild(shell, "tutorialBottom");
683+ var tutorialBottomLoader = findChild(shell, "tutorialBottomLoader");
684− verify(tutorialLeft.shown);
684+ verify(tutorialLeftLoader.shown);
685
685
686 // Start call, hiding left tutorial
686 // Start call, hiding left tutorial
687 callManager.foregroundCall = phoneCall;
687 callManager.foregroundCall = phoneCall;
688− tryCompare(tutorialLeft, "shown", false);
688+ tryCompare(tutorialLeftLoader, "shown", false);
689
689
690 // Start dialer app
690 // Start dialer app
691 ApplicationManager.startApplication("dialer-app");
691 ApplicationManager.startApplication("dialer-app");
692 tryCompare(ApplicationManager, "focusedApplicationId", "dialer-app");
692 tryCompare(ApplicationManager, "focusedApplicationId", "dialer-app");
693− verify(!tutorialBottom.shown);
693+ verify(!tutorialBottomLoader.shown);
694
694
695 // Dismiss call, bottom tutorial should appear
695 // Dismiss call, bottom tutorial should appear
696 callManager.foregroundCall = null;
696 callManager.foregroundCall = null;
697− tryCompare(tutorialBottom, "shown", true);
697+ tryCompare(tutorialBottomLoader, "shown", true);
698− verify(!tutorialLeft.shown);
698+ verify(!tutorialLeftLoader.shown);
699
699
700 // Get rid of bottom tutorial, left should now be shown
700 // Get rid of bottom tutorial, left should now be shown
701 touchFlick(shell, halfWidth, shell.height, halfWidth, halfHeight);
701 touchFlick(shell, halfWidth, shell.height, halfWidth, halfHeight);
702− tryCompare(tutorialBottom, "shown", false);
702+ tryCompare(tutorialBottomLoader, "shown", false);
703− tryCompare(tutorialLeft, "shown", true);
703+ tryCompare(tutorialLeftLoader, "shown", true);
704 }
704 }
705
705
706 function test_greeterInterruptsTutorial() {
706 function test_greeterInterruptsTutorial() {
@@ -763,22 +763,22 @@ Rectangle {
763 function test_desktopTutorialRightFinish() {
763 function test_desktopTutorialRightFinish() {
764 loadShell("desktop");
764 loadShell("desktop");
765
765
766− var tutorialRight = findChild(shell, "tutorialRight");
766+ var tutorialRightLoader = findChild(shell, "tutorialRightLoader");
767 ApplicationManager.startApplication("dialer-app");
767 ApplicationManager.startApplication("dialer-app");
768 ApplicationManager.startApplication("camera-app");
768 ApplicationManager.startApplication("camera-app");
769− tryCompare(tutorialRight, "shown", true);
769+ tryCompare(tutorialRightLoader, "shown", true);
770
770
771 var stage = findChild(shell, "stage");
771 var stage = findChild(shell, "stage");
772 mouseMove(shell, shell.width, shell.height / 2);
772 mouseMove(shell, shell.width, shell.height / 2);
773 stage.pushRightEdge(units.gu(8));
773 stage.pushRightEdge(units.gu(8));
774− tryCompare(tutorialRight, "shown", false);
774+ tryCompare(tutorialRightLoader, "shown", false);
775
775
776 tryCompare(AccountsService, "demoEdges", false);
776 tryCompare(AccountsService, "demoEdges", false);
777 }
777 }
778
778
779 function test_oskDoesNotHideTutorial() {
779 function test_oskDoesNotHideTutorial() {
780− var tutorialLeft = findChild(shell, "tutorialLeft");
780+ var tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
781− verify(tutorialLeft.shown);
781+ verify(tutorialLeftLoader.shown);
782
782
783 var surface = SurfaceManager.inputMethodSurface;
783 var surface = SurfaceManager.inputMethodSurface;
784 surface.setState(Mir.RestoredState);
784 surface.setState(Mir.RestoredState);
@@ -786,7 +786,7 @@ Rectangle {
786 var inputMethod = findInvisibleChild(shell, "inputMethod");
786 var inputMethod = findInvisibleChild(shell, "inputMethod");
787 tryCompare(inputMethod, "state", "shown");
787 tryCompare(inputMethod, "state", "shown");
788
788
789− verify(tutorialLeft.shown);
789+ verify(tutorialLeftLoader.shown);
790 }
790 }
791
791
792 function test_oskPreventsTutorial() {
792 function test_oskPreventsTutorial() {
@@ -801,26 +801,24 @@ Rectangle {
801 tryCompare(tutorial, "keyboardVisible", true);
801 tryCompare(tutorial, "keyboardVisible", true);
802
802
803 AccountsService.demoEdges = true;
803 AccountsService.demoEdges = true;
804− var tutorialLeft = findChild(shell, "tutorialLeft");
804+ var tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
805− verify(!tutorialLeft.shown);
805+ verify(!tutorialLeftLoader.shown);
806
806
807 surface.setState(Mir.MinimizedState);
807 surface.setState(Mir.MinimizedState);
808 tryCompare(inputMethod, "state", "hidden");
808 tryCompare(inputMethod, "state", "hidden");
809− tryCompare(tutorialLeft, "shown", false);
809+ tryCompare(tutorialLeftLoader, "shown", false);
810 }
810 }
811
811
812 function test_accountsServiceSettings() {
812 function test_accountsServiceSettings() {
813− var tutorialLeft = findChild(shell, "tutorialLeft");
813+ var tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
814− verify(tutorialLeft != null);
814+ verify(tutorialLeftLoader.shown);
815− verify(tutorialLeft.shown);
816
815
817 AccountsService.demoEdges = false;
816 AccountsService.demoEdges = false;
818− verify(findChild(shell, "tutorialLeft") == null);
817+ verify(findChild(shell, "tutorialLeftLoader") == null);
819
818
820 AccountsService.demoEdges = true;
819 AccountsService.demoEdges = true;
821− tutorialLeft = findChild(shell, "tutorialLeft");
820+ tutorialLeftLoader = findChild(shell, "tutorialLeftLoader");
822− verify(tutorialLeft != null);
823− tryCompare(tutorialLeft, "shown", true);
821+ tryCompare(tutorialLeftLoader, "shown", true);
824 }
822 }
825 }
823 }
826}
824}