on xenial help sign in
Fix resizing the dash bringing temp scopes size out of sync
commitc8b0b236e006368731e29e14217ec4571c9f413a authorAlbert Astals Cid <albert.astals@canonical.com> dateTue 9 Feb 2016, 11:04 (11 years ago) parent861ebc5
2 files changed+40−10
qml/Dash/Dash.qml+10−10 tests/qmltests/Dash/tst_Dash.qml+30
qml/Dash/Dash.qml+10−10
@@ -37,6 +37,7 @@ Showable {
3737 }
3838
3939 property bool windowActive: window.active
40+ property bool showOverlayScope: false
4041
4142 DashCommunicatorService {
4243 objectName: "dashCommunicatorService"
@@ -80,7 +81,7 @@ Showable {
8081 return
8182 }
8283
83− closeOverlayScope();
84+ dash.showOverlayScope = false;
8485
8586 dashContent.closePreview();
8687
@@ -93,12 +94,6 @@ Showable {
9394 dashContent.setCurrentScopeAtIndex(scopeIndex, animate, reset)
9495 }
9596
96− function closeOverlayScope() {
97− if (dashContent.x != 0) {
98− dashContent.x = 0;
99− }
100− }
101−
10297 Scopes {
10398 id: scopes
10499 }
@@ -133,6 +128,7 @@ Showable {
133128 height: dash.height
134129 scopes: scopes
135130 visible: x != -width
131+ x: dash.showOverlayScope ? -width : 0
136132 onGotoScope: {
137133 dash.setCurrentScope(scopeId, true, false);
138134 }
@@ -207,7 +203,7 @@ Showable {
207203 bottomEdgeController.enableAnimation = true;
208204 bottomEdgeController.progress = 0;
209205 scopeItem.scope = scope;
210− dashContent.x = -dashContent.width;
206+ dash.showOverlayScope = true;
211207 }
212208 onGotoScope: {
213209 bottomEdgeController.enableAnimation = true;
@@ -226,7 +222,7 @@ Showable {
226222 id: scopeItem
227223 objectName: "dashTempScopeItem"
228224
229− x: dashContent.x + width
225+ x: dash.showOverlayScope ? 0 : width
230226 y: dashContent.y
231227 width: parent.width
232228 height: parent.height
@@ -234,7 +230,7 @@ Showable {
234230 hasBackAction: true
235231 isCurrent: visible
236232 onBackClicked: {
237− closeOverlayScope();
233+ dash.showOverlayScope = false;
238234 closePreview();
239235 }
240236
@@ -250,6 +246,10 @@ Showable {
250246 scopes.closeScope(oldScope);
251247 }
252248 }
249+
250+ Behavior on x {
251+ UbuntuNumberAnimation { }
252+ }
253253 }
254254
255255 Rectangle {
tests/qmltests/Dash/tst_Dash.qml+30
@@ -565,5 +565,35 @@ Item {
565565 tryCompare(dashTempScopeItem, "x", dashTempScopeItem.width);
566566 tryCompare(dashTempScopeItem, "visible", false);
567567 }
568+
569+ function test_tempScopeItemXOnResize()
570+ {
571+ // Go to a temp scope
572+ touchFlick(dash, dash.width / 2, dash.height - 1, dash.width / 2, units.gu(2));
573+ var bottomEdgeController = findInvisibleChild(dash, "bottomEdgeController");
574+ tryCompare(bottomEdgeController, "progress", 1);
575+ var nonfavScopesListCategory = findChild(dash, "scopesListCategoryother");
576+ var nonfavScopesListCategoryList = findChild(nonfavScopesListCategory, "scopesListCategoryInnerList");
577+ tryCompare(nonfavScopesListCategoryList, "currentIndex", 0);
578+ mouseClick(nonfavScopesListCategoryList.currentItem);
579+ var dashTempScopeItem = findChild(dash, "dashTempScopeItem");
580+ tryCompare(dashTempScopeItem, "x", 0);
581+ tryCompare(dashTempScopeItem, "visible", true);
582+
583+ shell.width = units.gu(80);
584+ tryCompare(dashTempScopeItem, "x", 0);
585+
586+ shell.width = units.gu(40);
587+ tryCompare(dashTempScopeItem, "x", 0);
588+
589+ // Go back
590+ var dashTempScopeItemHeader = findChild(dashTempScopeItem, "scopePageHeader");
591+ var backButton = findChild(findChild(dashTempScopeItemHeader, "innerPageHeader"), "customBackButton");
592+ mouseClick(backButton);
593+
594+ // Check temp scope is gone
595+ tryCompare(dashTempScopeItem, "x", dash.width);
596+ tryCompare(dashTempScopeItem, "visible", false);
597+ }
568598 }
569599}