@@ -561,13 +561,13 @@ Rectangle {
562 function test_applicationSavesLastStage_data() {
562 function test_applicationSavesLastStage_data() {
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 },
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();
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);
583− webbrowserCheckBox.checked = false;
583+ if (data.toStage === ApplicationInfoInterface.SideStage) {
584+ dragToSideStage(webbrowserSurfaceId);
586+ dragToMainStage(webbrowserSurfaceId);
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)
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);
798+ function test_restoreSavedStageOnCloseReopen() {
799+ var webbrowserSurfaceId = topSurfaceList.nextId;
800+ webbrowserCheckBox.checked = true;
801+ waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
803+ var appDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
804+ verify(appDelegate);
806+ dragToSideStage(webbrowserSurfaceId);
807+ // will be in sidestage now
808+ tabletStage.shellOrientation = Qt.PortraitOrientation;
809+ tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
811+ webbrowserCheckBox.checked = false;
812+ tryCompare(ApplicationManager, "count", 1);
814+ // back to landscape
815+ tabletStage.shellOrientation = Qt.LandscapeOrientation;
817+ webbrowserSurfaceId = topSurfaceList.nextId;
818+ webbrowserCheckBox.checked = true;
819+ waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
821+ appDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
822+ verify(appDelegate);
823+ tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);