on xenial help sign in
Fixed bugs reported + added test for panel hide
commitb7ba76d8178ecf1aa29005397550070333947db1 authorNick Dedekind <nick.dedekind@canonical.com> dateThu 2 Oct 2014, 11:05 (12 years ago) parent93272501754c9c
4 files changed+80−11
qml/Panel/IndicatorsMenu.qml+6−5 qml/Panel/Panel.qml+8−1 qml/Shell.qml+1−1 tests/qmltests/Panel/tst_Panel.qml+65−4
qml/Panel/IndicatorsMenu.qml+6−5
@@ -40,6 +40,9 @@ Showable {
4040
4141 signal showTapped(point position)
4242
43+ property alias showDragHandle: __showDragHandle
44+ property alias hideDragHandle: __hideDragHandle
45+
4346 // TODO: Perhaps we need a animation standard for showing/hiding? Each showable seems to
4447 // use its own values. Need to ask design about this.
4548 showAnimation: StandardAnimation {
@@ -58,7 +61,7 @@ Showable {
5861
5962 height: minimizedPanelHeight
6063 onHeightChanged: {
61− var revealProgress = root.height - minimizedPanelHeight - showHintBottomMargin;
64+ var revealProgress = root.height - minimizedPanelHeight;
6265
6366 if (!showAnimation.running && !hideAnimation.running) {
6467 if (revealProgress === 0) {
@@ -163,10 +166,8 @@ Showable {
163166 }
164167
165168 DragHandle {
166− id: showDragHandle
169+ id: __showDragHandle
167170 anchors.bottom: parent.bottom
168− // go beyond parent so that it stays reachable, at the top of the screen.
169− anchors.bottomMargin: showHintBottomMargin
170171 anchors.left: parent.left
171172 anchors.right: parent.right
172173 height: minimizedPanelHeight
@@ -184,7 +185,7 @@ Showable {
184185 }
185186
186187 DragHandle {
187− id: hideDragHandle
188+ id: __hideDragHandle
188189 anchors.fill: handle
189190 direction: Direction.Upwards
190191 enabled: root.shown && root.available
qml/Panel/Panel.qml+8−1
@@ -139,7 +139,6 @@ Item {
139139 return root.width
140140 }
141141 enableHint: !callHint.active && !fullscreenMode
142− showHintBottomMargin: fullscreenMode ? -minimizedPanelHeight : 0
143142 panelColor: indicatorAreaBackground.color
144143
145144 onShowTapped: {
@@ -147,6 +146,14 @@ Item {
147146 callHint.showLiveCall();
148147 }
149148 }
149+
150+ showDragHandle {
151+ anchors.bottomMargin: fullscreenMode ? -minimizedPanelHeight : 0
152+ }
153+
154+ hideDragHandle {
155+ anchors.bottomMargin: -indicatorOrangeLine.height
156+ }
150157 }
151158
152159 PanelSeparatorLine {
qml/Shell.qml+1−1
@@ -214,7 +214,7 @@ Item {
214214 target: applicationsDisplayLoader.item
215215 property: "maximizedAppTopMargin"
216216 // 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
218218 }
219219 Binding {
220220 target: applicationsDisplayLoader.item
tests/qmltests/Panel/tst_Panel.qml+65−4
@@ -154,6 +154,7 @@ IndicatorTest {
154154 // Dragging from a indicator item in the panel will gradually expose the
155155 // indicators, first by running the hint animation, then after dragging down will
156156 // 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.
157158 function test_drag_show(data) {
158159 panel.fullscreenMode = data.fullscreen;
159160 callManager.foregroundCall = data.call;
@@ -173,11 +174,13 @@ IndicatorTest {
173174
174175 for (var i = 0; i < indicatorsModel.originalModelData.length; i++) {
175176 var indicatorItem = get_indicator_item(i);
176− var mappedPosition = root.mapFromItem(indicatorItem, indicatorItem.width / 2, indicatorItem.height / 2);
177+
178+ var startXPosition = root.mapFromItem(indicatorItem, indicatorItem.width / 2, 0).x;
179+ var startYPosition = root.mapFromItem(panel, 0, 0).y;
177180
178181 touchFlick(panel,
179− mappedPosition.x, panel.indicators.minimizedPanelHeight / 2,
180− mappedPosition.x, panel.height,
182+ startXPosition, startYPosition,
183+ startXPosition, panel.height,
181184 true /* beginTouch */, false /* endTouch */, units.gu(5), 15);
182185
183186 // Indicators height should follow the drag, and therefore increase accordingly.
@@ -186,7 +189,7 @@ IndicatorTest {
186189 function() {return panel.indicators.height >= panel.height * 0.5},
187190 true);
188191
189− touchRelease(panel, mappedPosition.x, panel.height);
192+ touchRelease(panel, startXPosition, panel.height);
190193
191194 compare(indicatorRow.currentItemIndex, i, "Indicator item should be activated at position " + i);
192195 compare(menuContent.currentMenuIndex, i, "Menu conetent should be activated for item at position " + i);
@@ -198,6 +201,64 @@ IndicatorTest {
198201 }
199202 }
200203
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+
201262 function test_hint_data() {
202263 return [
203264 { tag: "normal", fullscreen: false, call: null, hintExpected: true},