Merge lp:~dandrader/unity8/panelDragHandle into lp:unity8

Proposed by Daniel d'Andrada
Status: Merged
Approved by: Nick Dedekind
Approved revision: 74
Merged at revision: 73
Proposed branch: lp:~dandrader/unity8/panelDragHandle
Merge into: lp:unity8
Prerequisite: lp:~dandrader/unity8/dragHandleStretchAndHint
Diff against target: 779 lines (+239/-285)
6 files modified
Panel/Indicators.qml (+114/-30)
Panel/MenuContent.qml (+1/-1)
Panel/Panel.qml (+3/-74)
tests/qmltests/CMakeLists.txt (+2/-2)
tests/qmltests/Panel/tst_Indicators.qml (+38/-49)
tests/qmltests/Panel/tst_Panel.qml (+81/-129)
To merge this branch: bzr merge lp:~dandrader/unity8/panelDragHandle
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Nick Dedekind (community) Approve
Review via email: mp+172142@code.launchpad.net

This proposal supersedes a proposal from 2013-06-28.

Commit message

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

To post a comment you must log in.
lp:~dandrader/unity8/panelDragHandle updated
60. By Daniel d'Andrada

update CODING instructions for building & running.

Approved by Daniel d'Andrada, PS Jenkins bot.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:~dandrader/unity8/panelDragHandle updated
61. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

62. By Michael Hall

Fix build script error from extra blank line. Fixes: https://bugs.launchpad.net/bugs/1196322.

Approved by PS Jenkins bot, Michał Sawicz.

63. By Albert Astals Cid

ListViewWithPageHeader implementation in C++. Fixes: https://bugs.launchpad.net/bugs/1171918.

Approved by PS Jenkins bot, Gerry Boland.

64. By Michał Sawicz

merge lp:unity8

65. By Michael Zanetti

improve the bzr commit hook

- don't run qmltests in here, it takes too long
- don't abort commit on failed tests, its too annoying
- instead, print a fat warning and backup the commit message to be reused after uncommitting and fixing the tests.

Approved by Mirco Müller, PS Jenkins bot.

66. By Daniel d'Andrada

DragHandle: add stretch and hintDisplacement properties.

Approved by PS Jenkins bot, Nick Dedekind, Albert Astals Cid.

67. By Michael Zanetti

edge hinting tweaks

  - change edge hinting behavior to only happen on onPressed and immediately snap back
  - fix edge hinting to not happen if the Greeter is locked
.

Approved by PS Jenkins bot, Daniel d'Andrada.

68. By Daniel d'Andrada

DragHandle: fix hinting

Revision 64 had a bad interaction with revision 66 (that added line was lost in the merge/rebase process). tst_DragHandle::hintingAnimation() points out the problem (fails on line 388).

Approved by Michał Sawicz, PS Jenkins bot.

69. By Daniel d'Andrada

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

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

Semi-colons (mostly in tests).
-----------------------------

68 - function handlePress() {
69 - menuContent.hideAll()
70 - menuContent.activateContent()
71 - indicators.state = "hint"
72 - }

Indicator menu's don't populate anymore. Need to call activateContent before showing.

41 + showAnimation: StandardAnimation {
42 + property: "height"
43 + duration: 350
44 + to: pinnedMode ? openedHeight - panelHeight : openedHeight
45 + easing.type: Easing.OutCubic
46 + }

48 + hideAnimation: StandardAnimation {
49 + property: "height"
50 + duration: 350
51 + to: panelHeight
52 + easing.type: Easing.OutCubic
53 + }

Perhaps we need a animation standard for showing/hiding? Each showable seems to use it's own values.
Need to ask design about this. Can you add a TODO.

