on xenial help sign in
added test for load stage after close
c222a6aNick Dedekind
tests/qmltests/Stages/tst_TabletStage.qml+37−5
@@ -561,13 +561,13 @@ Rectangle {
561
561
562 function test_applicationSavesLastStage_data() {
562 function test_applicationSavesLastStage_data() {
563 return [
563 return [
564− { tag: "MainStage", stage: ApplicationInfoInterface.MainStage},
564+ { tag: "MainStage", fromStage: ApplicationInfoInterface.MainStage, toStage: ApplicationInfoInterface.SideStage },
565− { tag: "SideStage", stage: ApplicationInfoInterface.SideStage},
565+ { tag: "SideStage", fromStage: ApplicationInfoInterface.SideStage, toStage: ApplicationInfoInterface.MainStage },
566 ];
566 ];
567 }
567 }
568
568
569 function test_applicationSavesLastStage(data) {
569 function test_applicationSavesLastStage(data) {
570− WindowStateStorage.saveStage(webbrowserCheckBox.appId, data.stage);
570+ WindowStateStorage.saveStage(webbrowserCheckBox.appId, data.fromStage);
571 stageSaver.clear();
571 stageSaver.clear();
572
572
573 var stagesPriv = findInvisibleChild(tabletStage, "stagesPriv");
573 var stagesPriv = findInvisibleChild(tabletStage, "stagesPriv");
@@ -580,11 +580,15 @@ Rectangle {
580 webbrowserCheckBox.checked = true;
580 webbrowserCheckBox.checked = true;
581 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
581 waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
582
582
583− webbrowserCheckBox.checked = false;
583+ if (data.toStage === ApplicationInfoInterface.SideStage) {
584+ dragToSideStage(webbrowserSurfaceId);
585+ } else {
586+ dragToMainStage(webbrowserSurfaceId);
587+ }
584
588
585 tryCompare(stageSaver, "count", 1);
589 tryCompare(stageSaver, "count", 1);
586 compare(stageSaver.signalArguments[0][0], "webbrowser-app")
590 compare(stageSaver.signalArguments[0][0], "webbrowser-app")
587− compare(stageSaver.signalArguments[0][1], data.stage)
591+ compare(stageSaver.signalArguments[0][1], data.toStage)
588 }
592 }
589
593
590 function test_loadSideStageByDraggingFromMainStage() {
594 function test_loadSideStageByDraggingFromMainStage() {
@@ -790,5 +794,33 @@ Rectangle {
790 tabletStage.shellOrientation = Qt.LandscapeOrientation;
794 tabletStage.shellOrientation = Qt.LandscapeOrientation;
791 tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
795 tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
792 }
796 }
797+
798+ function test_restoreSavedStageOnCloseReopen() {
799+ var webbrowserSurfaceId = topSurfaceList.nextId;
800+ webbrowserCheckBox.checked = true;
801+ waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
802+
803+ var appDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
804+ verify(appDelegate);
805+
806+ dragToSideStage(webbrowserSurfaceId);
807+ // will be in sidestage now
808+ tabletStage.shellOrientation = Qt.PortraitOrientation;
809+ tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
810+
811+ webbrowserCheckBox.checked = false;
812+ tryCompare(ApplicationManager, "count", 1);
813+
814+ // back to landscape
815+ tabletStage.shellOrientation = Qt.LandscapeOrientation;
816+
817+ webbrowserSurfaceId = topSurfaceList.nextId;
818+ webbrowserCheckBox.checked = true;
819+ waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
820+
821+ appDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
822+ verify(appDelegate);
823+ tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
824+ }
793 }
825 }
794}
826}