on xenial help sign in
Make Panel use DragHandles instead of a Revealer

- A directional drag gesture is needed reveal the panel when fullscreen. - better logic for deciding when to auto-complete the show/hide animation - hinting animation to close the panel - Tapping on menu bar no longer opens nearest indicator menu - No closing with handle click

commit679389747635eeae45ff1a4e179c69078ea8f3e1 authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateTue 2 Jul 2013, 10:28 (13 years ago) parente37e13c
7 files changed+208−260
Panel/Indicators.qml+102−26 Panel/MenuContent.qml+1−1 Panel/Panel.qml+2−73 Shell.qml+2 tests/qmltests/CMakeLists.txt+2−2 tests/qmltests/Panel/tst_Indicators.qml+34−45 tests/qmltests/Panel/tst_Panel.qml+65−113
Panel/Indicators.qml+102−26
@@ -16,32 +16,46 @@
1616
1717import QtQuick 2.0
1818import Ubuntu.Components 0.1
19+import Ubuntu.Gestures 0.1
1920import Ubuntu.ChewieUI 0.1 as ChewieUI
2021
2122import "../Components"
23+import "../Components/ListItems"
2224import "../Components/Math.js" as MathLocal
2325
2426Showable {
2527 id: indicators
2628
27− property int progress: panelHeight
2829 property int openedHeight: units.gu(71)
2930 property int panelHeight: units.gu(3)
3031 property bool pinnedMode: true //should be set true if indicators menu can cover whole screen
3132
3233 property int hintValue
33− readonly property int lockThreshold: shell.height/2
34− property bool fullyOpened: revealer ? progress == revealer.openedValue : false
35− property bool partiallyOpened: revealer ? progress > revealer.closedValue && progress < revealer.openedValue : false
34+ readonly property int lockThreshold: openedHeight / 2
35+ property bool fullyOpened: pinnedMode ? height == openedHeight - panelHeight
36+ : height == openedHeight
37+ property bool partiallyOpened: height > panelHeight && !fullyOpened
38+
39+ showAnimation: StandardAnimation {
40+ property: "height"
41+ duration: 350
42+ to: pinnedMode ? openedHeight - panelHeight : openedHeight
43+ easing.type: Easing.OutCubic
44+ }
3645
37− property Revealer revealer: null
46+ hideAnimation: StandardAnimation {
47+ property: "height"
48+ duration: 350
49+ to: panelHeight
50+ easing.type: Easing.OutCubic
51+ }
3852
39− height: menuContent.height + handle.height + menuContent.y
53+ height: panelHeight
4054
41− onProgressChanged: {
42− // need to use handle.get_height(). As the handle height depends on progress changes (but this is called first!)
43− var contentProgress = progress - handle.get_height()
44− if (!showAnimation.running && !hideAnimation.running && !revealer.hintingAnimation.running) {
55+ onHeightChanged: {
56+ // need to use handle.get_height(). As the handle height depends on indicators.height changes (but this is called first!)
57+ var contentProgress = indicators.height - handle.get_height()
58+ if (!showAnimation.running && !hideAnimation.running /*&& !revealer.hintingAnimation.running*/) {
4559 if (contentProgress <= hintValue && indicators.state == "reveal") {
4660 indicators.state = "hint"
4761 menuContent.hideAll()
@@ -66,12 +80,6 @@ Showable {
6680 }
6781 }
6882
69− function handlePress() {
70− menuContent.hideAll()
71− menuContent.activateContent()
72− indicators.state = "hint"
73− }
74−
7583 function openOverview() {
7684 indicatorRow.currentItem = null
7785 menuContent.showOverview()
@@ -91,7 +99,9 @@ Showable {
9199 If bar is dragged down a distance greater than or equal to lockThreshold, this is 1.
92100 Otherwise it contains the bar's location as a fraction of the distance between hintValue (is 0) and lockThreshold (is 1).
93101 */
94− var verticalProgress = MathLocal.clamp((indicators.progress - handle.height - hintValue) / (lockThreshold - hintValue), 0, 1)
102+ var verticalProgress =
103+ MathLocal.clamp((indicators.height - handle.height - hintValue) /
104+ (lockThreshold - hintValue), 0, 1)
95105
96106 /*
97107 Percentage of an indicator icon's width the user's press can stray horizontally from the
@@ -139,6 +149,17 @@ Showable {
139149 }
140150 }
141151
152+ VerticalThinDivider {
153+ anchors {
154+ top: indicators.top
155+ topMargin: panelHeight
156+ bottom: handle.bottom
157+ right: indicators.left
158+ }
159+ width: units.dp(2)
160+ source: "graphics/VerticalDivider.png"
161+ }
162+
142163 MenuContent {
143164 id: menuContent
144165 objectName: "menuContent"
@@ -147,8 +168,8 @@ Showable {
147168 left: parent.left
148169 right: parent.right
149170 top: indicatorRow.bottom
171+ bottom: parent.bottom
150172 }
151− height: progress - y
152173 indicatorsModel: indicatorsModel
153174 animate: false
154175 clip: indicators.partiallyOpened
@@ -187,7 +208,7 @@ Showable {
187208 clip: height < handleImage.height
188209
189210 function get_height() {
190− return Math.max(Math.min(handleImage.height, progress - handleImage.height), 0)
211+ return Math.max(Math.min(handleImage.height, indicators.height - handleImage.height), 0)
191212 }
192213
193214 BorderImage {
@@ -205,6 +226,29 @@ Showable {
205226 }
206227 }
207228
229+ PanelSeparatorLine {
230+ id: indicatorsSeparatorLine
231+ visible: true
232+ anchors {
233+ top: handle.bottom
234+ left: indicators.left
235+ right: indicators.right
236+ }
237+ }
238+
239+ BorderImage {
240+ id: dropShadow
241+ anchors {
242+ top: indicators.top
243+ bottom: indicatorsSeparatorLine.bottom
244+ left: indicators.left
245+ right: indicators.right
246+ margins: -units.gu(1)
247+ }
248+ visible: indicators.height > panelHeight
249+ source: "graphics/rectangular_dropshadow.sci"
250+ }
251+
208252 PanelBackground {
209253 anchors.fill: indicatorRow
210254 }
@@ -249,7 +293,7 @@ Showable {
249293 openOverview()
250294 }
251295 else {
252− indicators.calculateCurrentItem(revealer.lateralPosition, false)
296+ indicators.calculateCurrentItem(dragHandle.touchX, false)
253297 menuContent.showMenu()
254298 }
255299 indicators.state = "commit"
@@ -258,10 +302,10 @@ Showable {
258302 }
259303
260304 Connections {
261− target: revealer
262− onLateralPositionChanged: {
263− var buffer = revealer.dragging ? true : false
264− indicators.calculateCurrentItem(revealer.lateralPosition, buffer)
305+ target: dragHandle
306+ onTouchXChanged: {
307+ var buffer = dragHandle.dragging ? true : false
308+ indicators.calculateCurrentItem(dragHandle.touchX, buffer)
265309 }
266310 }
267311
@@ -277,6 +321,38 @@ Showable {
277321 state = last_state;
278322 }
279323
324+ property var dragHandle: showDragHandle.dragging ? showDragHandle : hideDragHandle
325+ DragHandle {
326+ id: showDragHandle
327+ anchors.bottom: parent.bottom
328+ // go beyond parent so that it stays reachable, at the top of the screen.
329+ anchors.bottomMargin: pinnedMode ? 0 : -panelHeight
330+ anchors.left: parent.left
331+ anchors.right: parent.right
332+ height: panelHeight
333+ direction: Direction.Downwards
334+ enabled: !indicators.shown
335+ hintDisplacement: pinnedMode ? indicators.hintValue : 0
336+ autoCompleteDragThreshold: maxTotalDragDistance / 2
337+ stretch: true
338+ maxTotalDragDistance:
339+ pinnedMode ? openedHeight - panelHeight - handle.height
340+ : openedHeight - handle.height
341+ distanceThreshold: pinnedMode ? 0 : units.gu(3)
342+ }
343+ DragHandle {
344+ id: hideDragHandle
345+ anchors.fill: handle
346+ height: panelHeight
347+ direction: Direction.Upwards
348+ enabled: indicators.shown
349+ hintDisplacement: units.gu(2)
350+ autoCompleteDragThreshold: maxTotalDragDistance / 6
351+ stretch: true
352+ maxTotalDragDistance: openedHeight - 2*panelHeight
353+ distanceThreshold: 0
354+ }
355+
280356 property list<State> offScreenModeStates: [
281357 State {
282358 name: "initial"
@@ -289,7 +365,7 @@ Showable {
289365 name: "reveal"
290366 extend: "hint"
291367 PropertyChanges { target: menuContent; animate: true }
292− StateChangeScript { script: calculateCurrentItem(revealer.lateralPosition, false); }
368+ StateChangeScript { script: calculateCurrentItem(dragHandle.touchX, false); }
293369 },
294370 State {
295371 name: "locked"
@@ -311,7 +387,7 @@ Showable {
311387 State {
312388 name: "reveal"
313389 PropertyChanges { target: menuContent; animate: true }
314− StateChangeScript { script: calculateCurrentItem(revealer.lateralPosition, false); }
390+ StateChangeScript { script: calculateCurrentItem(dragHandle.touchX, false); }
315391 },
316392 State {
317393 name: "locked"
Panel/MenuContent.qml+1−1
@@ -99,7 +99,7 @@ Rectangle {
9999 onVisibleChanged: {
100100 // Reset the indicator states
101101 if (!visible && item) {
102− item.reset()
102+ //item.reset()
103103 }
104104 }
105105 asynchronous: true
Panel/Panel.qml+2−73
@@ -17,7 +17,6 @@
1717import QtQuick 2.0
1818import Ubuntu.Components 0.1
1919import "../Components"
20−import "../Components/ListItems"
2120
2221Item {
2322 id: root
@@ -75,29 +74,6 @@ Item {
7574 }
7675 }
7776
78− BorderImage {
79− id: dropShadow
80− anchors {
81− top: indicatorsMenu.top
82− bottom: indicatorsSeparatorLine.bottom
83− left: indicatorsMenu.left
84− right: indicatorsMenu.right
85− margins: -units.gu(1)
86− }
87− visible: indicatorsMenu.progress != indicatorRevealer.closedValue
88− source: "graphics/rectangular_dropshadow.sci"
89− }
90−
91− VerticalThinDivider {
92− anchors {
93− top: leftSeparatorLine.top
94− bottom: indicatorsSeparatorLine.top
95− right: indicatorsMenu.left
96− }
97− width: units.dp(2)
98− source: "graphics/VerticalDivider.png"
99− }
100−
10177 Indicators {
10278 id: indicatorsMenu
10379
@@ -105,58 +81,13 @@ Item {
10581 y: 0
10682 width: root.indicatorsMenuWidth
10783 shown: false
108− revealer: indicatorRevealer
109− hintValue: indicatorRevealer.hintDisplacement
84+ hintValue: __panelMinusSeparatorLineHeight * 3
11085 panelHeight: __panelMinusSeparatorLineHeight
111− showAnimation: StandardAnimation { property: "progress"; duration: 350; to: indicatorRevealer.openedValue; easing.type: Easing.OutCubic }
112− hideAnimation: StandardAnimation { property: "progress"; duration: 350; to: indicatorRevealer.closedValue; easing.type: Easing.OutCubic }
11386 openedHeight: parent.height
11487
11588 pinnedMode: !fullscreenMode
11689
117− property real unitProgress: (indicatorRevealer.closedValue - progress) / (indicatorRevealer.closedValue - indicatorRevealer.openedValue)
118− }
119−
120− PanelSeparatorLine {
121− id: indicatorsSeparatorLine
122− anchors {
123− top: indicatorsMenu.bottom
124− left: indicatorsMenu.left
125− right: parent.right
126− }
127− }
128−
129− Revealer {
130− id: indicatorRevealer
131− objectName: "indicatorRevealer"
132−
133− width: root.indicatorsMenuWidth
134− anchors {
135− top: parent.top
136− bottom: parent.bottom
137− right: parent.right
138− }
139− target: indicatorsMenu
140− handleSize: __panelMinusSeparatorLineHeight
141− closedValue: __panelMinusSeparatorLineHeight
142− dragVelocityThreshold: units.dp(1)
143− boundProperty: "progress"
144− hintDisplacement: __panelMinusSeparatorLineHeight * 3
145− openOnPress: !fullscreenMode
146− orientation: Qt.Vertical
147−
148− onOpenClicked: {
149− indicatorsMenu.openOverview();
150− indicatorsMenu.show();
151− }
152− onCloseClicked: indicatorsMenu.hide();
153−
154− onOpenPressed: indicatorsMenu.handlePress()
155−
156− function dragToValue(dragPosition) {
157− var offset = target.shown ? 0 : -hintDisplacement + handleSize;
158− return dragPosition + offset;
159− }
90+ property real unitProgress: height / parent.height
16091 }
16192
16293 SearchIndicator {
@@ -192,13 +123,11 @@ Item {
192123 name: "in" //fully opaque and visible at top edge of screen
193124 when: !fullscreenMode
194125 PropertyChanges { target: panelBackground; y: 0 }
195− PropertyChanges { target: indicatorRevealer; openedValue: indicatorsMenu.openedHeight - panelHeight }
196126 },
197127 State {
198128 name: "out" //pushed off screen
199129 when: fullscreenMode
200130 PropertyChanges { target: panelBackground; y: -panelHeight }
201− PropertyChanges { target: indicatorRevealer; openedValue: indicatorsMenu.openedHeight }
202131 }
203132 ]
204133}
Shell.qml+2
@@ -365,6 +365,8 @@ FocusScope {
365365 height: parent.height - panel.panelHeight
366366 background: shell.background
367367
368+ property real showAnimationProgress: MathLocal.clamp(1 + x / width, 0, 1)
369+
368370 onUnlocked: lockscreen.hide()
369371 onCancel: greeter.show()
370372
tests/qmltests/CMakeLists.txt+2−2
@@ -60,10 +60,10 @@ add_qml_test(Hud Result)
6060add_qml_test(Launcher Launcher IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
6161add_qml_test(Notifications Notifications IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_CURRENT_SOURCE_DIR}/plugins)
6262add_qml_test(Panel IndicatorRow)
63−add_qml_test(Panel Indicators)
63+add_qml_test(Panel Indicators IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
6464add_qml_test(Panel MenuContent)
6565add_qml_test(Panel Overview)
66−add_qml_test(Panel Panel)
66+add_qml_test(Panel Panel IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
6767add_qml_test(Panel SearchIndicator)
6868add_qml_test(Panel/Menus IndicatorMenuWindow IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS})
6969add_qml_test(SideStage SideStage IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS}
tests/qmltests/Panel/tst_Indicators.qml+34−45
@@ -42,23 +42,9 @@ Item {
4242 }
4343 width: (shell.width > units.gu(60)) ? units.gu(40) : shell.width
4444 y: 0
45− hintValue: indicatorRevealer.hintDisplacement
4645 shown: false
47− revealer: indicatorRevealer
4846
4947 openedHeight: parent.height - click_me.height
50−
51− showAnimation: NumberAnimation { property: "progress"; duration: 350; to: indicatorRevealer.openedValue; easing.type: Easing.OutCubic }
52− hideAnimation: NumberAnimation { property: "progress"; duration: 350; to: indicatorRevealer.closedValue; easing.type: Easing.OutCubic }
53− }
54−
55− Revealer {
56− anchors.fill: indicators
57− id: indicatorRevealer
58− hintDisplacement: indicators.panelHeight * 3
59−
60− openedValue: indicators.openedHeight - indicators.panelHeight
61− closedValue: indicators.panelHeight
6248 }
6349
6450 // Just a rect for clicking to open the indicators.
@@ -153,60 +139,63 @@ Item {
153139 {
154140 // tests changing the lateral position of the revealer activates the correct indicator items.
155141
156− // This "should" put the indicators in "hint" state
157− indicators.progress = indicators.hintValue;
158−
159142 var indicator_row = findChild(indicators, "indicatorRow")
160143 var row_repeater = findChild(indicators, "rowRepeater")
161144
162145 for (var i = 0; i < row_repeater.count; i++) {
163146 var indicator_item = row_repeater.itemAt(i);
164147
165− var indicator_position = indicator_row.row.x + indicator_item.x + indicator_item.width/2;
148+ var indicator_position = indicators.mapFromItem(indicator_item,
149+ indicator_item.width/2, indicator_item.height/2)
166150
167− indicatorRevealer.lateralPosition = indicator_position;
151+ touchFlick(indicators,
152+ indicator_position.x, indicator_position.y,
153+ indicator_position.x, indicators.openedHeight * 0.4,
154+ true /* beginTouch */, false /* endTouch */)
168155
169− compare(indicator_row.currentItem, indicator_item, "Incorrect item activated at position " + i);
156+ compare(indicator_row.currentItem, indicator_item,
157+ "Incorrect item activated at position " + i);
158+
159+ touchFlick(indicators,
160+ indicator_position.x, indicators.openedHeight * 0.4,
161+ indicator_position.x, indicator_position.y,
162+ false /* beginTouch */, true /* endTouch */)
163+
164+ // wait until fully closed
165+ tryCompare(indicators, "height", indicators.panelHeight)
170166 }
171167 }
172168
173− // PROGRESS TESTS
174−
175− // values for specific state changes are subject to internal decisions, so we can't determine the true progress value
176− // which would cause the state to change without making too many assuptyions
177− // However, we can assume that a partially opened panel will not be initial, and fully opened panel will be locked.
169+ // values for specific state changes are subject to internal decisions, so we can't
170+ // determine the true height value which would cause the state to change without making
171+ // too many assuptyions
172+ // However, we can assume that a partially opened panel will not be initial, and fully
173+ // opened panel will be locked.
178174
179175 function test_progress_changes_state_to_not_initial() {
180− indicators.progress = indicatorRevealer.closedValue + (indicatorRevealer.openedValue - indicatorRevealer.closedValue)/2;
181− compare(indicators.state!="initial", true, "Indicators should not be in initial state when partially opened.");
176+ indicators.height = indicators.openedHeight / 2
177+ compare(indicators.state!="initial", true,
178+ "Indicators should not be in initial state when partially opened.")
182179 }
183180
184181 function test_progress_changes_state_to_locked() {
185− indicators.progress = indicators.openedHeight;
186− compare(indicators.state, "locked", "Indicators should be locked when fully opened.");
182+ indicators.height = indicators.openedHeight - indicators.panelHeight
183+ compare(indicators.state, "locked", "Indicators should be locked when fully opened.")
187184 }
188185
189186 function test_partially_open() {
190− indicators.progress = indicatorRevealer.closedValue + (indicatorRevealer.openedValue - indicatorRevealer.closedValue)/2;
191− compare(indicators.partiallyOpened, true, "Indicator should show as partially opened when in between revealer closedValue & openedValue height");
192− compare(indicators.fullyOpened, false, "Indicator should not show as fully opened when in between revealer closedValue & openedValue height");
187+ indicators.height = indicators.openedHeight / 2
188+ compare(indicators.partiallyOpened, true,
189+ "Indicator should show as partially opened when height is half of openedHeight")
190+ compare(indicators.fullyOpened, false,
191+ "Indicator should not show as fully opened when height is half of openedHeight")
193192 }
194193
195194 function test_fully_open() {
196− indicators.progress = indicatorRevealer.openedValue
197− compare(indicators.partiallyOpened, false, "Indicator should show as fully opened when in between revealer closedValue & openedValue height");
198− compare(indicators.fullyOpened, true, "Indicator should not show as fully opened when at revealer openedValue height");
195+ indicators.height = indicators.openedHeight - indicators.panelHeight
196+ compare(indicators.partiallyOpened, false);
197+ compare(indicators.fullyOpened, true);
199198 }
200199
201− // The indicator menu content should be shown if the indicators are show through an animation before they
202− // enter a furthur state through a progress change (eg press indicator row, drag down a less then hint
203− // threshold and release to show
204− function test_menu_open_on_hint_drag() {
205− indicators.handlePress();
206− indicators.show()
207−
208− var menuContent = findChild(indicators, "menuContent")
209− compare(menuContent.__shown, true, "Indicator menu content should be shown after a indicator show.");
210− }
211200 }
212201}
tests/qmltests/Panel/tst_Panel.qml+65−113
@@ -78,92 +78,56 @@ Item {
7878 return panel.mapFromItem(indicator_item, indicator_item.width/2, indicator_item.height/2);
7979 }
8080
81− function test_hint_data() { return get_window_data() }
82−
8381 // Pressing on the indicator panel should activate the indicator hints
8482 // and expose a portion of the conent.
85− function test_hint(data) {
86− panel.fullscreenMode = data.fullscreenFlag;
87−
88− var indicator_item_coord = get_indicator_item_position(0);
89− var indicator_revealer = findChild(panel, "indicatorRevealer");
90− verify(indicator_revealer != undefined)
91−
92− mousePress(panel,
93− indicator_item_coord.x, panel.panelHeight/2,
94− Qt.LeftButton, Qt.NoModifier , 0);
95−
96− if (!panel.fullscreenMode)
97− {
98− compare(indicator_revealer.hintingAnimation.running, true, "Indicator revealer hint animation should be running after mouse press on indicator panel in pinned mode");
99− tryCompare(indicator_revealer.hintingAnimation, "running", false);
100− tryCompare(panel.indicators, "partiallyOpened", true);
101− }
102− else
103− {
104− // nothing should happen
105− compare(indicator_revealer.hintingAnimation.running, false, "Indicator revealer hint animation should not be running after mouse press on indicator panel in fullscreen mode");
106− compare(panel.indicators.partiallyOpened, false, "Indicator should not be partially opened when panel is pressed in fullscreenmode");
107− compare(panel.indicators.fullyOpened, false, "Indicator should not be partially opened when panel is pressed in fullscreenmode");
108− }
109−
110− mouseRelease(panel,
111− indicator_item_coord.x, panel.panelHeight/2,
112− Qt.LeftButton, Qt.NoModifier , 0);
113− }
114−
115− function test_show_click_data() { return get_window_data() }
116−
117− // Clicking the indicator panel should fully open the inidicators
118− function test_show_click(data) {
119− panel.fullscreenMode = data.fullscreenFlag;
83+ function test_hint() {
84+ panel.fullscreenMode = false;
85+ // Wait for the indicators to get into position.
86+ // (switches between normal and fullscreen modes are animated)
87+ tryCompare(panel.indicators, "y", 0)
12088
12189 var indicator_item_coord = get_indicator_item_position(0);
12290
123− mouseClick(panel,
124− indicator_item_coord.x, panel.panelHeight/2,
125− Qt.LeftButton, Qt.NoModifier , 0);
91+ touchPress(panel, indicator_item_coord.x, panel.panelHeight / 2)
12692
127− if (!panel.fullscreenMode)
128− {
129− compare(panel.indicators.showAnimation.running, true, "Show animation should run after panel is clicked in pinned mode.");
130− tryCompare(panel.indicators, "fullyOpened", true);
93+ // hint animation should be run, meaning that indicators will move downwards
94+ // by hintValue pixels without any drag taking place
95+ tryCompare(panel.indicators, "height",
96+ panel.indicators.panelHeight + panel.indicators.hintValue);
97+ tryCompare(panel.indicators, "partiallyOpened", true);
98+ tryCompare(panel.indicators, "fullyOpened", false);
13199
132− // click will activate device overview.
133− compare(findChild(panel.indicators, "indicatorRow").overviewActive, true, "Overview indicator should be avtive when indicators clicked.")
134− }
135− else
136− {
137− compare(panel.indicators.showAnimation.running, false, "Indicators should not open when panel is clicked in pinned mode.");
138− }
100+ touchRelease(panel, indicator_item_coord.x, panel.panelHeight/2)
139101 }
140102
141− function test_show_press_release_data() { return get_window_data() }
142−
143− // Pressing and releasing on the indicator panel will fully open the indicators
144− function test_show_press_release(data) {
145− panel.fullscreenMode = data.fullscreenFlag;
103+ // Pressing on the top edge of the screen should have no effect if the panel
104+ // is hidden (!pinned), which is the case when a fullscreen app is being shown
105+ function test_noHintOnFullscreenMode() {
106+ panel.fullscreenMode = true;
107+ // Wait for the indicators to get into position.
108+ // (switches between normal and fullscreen modes are animated)
109+ tryCompare(panel.indicators, "y", -panel.panelHeight)
146110
147111 var indicator_item_coord = get_indicator_item_position(0);
148112
149− mousePress(panel,
150− indicator_item_coord.x, panel.panelHeight/2,
151− Qt.LeftButton, Qt.NoModifier , 0);
113+ touchPress(panel, indicator_item_coord.x, panel.panelHeight / 2)
152114
153− mouseRelease(panel,
154− indicator_item_coord.x, panel.panelHeight/2,
155− Qt.LeftButton, Qt.NoModifier , 0);
115+ // Give some time for a hint animation to change things, if any
116+ wait(500)
156117
157− if (!panel.fullscreenMode)
158− {
159− compare(panel.indicators.showAnimation.running, true, "Show animation should run after panel is clicked in pinned mode.");
160− tryCompare(panel.indicators, "fullyOpened", true);
161− }
162− else
163− {
164− // nothing should happen.
165− compare(panel.indicators.showAnimation.running, false, "Indicators should not open when panel is clicked in pinned mode.");
166− }
118+ // no hint animation when fullscreen
119+ compare(panel.indicators.y, -panel.panelHeight)
120+ var indicatorRow = findChild(panel.indicators, "indicatorRow");
121+ verify(indicatorRow != undefined)
122+ compare(indicatorRow.y, 0)
123+ compare(panel.indicators.height, panel.indicators.panelHeight)
124+ compare(panel.indicators.partiallyOpened, false,
125+ "Indicator should not be partially opened when panel is pressed in" +
126+ " fullscreenmode")
127+ compare(panel.indicators.fullyOpened, false, "Indicator should not be partially" +
128+ " opened when panel is pressed in fullscreenmode")
129+
130+ touchRelease(panel, indicator_item_coord.x, panel.panelHeight/2)
167131 }
168132
169133 function test_drag_show_data() { return get_window_data() }
@@ -174,9 +138,6 @@ Item {
174138 function test_drag_show(data) {
175139 panel.fullscreenMode = data.fullscreenFlag;
176140
177− var indicator_revealer = findChild(panel, "indicatorRevealer");
178− verify(indicator_revealer != undefined)
179−
180141 var indicator_row = findChild(panel.indicators, "indicatorRow");
181142 verify(indicator_row != undefined)
182143
@@ -186,6 +147,14 @@ Item {
186147 var menu_content = findChild(panel.indicators, "menuContent");
187148 verify(indicator_row != undefined)
188149
150+ // Wait for the indicators to get into position.
151+ // (switches between normal and fullscreen modes are animated)
152+ if (data.fullscreenFlag) {
153+ tryCompare(panel.indicators, "y", -panel.panelHeight)
154+ } else {
155+ tryCompare(panel.indicators, "y", 0)
156+ }
157+
189158 // do this for each indicator item
190159 for (var i = 0; i < row_repeater.count; i++) {
191160
@@ -194,40 +163,25 @@ Item {
194163
195164 var indicator_item_coord = get_indicator_item_position(i);
196165
197− // 1) Press on the panel
198− mousePress(panel,
199− indicator_item_coord.x, panel.panelHeight/2,
200− Qt.LeftButton, Qt.NoModifier , 0);
201−
202− if (!panel.fullscreenMode)
203− {
204− // hint animation should be run, and panel will end in partiallyOpened state.
205− compare(indicator_revealer.hintingAnimation.running, true, "Indicator revealer hint animation should be running after mouse press on indicator panel");
206− tryCompare(indicator_revealer.hintingAnimation, "running", false);
207− tryCompare(panel.indicators, "partiallyOpened", true);
208− }
209−
210− // 2) Drag the mouse down
211− var old_progress = panel.indicators.progress
212− mouseMove(panel,
213− indicator_item_coord.x, old_progress + (panel.height - old_progress)/2,
214− 0, Qt.LeftButton);
215−
216− // progress should increase.
217− var progress_increases = panel.indicators.progress > old_progress;
218− compare(progress_increases, true, "Progress has not increased on dragging indicator.");
166+ touchPress(panel,
167+ indicator_item_coord.x, panel.panelHeight / 2)
219168
220− mouseMove(panel,
221− indicator_item_coord.x, shell.y + shell.height,
222− 0, Qt.LeftButton);
169+ // 1) Drag the mouse down
170+ touchFlick(panel,
171+ indicator_item_coord.x, panel.panelHeight / 2,
172+ indicator_item_coord.x, panel.height * 0.8,
173+ false /* beginTouch */, false /* endTouch */)
223174
224− tryCompare(panel.indicators, "fullyOpened", true);
175+ // Indicators height should follow the drag, and therefore increase accordingly.
176+ // They should be at least half-way through the screen
177+ tryCompareFunction(
178+ function() {return panel.indicators.height >= panel.height * 0.5},
179+ true)
225180
226− mouseRelease(panel,
227− indicator_item_coord.x, indicator_item_coord.y + panel.height/2,
228− Qt.LeftButton, Qt.NoModifier , 0);
181+ touchRelease(panel, indicator_item_coord.x, panel.height * 0.8)
229182
230− compare(indicator_row.currentItem, indicator_item, "Incorrect item activated at position " + i);
183+ compare(indicator_row.currentItem, indicator_item,
184+ "Incorrect item activated at position " + i)
231185 compare(menu_content.__shown, true, "Menu conetent should be enabled for item at position " + i);
232186
233187 // init for next indicator_item
@@ -242,11 +196,10 @@ Item {
242196 var search_indicator = findChild(panel, "search");
243197 verify(search_indicator != undefined);
244198
245− mouseClick(search_indicator,
246− 1, 1,
247− Qt.LeftButton, Qt.NoModifier , 0);
199+ tap(search_indicator, 1, 1)
248200
249− compare(search_clicked, true, "Clicking search indicator while it was enabled did not emit searchClicked signal")
201+ compare(search_clicked, true,
202+ "Tapping search indicator while it was enabled did not emit searchClicked signal")
250203 }
251204
252205 function test_search_click_when_not_visible() {
@@ -256,11 +209,10 @@ Item {
256209 var search_indicator = findChild(panel, "search");
257210 verify(search_indicator != undefined);
258211
259− mouseClick(search_indicator,
260− 1, 1,
261− Qt.LeftButton, Qt.NoModifier , 0);
212+ tap(search_indicator, 1, 1)
262213
263− compare(search_clicked, false, "Clicking search indicator while it was not visible emitted searchClicked signal")
214+ compare(search_clicked, false,
215+ "Tapping search indicator while it was not visible emitted searchClicked signal")
264216 }
265217 }
266218}