60 + if (!showAnimation.running && !hideAnimation.running /*&& !revealer.hintingAnimation.running*/) {

Can you remove the comment?

244 - item.reset()
245 + //item.reset()

why commented out?

374 + property real showAnimationProgress: MathLocal.clamp(1 + x / width, 0, 1)
375 +

not used.

348 + property real unitProgress: height / parent.height

Should change between 0.0 and 1.0, but runs between about 0.04 and 0.95 meaning that background will always be slightly darkened.

-----------------------

All tests passed.

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> 244 - item.reset()
> 245 + //item.reset()
>
> why commented out?

Because of these warnings:

file:///home/dandrader/unity8/panelDragHandle/Panel/MenuContent.qml:102: TypeError: Object ClockPage_QMLTYPE_207(0x2dfa6d0) has no method 'reset'

Now I see that this is a bug in indicators-client-plugin-network. It should have a "function reset() {}" in its QML to avoid this.

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> > 244 - item.reset()
> > 245 + //item.reset()
> >
> > why commented out?
>
> Because of these warnings:
>
> file:///home/dandrader/unity8/panelDragHandle/Panel/MenuContent.qml:102:
> TypeError: Object ClockPage_QMLTYPE_207(0x2dfa6d0) has no method 'reset'
>
> Now I see that this is a bug in indicators-client-plugin-network. It should
> have a "function reset() {}" in its QML to avoid this.

It's actually indicators-client-plugin-datetime.

lp:~dandrader/unity8/panelDragHandle updated
70. By Daniel d'Andrada

Only call reset() if the indicator plugin has it

That way we avoid warnings such as:
file:///[...]/Panel/MenuContent.qml:102: TypeError: Object ClockPage_QMLTYPE_207(0x2dfa6d0) has no method 'reset'

71. By Daniel d'Andrada

Remove unused showAnimationProgress

Probably the side-efect of some rebase on top of latest trunk

72. By Daniel d'Andrada

Fixes various issues encountered during review

73. By Daniel d'Andrada

Add a TODO notice

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> Semi-colons (mostly in tests).
> -----------------------------
>
> 68 - function handlePress() {
> 69 - menuContent.hideAll()
> 70 - menuContent.activateContent()
> 71 - indicators.state = "hint"
> 72 - }
>
> Indicator menu's don't populate anymore. Need to call activateContent before
> showing.

Good catch! You can only spot the difference when trying out on the device. Would be nice to have a test on that but with all those indirections and abstractions coming from indicators-client side, I feel it would be a pain to do so.
Fixed.

>
>
> 41 + showAnimation: StandardAnimation {
> 42 + property: "height"
> 43 + duration: 350
> 44 + to: pinnedMode ? openedHeight - panelHeight : openedHeight
> 45 + easing.type: Easing.OutCubic
> 46 + }
>
> 48 + hideAnimation: StandardAnimation {
> 49 + property: "height"
> 50 + duration: 350
> 51 + to: panelHeight
> 52 + easing.type: Easing.OutCubic
> 53 + }
>
> Perhaps we need a animation standard for showing/hiding? Each showable seems
> to use it's own values.
> Need to ask design about this. Can you add a TODO.

Done.

>
>
> 60 + if (!showAnimation.running && !hideAnimation.running /*&&
> !revealer.hintingAnimation.running*/) {
>
> Can you remove the comment?

Done.

>
>
> 244 - item.reset()
> 245 + //item.reset()
>
> why commented out?

Fixed. Explained on a previous reply.

>
>
> 374 + property real showAnimationProgress: MathLocal.clamp(1 + x /
> width, 0, 1)
> 375 +
>
> not used.

Removed. Wonder where that came from. Maybe the result of some previous syncs with trunk

>
> 348 + property real unitProgress: height / parent.height
>
> Should change between 0.0 and 1.0, but runs between about 0.04 and 0.95
> meaning that background will always be slightly darkened.
>

Jeez, would have never found that. Thanks for spotting this! Fixed.

There's a lot going on in the indicators animations. So unfortunately the resulting QML is still rather puzzling (openedHeight vs. referenceOpenendHeight, handle being outside its parent and growing separately, etc) and refactoring is still tricky (we don't have enough tests to cover all that panel does)

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~dandrader/unity8/panelDragHandle updated
74. By Daniel d'Andrada

Update tst_Indicators.test_fully_open()

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

the lack of the reset is just a bug in indicators-client.

> There's a lot going on in the indicators animations. So unfortunately the
> resulting QML is still rather puzzling (openedHeight vs.
> referenceOpenendHeight, handle being outside its parent and growing
> separately, etc) and refactoring is still tricky (we don't have enough tests
> to cover all that panel does)

Yes, it's been in a bit of a mess for a while. I'm going to give it another pass and try simplify when I get back on the behaviour mods.

LGTM.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Panel/Indicators.qml'
2--- Panel/Indicators.qml 2013-06-05 22:03:08 +0000
3+++ Panel/Indicators.qml 2013-07-03 09:07:29 +0000
4@@ -16,32 +16,49 @@
5
6 import QtQuick 2.0
7 import Ubuntu.Components 0.1
8+import Ubuntu.Gestures 0.1
9 import Ubuntu.ChewieUI 0.1 as ChewieUI
10
11 import "../Components"
12+import "../Components/ListItems"
13 import "../Components/Math.js" as MathLocal
14
15 Showable {
16 id: indicators
17
18- property int progress: panelHeight
19- property int openedHeight: units.gu(71)
20+ property int referenceOpenedHeight: units.gu(71)
21+ property real openedHeight: pinnedMode ? referenceOpenedHeight - panelHeight
22+ : referenceOpenedHeight
23 property int panelHeight: units.gu(3)
24 property bool pinnedMode: true //should be set true if indicators menu can cover whole screen
25
26 property int hintValue
27- readonly property int lockThreshold: shell.height/2
28- property bool fullyOpened: revealer ? progress == revealer.openedValue : false
29- property bool partiallyOpened: revealer ? progress > revealer.closedValue && progress < revealer.openedValue : false
30-
31- property Revealer revealer: null
32-
33- height: menuContent.height + handle.height + menuContent.y
34-
35- onProgressChanged: {
36- // need to use handle.get_height(). As the handle height depends on progress changes (but this is called first!)
37- var contentProgress = progress - handle.get_height()
38- if (!showAnimation.running && !hideAnimation.running && !revealer.hintingAnimation.running) {
39+ readonly property int lockThreshold: referenceOpenedHeight / 2
40+ property bool fullyOpened: height == openedHeight
41+ property bool partiallyOpened: height > panelHeight && !fullyOpened
42+
43+ // 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.
45+ showAnimation: StandardAnimation {
46+ property: "height"
47+ duration: 350
48+ to: openedHeight
49+ easing.type: Easing.OutCubic
50+ }
51+
52+ hideAnimation: StandardAnimation {
53+ property: "height"
54+ duration: 350
55+ to: panelHeight
56+ easing.type: Easing.OutCubic
57+ }
58+
59+ height: panelHeight
60+
61+ onHeightChanged: {
62+ // need to use handle.get_height(). As the handle height depends on indicators.height changes (but this is called first!)
63+ var contentProgress = indicators.height - handle.get_height()
64+ if (!showAnimation.running && !hideAnimation.running) {
65 if (contentProgress <= hintValue && indicators.state == "reveal") {
66 indicators.state = "hint"
67 menuContent.hideAll()
68@@ -66,12 +83,6 @@
69 }
70 }
71
72- function handlePress() {
73- menuContent.hideAll()
74- menuContent.activateContent()
75- indicators.state = "hint"
76- }
77-
78 function openOverview() {
79 indicatorRow.currentItem = null
80 menuContent.showOverview()
81@@ -91,7 +102,9 @@
82 If bar is dragged down a distance greater than or equal to lockThreshold, this is 1.
83 Otherwise it contains the bar's location as a fraction of the distance between hintValue (is 0) and lockThreshold (is 1).
84 */
85- var verticalProgress = MathLocal.clamp((indicators.progress - handle.height - hintValue) / (lockThreshold - hintValue), 0, 1)
86+ var verticalProgress =
87+ MathLocal.clamp((indicators.height - handle.height - hintValue) /
88+ (lockThreshold - hintValue), 0, 1)
89
90 /*
91 Percentage of an indicator icon's width the user's press can stray horizontally from the
92@@ -139,6 +152,17 @@
93 }
94 }
95
96+ VerticalThinDivider {
97+ anchors {
98+ top: indicators.top
99+ topMargin: panelHeight
100+ bottom: handle.bottom
101+ right: indicators.left
102+ }
103+ width: units.dp(2)
104+ source: "graphics/VerticalDivider.png"
105+ }
106+
107 MenuContent {
108 id: menuContent
109 objectName: "menuContent"
110@@ -147,8 +171,8 @@
111 left: parent.left
112 right: parent.right
113 top: indicatorRow.bottom
114+ bottom: parent.bottom
115 }
116- height: progress - y
117 indicatorsModel: indicatorsModel
118 animate: false
119 clip: indicators.partiallyOpened
120@@ -187,7 +211,7 @@
121 clip: height < handleImage.height
122
123 function get_height() {
124- return Math.max(Math.min(handleImage.height, progress - handleImage.height), 0)
125+ return Math.max(Math.min(handleImage.height, indicators.height - handleImage.height), 0)
126 }
127
128 BorderImage {
129@@ -205,6 +229,29 @@
130 }
131 }
132
133+ PanelSeparatorLine {
134+ id: indicatorsSeparatorLine
135+ visible: true
136+ anchors {
137+ top: handle.bottom
138+ left: indicators.left
139+ right: indicators.right
140+ }
141+ }
142+
143+ BorderImage {
144+ id: dropShadow
145+ anchors {
146+ top: indicators.top
147+ bottom: indicatorsSeparatorLine.bottom
148+ left: indicators.left
149+ right: indicators.right
150+ margins: -units.gu(1)
151+ }
152+ visible: indicators.height > panelHeight
153+ source: "graphics/rectangular_dropshadow.sci"
154+ }
155+
156 PanelBackground {
157 anchors.fill: indicatorRow
158 }
159@@ -249,7 +296,7 @@
160 openOverview()
161 }
162 else {
163- indicators.calculateCurrentItem(revealer.lateralPosition, false)
164+ indicators.calculateCurrentItem(dragHandle.touchX, false)
165 menuContent.showMenu()
166 }
167 indicators.state = "commit"
168@@ -258,10 +305,10 @@
169 }
170
171 Connections {
172- target: revealer
173- onLateralPositionChanged: {
174- var buffer = revealer.dragging ? true : false
175- indicators.calculateCurrentItem(revealer.lateralPosition, buffer)
176+ target: dragHandle
177+ onTouchXChanged: {
178+ var buffer = dragHandle.dragging ? true : false
179+ indicators.calculateCurrentItem(dragHandle.touchX, buffer)
180 }
181 }
182
183@@ -277,6 +324,43 @@
184 state = last_state;
185 }
186
187+ property var dragHandle: showDragHandle.dragging ? showDragHandle : hideDragHandle
188+ DragHandle {
189+ id: showDragHandle
190+ anchors.bottom: parent.bottom
191+ // go beyond parent so that it stays reachable, at the top of the screen.
192+ anchors.bottomMargin: pinnedMode ? 0 : -panelHeight
193+ anchors.left: parent.left
194+ anchors.right: parent.right
195+ height: panelHeight
196+ direction: Direction.Downwards
197+ enabled: !indicators.shown
198+ hintDisplacement: pinnedMode ? indicators.hintValue : 0
199+ autoCompleteDragThreshold: maxTotalDragDistance / 2
200+ stretch: true
201+ maxTotalDragDistance: openedHeight - handle.height
202+ distanceThreshold: pinnedMode ? 0 : units.gu(3)
203+
204+ onStatusChanged: {
205+ if (status === DirectionalDragArea.Recognized) {
206+ menuContent.hideAll()
207+ menuContent.activateContent()
208+ }
209+ }
210+ }
211+ DragHandle {
212+ id: hideDragHandle
213+ anchors.fill: handle
214+ height: panelHeight
215+ direction: Direction.Upwards
216+ enabled: indicators.shown
217+ hintDisplacement: units.gu(2)
218+ autoCompleteDragThreshold: maxTotalDragDistance / 6
219+ stretch: true
220+ maxTotalDragDistance: referenceOpenedHeight - 2*panelHeight
221+ distanceThreshold: 0
222+ }
223+
224 property list<State> offScreenModeStates: [
225 State {
226 name: "initial"
227@@ -289,7 +373,7 @@
228 name: "reveal"
229 extend: "hint"
230 PropertyChanges { target: menuContent; animate: true }
231- StateChangeScript { script: calculateCurrentItem(revealer.lateralPosition, false); }
232+ StateChangeScript { script: calculateCurrentItem(dragHandle.touchX, false); }
233 },
234 State {
235 name: "locked"
236@@ -311,7 +395,7 @@
237 State {
238 name: "reveal"
239 PropertyChanges { target: menuContent; animate: true }
240- StateChangeScript { script: calculateCurrentItem(revealer.lateralPosition, false); }
241+ StateChangeScript { script: calculateCurrentItem(dragHandle.touchX, false); }
242 },
243 State {
244 name: "locked"
245
246=== modified file 'Panel/MenuContent.qml'
247--- Panel/MenuContent.qml 2013-06-05 22:03:08 +0000
248+++ Panel/MenuContent.qml 2013-07-03 09:07:29 +0000
249@@ -98,7 +98,7 @@
250 visible: content.__shown
251 onVisibleChanged: {
252 // Reset the indicator states
253- if (!visible && item) {
254+ if (!visible && item && item["reset"]) {
255 item.reset()
256 }
257 }
258
259=== modified file 'Panel/Panel.qml'
260--- Panel/Panel.qml 2013-06-05 22:03:08 +0000
261+++ Panel/Panel.qml 2013-07-03 09:07:29 +0000
262@@ -17,7 +17,6 @@
263 import QtQuick 2.0
264 import Ubuntu.Components 0.1
265 import "../Components"
266-import "../Components/ListItems"
267
268 Item {
269 id: root
270@@ -75,29 +74,6 @@
271 }
272 }
273
274- BorderImage {
275- id: dropShadow
276- anchors {
277- top: indicatorsMenu.top
278- bottom: indicatorsSeparatorLine.bottom
279- left: indicatorsMenu.left
280- right: indicatorsMenu.right
281- margins: -units.gu(1)
282- }
283- visible: indicatorsMenu.progress != indicatorRevealer.closedValue
284- source: "graphics/rectangular_dropshadow.sci"
285- }
286-
287- VerticalThinDivider {
288- anchors {
289- top: leftSeparatorLine.top
290- bottom: indicatorsSeparatorLine.top
291- right: indicatorsMenu.left
292- }
293- width: units.dp(2)
294- source: "graphics/VerticalDivider.png"
295- }
296-
297 Indicators {
298 id: indicatorsMenu
299
300@@ -105,58 +81,13 @@
301 y: 0
302 width: root.indicatorsMenuWidth
303 shown: false
304- revealer: indicatorRevealer
305- hintValue: indicatorRevealer.hintDisplacement
306+ hintValue: __panelMinusSeparatorLineHeight * 3
307 panelHeight: __panelMinusSeparatorLineHeight
308- showAnimation: StandardAnimation { property: "progress"; duration: 350; to: indicatorRevealer.openedValue; easing.type: Easing.OutCubic }
309- hideAnimation: StandardAnimation { property: "progress"; duration: 350; to: indicatorRevealer.closedValue; easing.type: Easing.OutCubic }
310- openedHeight: parent.height
311+ referenceOpenedHeight: parent.height
312
313 pinnedMode: !fullscreenMode
314
315- property real unitProgress: (indicatorRevealer.closedValue - progress) / (indicatorRevealer.closedValue - indicatorRevealer.openedValue)
316- }
317-
318- PanelSeparatorLine {
319- id: indicatorsSeparatorLine
320- anchors {
321- top: indicatorsMenu.bottom
322- left: indicatorsMenu.left
323- right: parent.right
324- }
325- }
326-
327- Revealer {
328- id: indicatorRevealer
329- objectName: "indicatorRevealer"
330-
331- width: root.indicatorsMenuWidth
332- anchors {
333- top: parent.top
334- bottom: parent.bottom
335- right: parent.right
336- }
337- target: indicatorsMenu
338- handleSize: __panelMinusSeparatorLineHeight
339- closedValue: __panelMinusSeparatorLineHeight
340- dragVelocityThreshold: units.dp(1)
341- boundProperty: "progress"
342- hintDisplacement: __panelMinusSeparatorLineHeight * 3
343- openOnPress: !fullscreenMode
344- orientation: Qt.Vertical
345-
346- onOpenClicked: {
347- indicatorsMenu.openOverview();
348- indicatorsMenu.show();
349- }
350- onCloseClicked: indicatorsMenu.hide();
351-
352- onOpenPressed: indicatorsMenu.handlePress()
353-
354- function dragToValue(dragPosition) {
355- var offset = target.shown ? 0 : -hintDisplacement + handleSize;
356- return dragPosition + offset;
357- }
358+ property real unitProgress: (height - panelHeight) / (openedHeight - panelHeight)
359 }
360
361 SearchIndicator {
362@@ -192,13 +123,11 @@
363 name: "in" //fully opaque and visible at top edge of screen
364 when: !fullscreenMode
365 PropertyChanges { target: panelBackground; y: 0 }
366- PropertyChanges { target: indicatorRevealer; openedValue: indicatorsMenu.openedHeight - panelHeight }
367 },
368 State {
369 name: "out" //pushed off screen
370 when: fullscreenMode
371 PropertyChanges { target: panelBackground; y: -panelHeight }
372- PropertyChanges { target: indicatorRevealer; openedValue: indicatorsMenu.openedHeight }
373 }
374 ]
375 }
376
377=== modified file 'tests/qmltests/CMakeLists.txt'
378--- tests/qmltests/CMakeLists.txt 2013-07-01 08:00:40 +0000
379+++ tests/qmltests/CMakeLists.txt 2013-07-03 09:07:29 +0000
380@@ -60,10 +60,10 @@
381 add_qml_test(Launcher Launcher IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
382 add_qml_test(Notifications Notifications IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_CURRENT_SOURCE_DIR}/plugins)
383 add_qml_test(Panel IndicatorRow)
384-add_qml_test(Panel Indicators)
385+add_qml_test(Panel Indicators IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
386 add_qml_test(Panel MenuContent)
387 add_qml_test(Panel Overview)
388-add_qml_test(Panel Panel)
389+add_qml_test(Panel Panel IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS})
390 add_qml_test(Panel SearchIndicator)
391 add_qml_test(Panel/Menus IndicatorMenuWindow IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS})
392 add_qml_test(SideStage SideStage IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS}
393
394=== modified file 'tests/qmltests/Panel/tst_Indicators.qml'
395--- tests/qmltests/Panel/tst_Indicators.qml 2013-06-05 22:03:08 +0000
396+++ tests/qmltests/Panel/tst_Indicators.qml 2013-07-03 09:07:29 +0000
397@@ -42,23 +42,9 @@
398 }
399 width: (shell.width > units.gu(60)) ? units.gu(40) : shell.width
400 y: 0
401- hintValue: indicatorRevealer.hintDisplacement
402 shown: false
403- revealer: indicatorRevealer
404
405 openedHeight: parent.height - click_me.height
406-
407- showAnimation: NumberAnimation { property: "progress"; duration: 350; to: indicatorRevealer.openedValue; easing.type: Easing.OutCubic }
408- hideAnimation: NumberAnimation { property: "progress"; duration: 350; to: indicatorRevealer.closedValue; easing.type: Easing.OutCubic }
409- }
410-
411- Revealer {
412- anchors.fill: indicators
413- id: indicatorRevealer
414- hintDisplacement: indicators.panelHeight * 3
415-
416- openedValue: indicators.openedHeight - indicators.panelHeight
417- closedValue: indicators.panelHeight
418 }
419
420 // Just a rect for clicking to open the indicators.
421@@ -153,60 +139,63 @@
422 {
423 // tests changing the lateral position of the revealer activates the correct indicator items.
424
425- // This "should" put the indicators in "hint" state
426- indicators.progress = indicators.hintValue;
427-
428 var indicator_row = findChild(indicators, "indicatorRow")
429 var row_repeater = findChild(indicators, "rowRepeater")
430
431 for (var i = 0; i < row_repeater.count; i++) {
432 var indicator_item = row_repeater.itemAt(i);
433
434- var indicator_position = indicator_row.row.x + indicator_item.x + indicator_item.width/2;
435-
436- indicatorRevealer.lateralPosition = indicator_position;
437-
438- compare(indicator_row.currentItem, indicator_item, "Incorrect item activated at position " + i);
439+ var indicator_position = indicators.mapFromItem(indicator_item,
440+ indicator_item.width/2, indicator_item.height/2)
441+
442+ touchFlick(indicators,
443+ indicator_position.x, indicator_position.y,
444+ indicator_position.x, indicators.openedHeight * 0.4,
445+ true /* beginTouch */, false /* endTouch */)
446+
447+ compare(indicator_row.currentItem, indicator_item,
448+ "Incorrect item activated at position " + i);
449+
450+ touchFlick(indicators,
451+ indicator_position.x, indicators.openedHeight * 0.4,
452+ indicator_position.x, indicator_position.y,
453+ false /* beginTouch */, true /* endTouch */)
454+
455+ // wait until fully closed
456+ tryCompare(indicators, "height", indicators.panelHeight)
457 }
458 }
459
460- // PROGRESS TESTS
461-
462- // values for specific state changes are subject to internal decisions, so we can't determine the true progress value
463- // which would cause the state to change without making too many assuptyions
464- // However, we can assume that a partially opened panel will not be initial, and fully opened panel will be locked.
465+ // values for specific state changes are subject to internal decisions, so we can't
466+ // determine the true height value which would cause the state to change without making
467+ // too many assuptyions
468+ // However, we can assume that a partially opened panel will not be initial, and fully
469+ // opened panel will be locked.
470
471 function test_progress_changes_state_to_not_initial() {
472- indicators.progress = indicatorRevealer.closedValue + (indicatorRevealer.openedValue - indicatorRevealer.closedValue)/2;
473- compare(indicators.state!="initial", true, "Indicators should not be in initial state when partially opened.");
474+ indicators.height = indicators.openedHeight / 2
475+ compare(indicators.state!="initial", true,
476+ "Indicators should not be in initial state when partially opened.")
477 }
478
479 function test_progress_changes_state_to_locked() {
480- indicators.progress = indicators.openedHeight;
481- compare(indicators.state, "locked", "Indicators should be locked when fully opened.");
482+ indicators.height = indicators.openedHeight - indicators.panelHeight
483+ compare(indicators.state, "locked", "Indicators should be locked when fully opened.")
484 }
485
486 function test_partially_open() {
487- indicators.progress = indicatorRevealer.closedValue + (indicatorRevealer.openedValue - indicatorRevealer.closedValue)/2;
488- compare(indicators.partiallyOpened, true, "Indicator should show as partially opened when in between revealer closedValue & openedValue height");
489- compare(indicators.fullyOpened, false, "Indicator should not show as fully opened when in between revealer closedValue & openedValue height");
490+ indicators.height = indicators.openedHeight / 2
491+ compare(indicators.partiallyOpened, true,
492+ "Indicator should show as partially opened when height is half of openedHeight")
493+ compare(indicators.fullyOpened, false,
494+ "Indicator should not show as fully opened when height is half of openedHeight")
495 }
496
497 function test_fully_open() {
498- indicators.progress = indicatorRevealer.openedValue
499- compare(indicators.partiallyOpened, false, "Indicator should show as fully opened when in between revealer closedValue & openedValue height");
500- compare(indicators.fullyOpened, true, "Indicator should not show as fully opened when at revealer openedValue height");
501- }
502-
503- // The indicator menu content should be shown if the indicators are show through an animation before they
504- // enter a furthur state through a progress change (eg press indicator row, drag down a less then hint
505- // threshold and release to show
506- function test_menu_open_on_hint_drag() {
507- indicators.handlePress();
508- indicators.show()
509-
510- var menuContent = findChild(indicators, "menuContent")
511- compare(menuContent.__shown, true, "Indicator menu content should be shown after a indicator show.");
512- }
513+ indicators.height = indicators.openedHeight
514+ compare(indicators.partiallyOpened, false);
515+ compare(indicators.fullyOpened, true);
516+ }
517+
518 }
519 }
520
521=== modified file 'tests/qmltests/Panel/tst_Panel.qml'
522--- tests/qmltests/Panel/tst_Panel.qml 2013-06-05 22:03:08 +0000
523+++ tests/qmltests/Panel/tst_Panel.qml 2013-07-03 09:07:29 +0000
524@@ -78,92 +78,56 @@
525 return panel.mapFromItem(indicator_item, indicator_item.width/2, indicator_item.height/2);
526 }
527
528- function test_hint_data() { return get_window_data() }
529-
530 // Pressing on the indicator panel should activate the indicator hints
531 // and expose a portion of the conent.
532- function test_hint(data) {
533- panel.fullscreenMode = data.fullscreenFlag;
534-
535- var indicator_item_coord = get_indicator_item_position(0);
536- var indicator_revealer = findChild(panel, "indicatorRevealer");
537- verify(indicator_revealer != undefined)
538-
539- mousePress(panel,
540- indicator_item_coord.x, panel.panelHeight/2,
541- Qt.LeftButton, Qt.NoModifier , 0);
542-
543- if (!panel.fullscreenMode)
544- {
545- compare(indicator_revealer.hintingAnimation.running, true, "Indicator revealer hint animation should be running after mouse press on indicator panel in pinned mode");
546- tryCompare(indicator_revealer.hintingAnimation, "running", false);
547- tryCompare(panel.indicators, "partiallyOpened", true);
548- }
549- else
550- {
551- // nothing should happen
552- compare(indicator_revealer.hintingAnimation.running, false, "Indicator revealer hint animation should not be running after mouse press on indicator panel in fullscreen mode");
553- compare(panel.indicators.partiallyOpened, false, "Indicator should not be partially opened when panel is pressed in fullscreenmode");
554- compare(panel.indicators.fullyOpened, false, "Indicator should not be partially opened when panel is pressed in fullscreenmode");
555- }
556-
557- mouseRelease(panel,
558- indicator_item_coord.x, panel.panelHeight/2,
559- Qt.LeftButton, Qt.NoModifier , 0);
560- }
561-
562- function test_show_click_data() { return get_window_data() }
563-
564- // Clicking the indicator panel should fully open the inidicators
565- function test_show_click(data) {
566- panel.fullscreenMode = data.fullscreenFlag;
567-
568- var indicator_item_coord = get_indicator_item_position(0);
569-
570- mouseClick(panel,
571- indicator_item_coord.x, panel.panelHeight/2,
572- Qt.LeftButton, Qt.NoModifier , 0);
573-
574- if (!panel.fullscreenMode)
575- {
576- compare(panel.indicators.showAnimation.running, true, "Show animation should run after panel is clicked in pinned mode.");
577- tryCompare(panel.indicators, "fullyOpened", true);
578-
579- // click will activate device overview.
580- compare(findChild(panel.indicators, "indicatorRow").overviewActive, true, "Overview indicator should be avtive when indicators clicked.")
581- }
582- else
583- {
584- compare(panel.indicators.showAnimation.running, false, "Indicators should not open when panel is clicked in pinned mode.");
585- }
586- }
587-
588- function test_show_press_release_data() { return get_window_data() }
589-
590- // Pressing and releasing on the indicator panel will fully open the indicators
591- function test_show_press_release(data) {
592- panel.fullscreenMode = data.fullscreenFlag;
593-
594- var indicator_item_coord = get_indicator_item_position(0);
595-
596- mousePress(panel,
597- indicator_item_coord.x, panel.panelHeight/2,
598- Qt.LeftButton, Qt.NoModifier , 0);
599-
600- mouseRelease(panel,
601- indicator_item_coord.x, panel.panelHeight/2,
602- Qt.LeftButton, Qt.NoModifier , 0);
603-
604- if (!panel.fullscreenMode)
605- {
606- compare(panel.indicators.showAnimation.running, true, "Show animation should run after panel is clicked in pinned mode.");
607- tryCompare(panel.indicators, "fullyOpened", true);
608- }
609- else
610- {
611- // nothing should happen.
612- compare(panel.indicators.showAnimation.running, false, "Indicators should not open when panel is clicked in pinned mode.");
613- }
614+ function test_hint() {
615+ panel.fullscreenMode = false;
616+ // Wait for the indicators to get into position.
617+ // (switches between normal and fullscreen modes are animated)
618+ tryCompare(panel.indicators, "y", 0)
619+
620+ var indicator_item_coord = get_indicator_item_position(0);
621+
622+ touchPress(panel, indicator_item_coord.x, panel.panelHeight / 2)
623+
624+ // hint animation should be run, meaning that indicators will move downwards
625+ // by hintValue pixels without any drag taking place
626+ tryCompare(panel.indicators, "height",
627+ panel.indicators.panelHeight + panel.indicators.hintValue);
628+ tryCompare(panel.indicators, "partiallyOpened", true);
629+ tryCompare(panel.indicators, "fullyOpened", false);
630+
631+ touchRelease(panel, indicator_item_coord.x, panel.panelHeight/2)
632+ }
633+
634+ // Pressing on the top edge of the screen should have no effect if the panel
635+ // is hidden (!pinned), which is the case when a fullscreen app is being shown
636+ function test_noHintOnFullscreenMode() {
637+ panel.fullscreenMode = true;
638+ // Wait for the indicators to get into position.
639+ // (switches between normal and fullscreen modes are animated)
640+ tryCompare(panel.indicators, "y", -panel.panelHeight)
641+
642+ var indicator_item_coord = get_indicator_item_position(0);
643+
644+ touchPress(panel, indicator_item_coord.x, panel.panelHeight / 2)
645+
646+ // Give some time for a hint animation to change things, if any
647+ wait(500)
648+
649+ // no hint animation when fullscreen
650+ compare(panel.indicators.y, -panel.panelHeight)
651+ var indicatorRow = findChild(panel.indicators, "indicatorRow");
652+ verify(indicatorRow != undefined)
653+ compare(indicatorRow.y, 0)
654+ compare(panel.indicators.height, panel.indicators.panelHeight)
655+ compare(panel.indicators.partiallyOpened, false,
656+ "Indicator should not be partially opened when panel is pressed in" +
657+ " fullscreenmode")
658+ compare(panel.indicators.fullyOpened, false, "Indicator should not be partially" +
659+ " opened when panel is pressed in fullscreenmode")
660+
661+ touchRelease(panel, indicator_item_coord.x, panel.panelHeight/2)
662 }
663
664 function test_drag_show_data() { return get_window_data() }
665@@ -174,9 +138,6 @@
666 function test_drag_show(data) {
667 panel.fullscreenMode = data.fullscreenFlag;
668
669- var indicator_revealer = findChild(panel, "indicatorRevealer");
670- verify(indicator_revealer != undefined)
671-
672 var indicator_row = findChild(panel.indicators, "indicatorRow");
673 verify(indicator_row != undefined)
674
675@@ -186,6 +147,14 @@
676 var menu_content = findChild(panel.indicators, "menuContent");
677 verify(indicator_row != undefined)
678
679+ // Wait for the indicators to get into position.
680+ // (switches between normal and fullscreen modes are animated)
681+ if (data.fullscreenFlag) {
682+ tryCompare(panel.indicators, "y", -panel.panelHeight)
683+ } else {
684+ tryCompare(panel.indicators, "y", 0)
685+ }
686+
687 // do this for each indicator item
688 for (var i = 0; i < row_repeater.count; i++) {
689
690@@ -194,40 +163,25 @@
691
692 var indicator_item_coord = get_indicator_item_position(i);
693
694- // 1) Press on the panel
695- mousePress(panel,
696- indicator_item_coord.x, panel.panelHeight/2,
697- Qt.LeftButton, Qt.NoModifier , 0);
698-
699- if (!panel.fullscreenMode)
700- {
701- // hint animation should be run, and panel will end in partiallyOpened state.
702- compare(indicator_revealer.hintingAnimation.running, true, "Indicator revealer hint animation should be running after mouse press on indicator panel");
703- tryCompare(indicator_revealer.hintingAnimation, "running", false);
704- tryCompare(panel.indicators, "partiallyOpened", true);
705- }
706-
707- // 2) Drag the mouse down
708- var old_progress = panel.indicators.progress
709- mouseMove(panel,
710- indicator_item_coord.x, old_progress + (panel.height - old_progress)/2,
711- 0, Qt.LeftButton);
712-
713- // progress should increase.
714- var progress_increases = panel.indicators.progress > old_progress;
715- compare(progress_increases, true, "Progress has not increased on dragging indicator.");
716-
717- mouseMove(panel,
718- indicator_item_coord.x, shell.y + shell.height,
719- 0, Qt.LeftButton);
720-
721- tryCompare(panel.indicators, "fullyOpened", true);
722-
723- mouseRelease(panel,
724- indicator_item_coord.x, indicator_item_coord.y + panel.height/2,
725- Qt.LeftButton, Qt.NoModifier , 0);
726-
727- compare(indicator_row.currentItem, indicator_item, "Incorrect item activated at position " + i);
728+ touchPress(panel,
729+ indicator_item_coord.x, panel.panelHeight / 2)
730+
731+ // 1) Drag the mouse down
732+ touchFlick(panel,
733+ indicator_item_coord.x, panel.panelHeight / 2,
734+ indicator_item_coord.x, panel.height * 0.8,
735+ false /* beginTouch */, false /* endTouch */)
736+
737+ // Indicators height should follow the drag, and therefore increase accordingly.
738+ // They should be at least half-way through the screen
739+ tryCompareFunction(
740+ function() {return panel.indicators.height >= panel.height * 0.5},
741+ true)
742+
743+ touchRelease(panel, indicator_item_coord.x, panel.height * 0.8)
744+
745+ compare(indicator_row.currentItem, indicator_item,
746+ "Incorrect item activated at position " + i)
747 compare(menu_content.__shown, true, "Menu conetent should be enabled for item at position " + i);
748
749 // init for next indicator_item
750@@ -242,11 +196,10 @@
751 var search_indicator = findChild(panel, "search");
752 verify(search_indicator != undefined);
753
754- mouseClick(search_indicator,
755- 1, 1,
756- Qt.LeftButton, Qt.NoModifier , 0);
757+ tap(search_indicator, 1, 1)
758
759- compare(search_clicked, true, "Clicking search indicator while it was enabled did not emit searchClicked signal")
760+ compare(search_clicked, true,
761+ "Tapping search indicator while it was enabled did not emit searchClicked signal")
762 }
763
764 function test_search_click_when_not_visible() {
765@@ -256,11 +209,10 @@
766 var search_indicator = findChild(panel, "search");
767 verify(search_indicator != undefined);
768
769- mouseClick(search_indicator,
770- 1, 1,
771- Qt.LeftButton, Qt.NoModifier , 0);
772+ tap(search_indicator, 1, 1)
773
774- compare(search_clicked, false, "Clicking search indicator while it was not visible emitted searchClicked signal")
775+ compare(search_clicked, false,
776+ "Tapping search indicator while it was not visible emitted searchClicked signal")
777 }
778 }
779 }

Subscribers

People subscribed via source and target branches