on xenial help sign in
fixed stage not saving
102194aNick Dedekind
qml/Stages/TabletStage.qml+3−3
@@ -752,7 +752,7 @@ AbstractStage {
752
752
753 readonly property bool wantsMainStage: stage == ApplicationInfoInterface.MainStage
753 readonly property bool wantsMainStage: stage == ApplicationInfoInterface.MainStage
754
754
755− readonly property bool isDash: model.application.appId == "unity8-dash"
755+ readonly property bool isDash: application.appId == "unity8-dash"
756
756
757 onFocusChanged: {
757 onFocusChanged: {
758 if (focus && !spreadRepeater.startingUp) {
758 if (focus && !spreadRepeater.startingUp) {
@@ -768,7 +768,7 @@ AbstractStage {
768 onFocusRequested: spreadTile.focus = true;
768 onFocusRequested: spreadTile.focus = true;
769 }
769 }
770 Connections {
770 Connections {
771− target: model.application
771+ target: spreadTile.application
772 onFocusRequested: {
772 onFocusRequested: {
773 if (!model.surface) {
773 if (!model.surface) {
774 // when an app has no surfaces, we assume there's only one entry representing it:
774 // when an app has no surfaces, we assume there's only one entry representing it:
@@ -844,7 +844,7 @@ AbstractStage {
844 _constructing = false;
844 _constructing = false;
845 }
845 }
846 Component.onDestruction: {
846 Component.onDestruction: {
847− WindowStateStorage.saveStage(model.application.appId, stage);
847+ WindowStateStorage.saveStage(application.appId, stage);
848 }
848 }
849
849
850 function refreshStage() {
850 function refreshStage() {
tests/mocks/Utils/windowstatestorage.cpp+1
@@ -50,6 +50,7 @@ QRect WindowStateStorage::getGeometry(const QString &windowId, const QRect &defa
50void WindowStateStorage::saveStage(const QString &appId, int stage)
50void WindowStateStorage::saveStage(const QString &appId, int stage)
51{
51{
52 m_stage[appId] = stage;
52 m_stage[appId] = stage;
53+ Q_EMIT stageSaved(appId, stage);
53}
54}
54
55
55int WindowStateStorage::getStage(const QString &appId) const
56int WindowStateStorage::getStage(const QString &appId) const
tests/mocks/Utils/windowstatestorage.h+3
@@ -45,6 +45,9 @@ public:
45Q_SIGNALS:
45Q_SIGNALS:
46 void geometryChanged(const QVariantMap& geometry);
46 void geometryChanged(const QVariantMap& geometry);
47
47
48+ // For testing.
49+ void stageSaved(const QString& appId, int stage);
50+
48private:
51private:
49 void setGeometry(const QVariantMap& geometry);
52 void setGeometry(const QVariantMap& geometry);
50 QVariantMap geometry() const;
53 QVariantMap geometry() const;
tests/qmltests/Stages/tst_TabletStage.qml+37−2
@@ -129,6 +129,12 @@ Rectangle {
129 }
129 }
130 }
130 }
131
131
132+ SignalSpy {
133+ id: stageSaver
134+ target: WindowStateStorage
135+ signalName: "stageSaved"
136+ }
137+
132 UnityTestCase {
138 UnityTestCase {
133 id: testCase
139 id: testCase
134 name: "TabletStage"
140 name: "TabletStage"
@@ -138,6 +144,7 @@ Rectangle {
138 property Item sideStage: tabletStage ? findChild(tabletStage, "sideStage") : null
144 property Item sideStage: tabletStage ? findChild(tabletStage, "sideStage") : null
139
145
140 function init() {
146 function init() {
147+ stageSaver.clear();
141 tabletStageLoader.active = true;
148 tabletStageLoader.active = true;
142 tryCompare(tabletStageLoader, "status", Loader.Ready);
149 tryCompare(tabletStageLoader, "status", Loader.Ready);
143
150
@@ -510,7 +517,35 @@ Rectangle {
510 tryCompare(stagesPriv, "sideStageAppId", data.sideStageAppId);
517 tryCompare(stagesPriv, "sideStageAppId", data.sideStageAppId);
511 }
518 }
512
519
513− function test_loadSideStageByDragginFromMainStage() {
520+ function test_applicationSavesLastStage_data() {
521+ return [
522+ { tag: "MainStage", stage: ApplicationInfoInterface.MainStage},
523+ { tag: "SideStage", stage: ApplicationInfoInterface.SideStage},
524+ ];
525+ }
526+
527+ function test_applicationSavesLastStage(data) {
528+ WindowStateStorage.saveStage(webbrowserCheckBox.appId, data.stage);
529+ stageSaver.clear();
530+
531+ var stagesPriv = findInvisibleChild(tabletStage, "stagesPriv");
532+ verify(stagesPriv);
533+
534+ tryCompare(stagesPriv, "mainStageAppId", "unity8-dash");
535+ tryCompare(stagesPriv, "sideStageAppId", "");
536+
537+ var webbrowserSurfaceId = topSurfaceList.nextId;
538+ webbrowserCheckBox.checked = true;
539+ waitUntilAppSurfaceShowsUp(webbrowserSurfaceId);
540+
541+ webbrowserCheckBox.checked = false;
542+
543+ tryCompare(stageSaver, "count", 1);
544+ compare(stageSaver.signalArguments[0][0], "webbrowser-app")
545+ compare(stageSaver.signalArguments[0][1], data.stage)
546+ }
547+
548+ function test_loadSideStageByDraggingFromMainStage() {
514 sideStage.showNow();
549 sideStage.showNow();
515 var webbrowserSurfaceId = topSurfaceList.nextId;
550 var webbrowserSurfaceId = topSurfaceList.nextId;
516 webbrowserCheckBox.checked = true;
551 webbrowserCheckBox.checked = true;
@@ -538,7 +573,7 @@ Rectangle {
538 tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
573 tryCompare(appDelegate, "stage", ApplicationInfoInterface.SideStage);
539 }
574 }
540
575
541− function test_unloadSideStageByDragginFromStageStage() {
576+ function test_unloadSideStageByDraggingFromStageStage() {
542 sideStage.showNow();
577 sideStage.showNow();
543 WindowStateStorage.saveStage(webbrowserCheckBox.appId, ApplicationInfoInterface.SideStage)
578 WindowStateStorage.saveStage(webbrowserCheckBox.appId, ApplicationInfoInterface.SideStage)
544 var webbrowserSurfaceId = topSurfaceList.nextId;
579 var webbrowserSurfaceId = topSurfaceList.nextId;