@@ -242,6 +242,48 @@ Rectangle {
242 appWindow.width * 0.1, -appWindow.height / 2);
242 appWindow.width * 0.1, -appWindow.height / 2);
245+ function dragToSideStage(surfaceId) {
246+ sideStage.showNow();
247+ var targetAppDelegate = findChild(tabletStage, "spreadDelegate_" + surfaceId);
249+ var pos = tabletStage.width - sideStage.width - (tabletStage.width - sideStage.width) / 2;
250+ var end_pos = tabletStage.width - sideStage.width / 2;
252+ multiTouchDragUntil([0,1,2],
255+ tabletStage.height / 2,
260+ return sideStage.shown && !sideStage.showAnimation.running &&
263+ tryCompare(targetAppDelegate, "stage", ApplicationInfoInterface.SideStage);
266+ function dragToMainStage(surfaceId) {
267+ sideStage.showNow();
268+ var targetAppDelegate = findChild(tabletStage, "spreadDelegate_" + surfaceId);
269+ verify(targetAppDelegate);
271+ var pos = tabletStage.width - sideStage.width / 2;
272+ var end_pos = tabletStage.width - sideStage.width - (tabletStage.width - sideStage.width) / 2;
274+ multiTouchDragUntil([0,1,2],
277+ tabletStage.height / 2,
282+ return pos <= end_pos;
284+ tryCompare(targetAppDelegate, "stage", ApplicationInfoInterface.MainStage);
245 function test_tappingSwitchesFocusBetweenStages() {
287 function test_tappingSwitchesFocusBetweenStages() {
246 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
288 WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
@@ -555,20 +597,7 @@ Rectangle {
555 verify(appDelegate);
597 verify(appDelegate);
556 compare(appDelegate.stage, ApplicationInfoInterface.MainStage);
598 compare(appDelegate.stage, ApplicationInfoInterface.MainStage);
558− var pos = tabletStage.width - sideStage.width - (tabletStage.width - sideStage.width) / 2;
600+ dragToSideStage(webbrowserSurfaceId);
559− var end_pos = tabletStage.width - sideStage.width / 2;
561− multiTouchDragUntil([0,1,2],
564− tabletStage.height / 2,
569− return sideStage.shown && !sideStage.showAnimation.running &&
573 tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
602 tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
@@ -584,19 +613,7 @@ Rectangle {
584 verify(appDelegate);
613 verify(appDelegate);
585 compare(appDelegate.stage, ApplicationInfoInterface.SideStage);
614 compare(appDelegate.stage, ApplicationInfoInterface.SideStage);
587− var pos = tabletStage.width - sideStage.width / 2;
616+ dragToMainStage(webbrowserSurfaceId);
588− var end_pos = tabletStage.width - sideStage.width - (tabletStage.width - sideStage.width) / 2;
590− multiTouchDragUntil([0,1,2],
593− tabletStage.height / 2,
598− return pos <= end_pos;
601 tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
618 tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
@@ -737,22 +754,41 @@ Rectangle {
738 tryCompare(appDelegate.surface, "activeFocus", true);
755 tryCompare(appDelegate.surface, "activeFocus", true);
740− var pos = tabletStage.width - sideStage.width - (tabletStage.width - sideStage.width) / 2;
757+ dragToSideStage(webbrowserSurfaceId);
741− var end_pos = tabletStage.width - sideStage.width / 2;
743− multiTouchDragUntil([0,1,2],
746− tabletStage.height / 2,
751− return sideStage.shown && !sideStage.showAnimation.running &&
755 tryCompare(appDelegate.surface, "activeFocus", true);
759 tryCompare(appDelegate.surface, "activeFocus", true);
762+ function test_switchStageOnRotation() {
763+ WindowStateStorage.saveStage(webbrowserCheckBox.appId, ApplicationInfoInterface.SideStage)
764+ var webbrowserSurfaceId = topSurfaceList.nextId;
765+ webbrowserCheckBox.checked = true;
766+ waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
768+ var appDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
769+ verify(appDelegate);
770+ compare(appDelegate.stage, ApplicationInfoInterface.SideStage);
772+ tabletStage.shellOrientation = Qt.PortraitOrientation;
773+ tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
776+ function test_restoreOriginalStageOnRotation() {
777+ var webbrowserSurfaceId = topSurfaceList.nextId;
778+ webbrowserCheckBox.checked = true;
779+ waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
781+ var appDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
782+ verify(appDelegate);
784+ dragToSideStage(webbrowserSurfaceId);
786+ // will be in sidestage now
787+ tabletStage.shellOrientation = Qt.PortraitOrientation;
788+ tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
790+ tabletStage.shellOrientation = Qt.LandscapeOrientation;
791+ tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);