242
242
appWindow.width * 0.1, -appWindow.height / 2);
245
function dragToSideStage(surfaceId) {
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) {
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
287
function test_tappingSwitchesFocusBetweenStages() {
246
288
WindowStateStorage.saveStage(dialerCheckBox.appId, ApplicationInfoInterface.SideStage)
493
535
function() { return sideStage.shown; });
496
function test_applicationLoadsInCorrectStage_data() {
538
function test_applicationLoadsInDefaultStage_data() {
540
{ tag: "MainStage", appId: "webbrowser-app", mainStageAppId: "webbrowser-app", sideStageAppId: "" },
541
{ tag: "SideStage", appId: "dialer-app", mainStageAppId: "unity8-dash", sideStageAppId: "dialer-app" },
545
function test_applicationLoadsInDefaultStage(data) {
546
var stagesPriv = findInvisibleChild(tabletStage, "stagesPriv");
549
tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
550
tryCompare(stagesPriv, "sideStageAppId", "");
552
var appSurfaceId = topSurfaceList.nextId;
553
var app = ApplicationManager.startApplication(data.appId);
554
waitUntilAppSurfaceShowsUp(appSurfaceId);
556
tryCompare(stagesPriv, "mainStageAppId", data.mainStageAppId);
557
tryCompare(stagesPriv, "sideStageAppId", data.sideStageAppId);
560
function test_applicationLoadsInSavedStage_data() {
498
562
{ tag: "MainStage", stage: ApplicationInfoInterface.MainStage, mainStageAppId: "webbrowser-app", sideStageAppId: ""},
499
563
{ tag: "SideStage", stage: ApplicationInfoInterface.SideStage, mainStageAppId: "unity8-dash", sideStageAppId: "webbrowser-app" },
503
function test_applicationLoadsInCorrectStage(data) {
567
function test_applicationLoadsInSavedStage(data) {
504
568
WindowStateStorage.saveStage(webbrowserCheckBox.appId, data.stage)
506
570
var stagesPriv = findInvisibleChild(tabletStage, "stagesPriv");
520
584
function test_applicationSavesLastStage_data() {
522
{ tag: "MainStage", stage: ApplicationInfoInterface.MainStage},
523
{ tag: "SideStage", stage: ApplicationInfoInterface.SideStage},
586
{ tag: "MainStage", fromStage: ApplicationInfoInterface.MainStage, toStage: ApplicationInfoInterface.SideStage },
587
{ tag: "SideStage", fromStage: ApplicationInfoInterface.SideStage, toStage: ApplicationInfoInterface.MainStage },
527
591
function test_applicationSavesLastStage(data) {
528
WindowStateStorage.saveStage(webbrowserCheckBox.appId, data.stage);
592
WindowStateStorage.saveStage(webbrowserCheckBox.appId, data.fromStage);
529
593
stageSaver.clear();
531
595
var stagesPriv = findInvisibleChild(tabletStage, "stagesPriv");
538
602
webbrowserCheckBox.checked = true;
539
603
waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
541
webbrowserCheckBox.checked = false;
605
if (data.toStage === ApplicationInfoInterface.SideStage) {
606
dragToSideStage(webbrowserSurfaceId);
608
dragToMainStage(webbrowserSurfaceId);
543
611
tryCompare(stageSaver, "count", 1);
544
612
compare(stageSaver.signalArguments[0][0], "webbrowser-app")
545
compare(stageSaver.signalArguments[0][1], data.stage)
613
compare(stageSaver.signalArguments[0][1], data.toStage)
548
616
function test_loadSideStageByDraggingFromMainStage() {
555
623
verify(appDelegate);
556
624
compare(appDelegate.stage, ApplicationInfoInterface.MainStage);
558
var pos = tabletStage.width - sideStage.width - (tabletStage.width - sideStage.width) / 2;
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 &&
626
dragToSideStage(webbrowserSurfaceId);
628
var spreadView = findChild(tabletStageLoader, "spreadView")
629
tryCompare(spreadView, "surfaceDragging", false);
573
630
tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
584
641
verify(appDelegate);
585
642
compare(appDelegate.stage, ApplicationInfoInterface.SideStage);
587
var pos = tabletStage.width - sideStage.width / 2;
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;
644
dragToMainStage(webbrowserSurfaceId);
646
var spreadView = findChild(tabletStageLoader, "spreadView")
647
tryCompare(spreadView, "surfaceDragging", false);
601
648
tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
738
785
tryCompare(appDelegate.surface, "activeFocus", true);
787
dragToSideStage(webbrowserSurfaceId);
789
var spreadView = findChild(tabletStageLoader, "spreadView")
790
tryCompare(spreadView, "surfaceDragging", false);
791
tryCompare(appDelegate.surface, "activeFocus", true);
794
function test_dashDoesNotDragToSidestage() {
796
compare(topSurfaceList.applicationAt(0).appId, "unity8-dash");
797
var dashSurfaceId = topSurfaceList.idAt(0);
799
var appDelegate = findChild(tabletStage, "spreadDelegate_" + dashSurfaceId);
801
compare(appDelegate.stage, ApplicationInfoInterface.MainStage);
740
803
var pos = tabletStage.width - sideStage.width - (tabletStage.width - sideStage.width) / 2;
741
804
var end_pos = tabletStage.width - sideStage.width / 2;
755
tryCompare(appDelegate.surface, "activeFocus", true);
818
var spreadView = findChild(tabletStageLoader, "spreadView")
819
tryCompare(spreadView, "surfaceDragging", false);
820
tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
823
function test_switchStageOnRotation() {
824
WindowStateStorage.saveStage(webbrowserCheckBox.appId, ApplicationInfoInterface.SideStage)
825
var webbrowserSurfaceId = topSurfaceList.nextId;
826
webbrowserCheckBox.checked = true;
827
waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
829
var appDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
831
compare(appDelegate.stage, ApplicationInfoInterface.SideStage);
833
tabletStage.shellOrientation = Qt.PortraitOrientation;
834
tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
837
function test_restoreOriginalStageOnRotation() {
838
var webbrowserSurfaceId = topSurfaceList.nextId;
839
webbrowserCheckBox.checked = true;
840
waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
842
var appDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
845
dragToSideStage(webbrowserSurfaceId);
847
// will be in sidestage now
848
tabletStage.shellOrientation = Qt.PortraitOrientation;
849
tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
851
tabletStage.shellOrientation = Qt.LandscapeOrientation;
852
tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
855
function test_restoreSavedStageOnCloseReopen() {
856
var webbrowserSurfaceId = topSurfaceList.nextId;
857
webbrowserCheckBox.checked = true;
858
waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
860
var appDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
863
dragToSideStage(webbrowserSurfaceId);
864
// will be in sidestage now
865
tabletStage.shellOrientation = Qt.PortraitOrientation;
866
tryCompare(appDelegate, "stage", ApplicationInfoInterface.MainStage);
868
webbrowserCheckBox.checked = false;
869
tryCompare(ApplicationManager, "count", 1);
872
tabletStage.shellOrientation = Qt.LandscapeOrientation;
874
webbrowserSurfaceId = topSurfaceList.nextId;
875
webbrowserCheckBox.checked = true;
876
waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
878
appDelegate = findChild(tabletStage, "spreadDelegate_" + webbrowserSurfaceId);
880
tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);