on xenial help sign in
Fixed bugs reported + added test for panel hide
b7ba76dNick Dedekind
qml/Panel/IndicatorsMenu.qml+6−5
@@ -40,6 +40,9 @@ Showable {
40
40
41 signal showTapped(point position)
41 signal showTapped(point position)
42
42
43+ property alias showDragHandle: __showDragHandle
44+ property alias hideDragHandle: __hideDragHandle
45+
43 // TODO: Perhaps we need a animation standard for showing/hiding? Each showable seems to
46 // TODO: Perhaps we need a animation standard for showing/hiding? Each showable seems to
44 // use its own values. Need to ask design about this.
47 // use its own values. Need to ask design about this.
45 showAnimation: StandardAnimation {
48 showAnimation: StandardAnimation {
@@ -58,7 +61,7 @@ Showable {
58
61
59 height: minimizedPanelHeight
62 height: minimizedPanelHeight
60 onHeightChanged: {
63 onHeightChanged: {
61− var revealProgress = root.height - minimizedPanelHeight - showHintBottomMargin;
64+ var revealProgress = root.height - minimizedPanelHeight;
62
65
63 if (!showAnimation.running && !hideAnimation.running) {
66 if (!showAnimation.running && !hideAnimation.running) {
64 if (revealProgress === 0) {
67 if (revealProgress === 0) {
@@ -163,10 +166,8 @@ Showable {
163 }
166 }
164
167
165 DragHandle {
168 DragHandle {
166− id: showDragHandle
169+ id: __showDragHandle
167 anchors.bottom: parent.bottom
170 anchors.bottom: parent.bottom
168− // go beyond parent so that it stays reachable, at the top of the screen.
169− anchors.bottomMargin: showHintBottomMargin
170 anchors.left: parent.left
171 anchors.left: parent.left
171 anchors.right: parent.right
172 anchors.right: parent.right
172 height: minimizedPanelHeight
173 height: minimizedPanelHeight
@@ -184,7 +185,7 @@ Showable {
184 }
185 }
185
186
186 DragHandle {
187 DragHandle {
187− id: hideDragHandle
188+ id: __hideDragHandle
188 anchors.fill: handle
189 anchors.fill: handle
189 direction: Direction.Upwards
190 direction: Direction.Upwards
190 enabled: root.shown && root.available
191 enabled: root.shown && root.available
qml/Panel/Panel.qml+8−1
@@ -139,7 +139,6 @@ Item {
139 return root.width
139 return root.width
140 }
140 }
141 enableHint: !callHint.active && !fullscreenMode
141 enableHint: !callHint.active && !fullscreenMode
142− showHintBottomMargin: fullscreenMode ? -minimizedPanelHeight : 0
143 panelColor: indicatorAreaBackground.color
142 panelColor: indicatorAreaBackground.color
144
143
145 onShowTapped: {
144 onShowTapped: {
@@ -147,6 +146,14 @@ Item {
147 callHint.showLiveCall();
146 callHint.showLiveCall();
148 }
147 }
149 }
148 }
149+
150+ showDragHandle {
151+ anchors.bottomMargin: fullscreenMode ? -minimizedPanelHeight : 0
152+ }
153+
154+ hideDragHandle {
155+ anchors.bottomMargin: -indicatorOrangeLine.height
156+ }
150 }
157 }
151
158
152 PanelSeparatorLine {
159 PanelSeparatorLine {
qml/Shell.qml+1−1
@@ -214,7 +214,7 @@ Item {
214 target: applicationsDisplayLoader.item
214 target: applicationsDisplayLoader.item
215 property: "maximizedAppTopMargin"
215 property: "maximizedAppTopMargin"
216 // Not just using panel.panelHeight as that changes depending on the focused app.
216 // Not just using panel.panelHeight as that changes depending on the focused app.
217− value: panel.indicators.panelHeight
217+ value: panel.indicators.minimizedPanelHeight + units.dp(2) // dp(2) for orange line
218 }
218 }
219 Binding {
219 Binding {
220 target: applicationsDisplayLoader.item
220 target: applicationsDisplayLoader.item
tests/qmltests/Panel/tst_Panel.qml+65−4
@@ -154,6 +154,7 @@ IndicatorTest {
154 // Dragging from a indicator item in the panel will gradually expose the
154 // Dragging from a indicator item in the panel will gradually expose the
155 // indicators, first by running the hint animation, then after dragging down will
155 // indicators, first by running the hint animation, then after dragging down will
156 // expose more of the panel, binding it to the selected indicator and opening it's menu.
156 // expose more of the panel, binding it to the selected indicator and opening it's menu.
157+ // Tested from first Y pixel to check for swipe from offscreen.
157 function test_drag_show(data) {
158 function test_drag_show(data) {
158 panel.fullscreenMode = data.fullscreen;
159 panel.fullscreenMode = data.fullscreen;
159 callManager.foregroundCall = data.call;
160 callManager.foregroundCall = data.call;
@@ -173,11 +174,13 @@ IndicatorTest {
173
174
174 for (var i = 0; i < indicatorsModel.originalModelData.length; i++) {
175 for (var i = 0; i < indicatorsModel.originalModelData.length; i++) {
175 var indicatorItem = get_indicator_item(i);
176 var indicatorItem = get_indicator_item(i);
177+
176− var mappedPosition = root.mapFromItem(indicatorItem, indicatorItem.width / 2, indicatorItem.height / 2);
178+ var startXPosition = root.mapFromItem(indicatorItem, indicatorItem.width / 2, 0).x;
179+ var startYPosition = root.mapFromItem(panel, 0, 0).y;
177
180
178 touchFlick(panel,
181 touchFlick(panel,
179− mappedPosition.x, panel.indicators.minimizedPanelHeight / 2,
182+ startXPosition, startYPosition,
180− mappedPosition.x, panel.height,
183+ startXPosition, panel.height,
181 true /* beginTouch */, false /* endTouch */, units.gu(5), 15);
184 true /* beginTouch */, false /* endTouch */, units.gu(5), 15);
182
185
183 // Indicators height should follow the drag, and therefore increase accordingly.
186 // Indicators height should follow the drag, and therefore increase accordingly.
@@ -186,7 +189,7 @@ IndicatorTest {
186 function() {return panel.indicators.height >= panel.height * 0.5},
189 function() {return panel.indicators.height >= panel.height * 0.5},
187 true);
190 true);
188
191
189− touchRelease(panel, mappedPosition.x, panel.height);
192+ touchRelease(panel, startXPosition, panel.height);
190
193
191 compare(indicatorRow.currentItemIndex, i, "Indicator item should be activated at position " + i);
194 compare(indicatorRow.currentItemIndex, i, "Indicator item should be activated at position " + i);
192 compare(menuContent.currentMenuIndex, i, "Menu conetent should be activated for item at position " + i);
195 compare(menuContent.currentMenuIndex, i, "Menu conetent should be activated for item at position " + i);
@@ -198,6 +201,64 @@ IndicatorTest {
198 }
201 }
199 }
202 }
200
203
204+ function test_drag_hide_data() {
205+ return [
206+ { tag: "pinned", fullscreen: false, call: null,
207+ indicatorY: 0 },
208+ { tag: "fullscreen", fullscreen: true, call: null,
209+ indicatorY: -panel.panelAndSeparatorHeight },
210+ { tag: "pinned-callActive", fullscreen: false, call: phoneCall,
211+ indicatorY: 0},
212+ { tag: "fullscreen-callActive", fullscreen: true, call: phoneCall,
213+ indicatorY: -panel.panelAndSeparatorHeight }
214+ ];
215+ }
216+
217+ // Dragging the shown indicators up from bottom of panel will hide the indicators
218+ // Tested from last Y pixel to check for swipe from offscreen.
219+ function test_drag_hide(data) {
220+ panel.fullscreenMode = data.fullscreen;
221+ callManager.foregroundCall = data.call;
222+
223+ var indicatorRow = findChild(panel.indicators, "indicatorItemRow");
224+ verify(indicatorRow !== null);
225+
226+ var menuContent = findChild(panel.indicators, "menuContent");
227+ verify(menuContent !== null);
228+
229+ var indicatorArea = findChild(panel, "indicatorArea");
230+ verify(indicatorArea !== null);
231+
232+ // Wait for the indicators to get into position.
233+ // (switches between normal and fullscreen modes are animated)
234+ tryCompareFunction(function() { return indicatorArea.y }, data.indicatorY);
235+
236+ var startXPosition = root.mapFromItem(panel.indicators, panel.indicators.width / 2, 0).x;
237+ var startYPosition = root.mapFromItem(panel, 0, panel.height).y;
238+
239+ panel.indicators.show();
240+ tryCompare(panel.indicators.showAnimation, "running", false);
241+ tryCompare(panel.indicators, "unitProgress", 1);
242+
243+
244+ touchFlick(panel.indicators,
245+ startXPosition, startYPosition,
246+ startXPosition, 0,
247+ true /* beginTouch */, false /* endTouch */, units.gu(5), 15);
248+
249+ // Indicators height should follow the drag, and therefore increase accordingly.
250+ // They should be at least half-way through the screen
251+ tryCompareFunction(
252+ function() {return panel.indicators.height <= panel.height * 0.5},
253+ true);
254+
255+ touchRelease(panel.indicators, startXPosition, 0);
256+
257+ tryCompare(panel.indicators.hideAnimation, "running", true);
258+ tryCompare(panel.indicators.hideAnimation, "running", false);
259+ tryCompare(panel.indicators, "state", "initial");
260+ }
261+
201 function test_hint_data() {
262 function test_hint_data() {
202 return [
263 return [
203 { tag: "normal", fullscreen: false, call: null, hintExpected: true},
264 { tag: "normal", fullscreen: false, call: null, hintExpected: true},