Merge lp:~ahayzen/music-app/remix-remove-legacy-toolbar into lp:music-app/remix
- remix-remove-legacy-toolbar
- Merge into remix
Status: | Merged |
---|---|
Approved by: | Victor Thompson |
Approved revision: | 664 |
Merged at revision: | 655 |
Proposed branch: | lp:~ahayzen/music-app/remix-remove-legacy-toolbar |
Merge into: | lp:music-app/remix |
Diff against target: |
1418 lines (+192/-740) 6 files modified
MusicNowPlaying.qml (+28/-16) MusicToolbar.qml (+3/-594) common/MusicPage.qml (+1/-1) music-app.qml (+1/-2) tests/autopilot/music_app/__init__.py (+99/-81) tests/autopilot/music_app/tests/test_music.py (+60/-46) |
To merge this branch: | bzr merge lp:~ahayzen/music-app/remix-remove-legacy-toolbar |
Related bugs: | |
Related blueprints: |
Music Remix for RTM
(Essential)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Victor Thompson | Approve | ||
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Review via email:
|
Commit message
* Remove legacy toolbar code
* Make full (non listview) now playing default
* Fix header disappearing in full now playing
Description of the change
* Remove legacy toolbar code
* Make full (non listview) now playing default
* Fix header disappearing in full now playing
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
- 653. By Andrew Hayzen
-
* Various fixes for autopilot
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:653
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 654. By Andrew Hayzen
-
* Fix for autopilot
- 655. By Andrew Hayzen
-
* Fix for missed case
- 656. By Andrew Hayzen
-
* Remove ensuring visible as this method is called sometimes when the now playing is not the currentPage
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:654
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:656
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 657. By Andrew Hayzen
-
* Further fixes for autopilot
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:657
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 658. By Andrew Hayzen
-
* Fix for pyflakes
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:658
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 659. By Andrew Hayzen
-
* Wait for now playing page to be visible when switching
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:659
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 660. By Andrew Hayzen
-
* Reget now playing page after switching
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:660
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Victor Thompson (vthompson) wrote : | # |
So far the code looks good and the test updates seem sane.
However, there are two things that don't seem to work properly:
1. In the Now Playing list view the swipe to add to playlist doesn't appear to work. Essentially, the app doesn't present the playlist chooser and instead ejects the user to the root tab they were previously on.
2. There seems to be issues removing items from the Now Playing list view. When I swipe to delete the now playing item, or sometimes other items IIRC, they aren't actually removed from the list. Other odd things are happening, such as removing a non-playing item causing the currently enlarged art to change.
I'm not sure what is going on with the second issue, but it would benefit from simplifying the Now Playing list per the redesign we are supposed to get.
- 661. By Andrew Hayzen
-
* Fix for pagestack jumping
* Added extra code comment
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Andrew Hayzen (ahayzen) wrote : | # |
1) Fixed Tim suggested modifying the head.backAction for just the now playing page to do the extra pops, this works in a much less hacky way :)
2) I'm not able to reproduce this on device, seems fine to me?
Added code comment as suggested in the inline diff comments.
- 662. By Andrew Hayzen
-
* Merge of trunk
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:662
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 663. By Andrew Hayzen
-
* Add objectName for back button
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Continuous integration, rev:663
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 664. By Andrew Hayzen
-
* Use custom back button
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:664
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Victor Thompson (vthompson) wrote : | # |
I can get the app to have a mismatch between the now playing large art and the song shown in the toolbar pretty easily by swiping to delete a now playing large cover art: http://
I'm not sure exactly what the fix is for this.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Victor Thompson (vthompson) wrote : | # |
The bug mentioned above was not introduced by this code change, so we will not block on it. This LGTM!
Preview Diff
1 | === modified file 'MusicNowPlaying.qml' |
2 | --- MusicNowPlaying.qml 2014-10-06 00:26:56 +0000 |
3 | +++ MusicNowPlaying.qml 2014-10-07 15:28:54 +0000 |
4 | @@ -28,19 +28,31 @@ |
5 | |
6 | MusicPage { |
7 | id: nowPlaying |
8 | + flickable: isListView ? queuelist : null // Ensures that the header is shown in fullview |
9 | objectName: "nowPlayingPage" |
10 | title: i18n.tr("Now Playing") |
11 | visible: false |
12 | onVisibleChanged: { |
13 | if (!visible) { |
14 | // Reset the isListView property |
15 | - // TODO: In the future this will default to false |
16 | - isListView = true |
17 | + isListView = false |
18 | } |
19 | } |
20 | |
21 | property int ensureVisibleIndex: 0 // ensure first index is visible at startup |
22 | - property bool isListView: true |
23 | + property bool isListView: false |
24 | + |
25 | + head.backAction: Action { |
26 | + iconName: "back"; |
27 | + objectName: "backButton" |
28 | + onTriggered: { |
29 | + mainPageStack.pop(); |
30 | + |
31 | + while (mainPageStack.depth > 1) { // jump back to the tab layer if via SongsPage |
32 | + mainPageStack.pop(); |
33 | + } |
34 | + } |
35 | + } |
36 | |
37 | head { |
38 | actions: [ |
39 | @@ -88,10 +100,9 @@ |
40 | |
41 | Rectangle { |
42 | id: fullview |
43 | - visible: !isListView |
44 | anchors.fill: parent |
45 | color: "transparent" |
46 | - clip: true |
47 | + visible: !isListView |
48 | |
49 | BlurredBackground { |
50 | id: blurredBackground |
51 | @@ -195,6 +206,7 @@ |
52 | id: progressSliderMusic |
53 | anchors.left: parent.left |
54 | anchors.right: parent.right |
55 | + objectName: "progressSliderShape" |
56 | function formatValue(v) { return durationToString(v) } |
57 | |
58 | property bool seeking: false |
59 | @@ -255,7 +267,6 @@ |
60 | /* Repeat button */ |
61 | MouseArea { |
62 | id: nowPlayingRepeatButton |
63 | - objectName: "repeatShape" |
64 | anchors.right: nowPlayingPreviousButton.left |
65 | anchors.rightMargin: units.gu(1) |
66 | anchors.verticalCenter: nowPlayingPlayButton.verticalCenter |
67 | @@ -272,6 +283,7 @@ |
68 | anchors.horizontalCenter: parent.horizontalCenter |
69 | color: "white" |
70 | name: "media-playlist-repeat" |
71 | + objectName: "repeatShape" |
72 | opacity: player.repeat && !emptyPage.noMusic ? 1 : .4 |
73 | } |
74 | } |
75 | @@ -283,7 +295,6 @@ |
76 | anchors.rightMargin: units.gu(1) |
77 | anchors.verticalCenter: nowPlayingPlayButton.verticalCenter |
78 | height: units.gu(6) |
79 | - objectName: "previousShape" |
80 | opacity: trackQueue.model.count === 0 ? .4 : 1 |
81 | width: height |
82 | onClicked: player.previousSong() |
83 | @@ -296,6 +307,7 @@ |
84 | anchors.horizontalCenter: parent.horizontalCenter |
85 | color: "white" |
86 | name: "media-skip-backward" |
87 | + objectName: "previousShape" |
88 | opacity: 1 |
89 | } |
90 | } |
91 | @@ -307,7 +319,6 @@ |
92 | anchors.top: musicToolbarFullProgressContainer.bottom |
93 | anchors.topMargin: units.gu(2) |
94 | height: units.gu(12) |
95 | - objectName: "playShape" |
96 | width: height |
97 | onClicked: player.toggle() |
98 | |
99 | @@ -320,6 +331,7 @@ |
100 | opacity: emptyPage.noMusic ? .4 : 1 |
101 | color: "white" |
102 | name: player.playbackState === MediaPlayer.PlayingState ? "media-playback-pause" : "media-playback-start" |
103 | + objectName: "playShape" |
104 | } |
105 | } |
106 | |
107 | @@ -330,7 +342,6 @@ |
108 | anchors.leftMargin: units.gu(1) |
109 | anchors.verticalCenter: nowPlayingPlayButton.verticalCenter |
110 | height: units.gu(6) |
111 | - objectName: "forwardShape" |
112 | opacity: trackQueue.model.count === 0 ? .4 : 1 |
113 | width: height |
114 | onClicked: player.nextSong() |
115 | @@ -343,6 +354,7 @@ |
116 | anchors.horizontalCenter: parent.horizontalCenter |
117 | color: "white" |
118 | name: "media-skip-forward" |
119 | + objectName: "forwardShape" |
120 | opacity: 1 |
121 | } |
122 | } |
123 | @@ -350,7 +362,6 @@ |
124 | /* Shuffle button */ |
125 | MouseArea { |
126 | id: nowPlayingShuffleButton |
127 | - objectName: "shuffleShape" |
128 | anchors.left: nowPlayingNextButton.right |
129 | anchors.leftMargin: units.gu(1) |
130 | anchors.verticalCenter: nowPlayingPlayButton.verticalCenter |
131 | @@ -367,6 +378,7 @@ |
132 | anchors.horizontalCenter: parent.horizontalCenter |
133 | color: "white" |
134 | name: "media-playlist-shuffle" |
135 | + objectName: "shuffleShape" |
136 | opacity: player.shuffle && !emptyPage.noMusic ? 1 : .4 |
137 | } |
138 | } |
139 | @@ -375,14 +387,16 @@ |
140 | |
141 | ListView { |
142 | id: queuelist |
143 | - visible: isListView |
144 | - objectName: "nowPlayingQueueList" |
145 | anchors { |
146 | fill: parent |
147 | } |
148 | delegate: queueDelegate |
149 | + footer: Item { |
150 | + height: mainView.height - (styleMusic.common.expandHeight + queuelist.currentHeight) + units.gu(8) |
151 | + } |
152 | + highlightFollowsCurrentItem: false |
153 | model: trackQueue.model |
154 | - highlightFollowsCurrentItem: false |
155 | + objectName: "nowPlayingQueueList" |
156 | state: "normal" |
157 | states: [ |
158 | State { |
159 | @@ -400,9 +414,7 @@ |
160 | } |
161 | } |
162 | ] |
163 | - footer: Item { |
164 | - height: mainView.height - (styleMusic.common.expandHeight + queuelist.currentHeight) + units.gu(8) |
165 | - } |
166 | + visible: isListView |
167 | |
168 | property int normalHeight: units.gu(12) |
169 | property int currentHeight: units.gu(40) |
170 | |
171 | === modified file 'MusicToolbar.qml' |
172 | --- MusicToolbar.qml 2014-10-04 03:49:08 +0000 |
173 | +++ MusicToolbar.qml 2014-10-07 15:28:54 +0000 |
174 | @@ -35,40 +35,11 @@ |
175 | property var currentPage: null |
176 | property var currentSheet: [] |
177 | property var currentTab: null |
178 | - property var previousPage: null |
179 | |
180 | // Properties and signals for the toolbar |
181 | - property var cachedStates: [] |
182 | - property bool shown: false |
183 | - property int transitionDuration: 100 |
184 | - |
185 | property alias currentHeight: musicToolbarPanel.height |
186 | - property alias expandedHeight: musicToolbarPanel.expandedHeight |
187 | - property alias fullHeight: musicToolbarPanel.fullHeight |
188 | - property alias mouseAreaOffset: musicToolbarPanel.hintSize |
189 | - |
190 | - property alias animating: musicToolbarPanel.animating |
191 | property alias opened: musicToolbarPanel.opened |
192 | |
193 | - // Alias for autopilot |
194 | - property alias currentMode: musicToolbarPanel.currentMode |
195 | - |
196 | - Connections { |
197 | - id: pageStackConn |
198 | - target: mainPageStack |
199 | - |
200 | - onCurrentPageChanged: { |
201 | - previousPage = currentPage; |
202 | - |
203 | - // If going back from nowPlaying jump back to tabs |
204 | - if (previousPage === nowPlaying && mainPageStack.currentPage !== nowPlaying) { |
205 | - while (mainPageStack.depth > 1) { |
206 | - mainPageStack.pop(mainPageStack.currentPage) |
207 | - } |
208 | - } |
209 | - } |
210 | - } |
211 | - |
212 | /* Helper functions */ |
213 | |
214 | // Back button has been pressed, jump up pageStack or back to parent page |
215 | @@ -97,8 +68,6 @@ |
216 | function setPage(childPage) |
217 | { |
218 | currentPage = childPage; |
219 | - // note: If pageStack tracking is needed readd here |
220 | - //currentPageStack = pageStack === undefined ? null : pageStack; |
221 | } |
222 | |
223 | // Set the current sheet (overrides page) |
224 | @@ -113,537 +82,10 @@ |
225 | right: parent.right |
226 | bottom: parent.bottom |
227 | } |
228 | - // TODO: this will be removed when the toolbar is redone |
229 | - height: currentMode === "hidden" ? 0 : (currentMode === "full" ? fullHeight : expandedHeight) |
230 | + height: units.gu(7.25) |
231 | locked: true |
232 | opened: true |
233 | |
234 | - // TODO: this will be removed when the toolbar is redone |
235 | - // The current mode of the controls |
236 | - property string currentMode: !nowPlaying.isListView && currentPage === nowPlaying |
237 | - ? "hidden" : (wideAspect || currentPage === nowPlaying |
238 | - ? "full" : "expanded") |
239 | - |
240 | - // Properties for the different heights |
241 | - property int expandedHeight: units.gu(7.25) |
242 | - property int fullHeight: units.gu(11) |
243 | - |
244 | - onCurrentModeChanged: { |
245 | - musicToolbarFullProgressMouseArea.enabled = currentMode === "full" |
246 | - } |
247 | - |
248 | - /* Full toolbar */ |
249 | - Rectangle { |
250 | - id: musicToolbarFullContainer |
251 | - anchors { |
252 | - fill: parent |
253 | - } |
254 | - color: styleMusic.toolbar.fullBackgroundColor |
255 | - visible: musicToolbarPanel.currentMode === "full" |
256 | - |
257 | - /* Buttons component */ |
258 | - Rectangle { |
259 | - id: musicToolbarFullButtonsContainer |
260 | - anchors.left: parent.left |
261 | - anchors.top: musicToolbarFullProgressContainer.bottom |
262 | - color: "transparent" |
263 | - height: parent.height - musicToolbarFullProgressContainer.height |
264 | - width: parent.width |
265 | - |
266 | - /* Column for labels in wideAspect */ |
267 | - Column { |
268 | - id: nowPlayingWideAspectLabels |
269 | - anchors { |
270 | - left: parent.left |
271 | - leftMargin: units.gu(1) |
272 | - right: nowPlayingRepeatButton.left |
273 | - rightMargin: units.gu(1) |
274 | - verticalCenter: parent.verticalCenter |
275 | - } |
276 | - visible: wideAspect |
277 | - |
278 | - /* Clicking in the area shows the queue */ |
279 | - function trigger() { |
280 | - if (trackQueue.model.count !== 0 && currentPage !== nowPlaying) { |
281 | - tabs.pushNowPlaying(); |
282 | - } |
283 | - else if (currentPage === nowPlaying) { |
284 | - musicToolbar.goBack(); |
285 | - } |
286 | - } |
287 | - |
288 | - /* Title of track */ |
289 | - Label { |
290 | - id: nowPlayingWideAspectTitle |
291 | - anchors { |
292 | - left: parent.left |
293 | - leftMargin: units.gu(1) |
294 | - right: parent.right |
295 | - rightMargin: units.gu(1) |
296 | - } |
297 | - color: styleMusic.playerControls.labelColor |
298 | - elide: Text.ElideRight |
299 | - fontSize: "medium" |
300 | - objectName: "playercontroltitle" |
301 | - text: trackQueue.model.count === 0 ? "" : player.currentMetaTitle === "" ? player.currentMetaFile : player.currentMetaTitle |
302 | - } |
303 | - |
304 | - /* Artist of track */ |
305 | - Label { |
306 | - id: nowPlayingWideAspectArtist |
307 | - anchors { |
308 | - left: parent.left |
309 | - leftMargin: units.gu(1) |
310 | - right: parent.right |
311 | - rightMargin: units.gu(1) |
312 | - } |
313 | - color: styleMusic.playerControls.labelColor |
314 | - elide: Text.ElideRight |
315 | - fontSize: "small" |
316 | - text: trackQueue.model.count === 0 ? "" : player.currentMetaArtist |
317 | - } |
318 | - |
319 | - /* Album of track */ |
320 | - Label { |
321 | - id: nowPlayingWideAspectAlbum |
322 | - anchors { |
323 | - left: parent.left |
324 | - leftMargin: units.gu(1) |
325 | - right: parent.right |
326 | - rightMargin: units.gu(1) |
327 | - } |
328 | - color: styleMusic.playerControls.labelColor |
329 | - elide: Text.ElideRight |
330 | - fontSize: "small" |
331 | - text: trackQueue.model.count === 0 ? "" : player.currentMetaAlbum |
332 | - } |
333 | - } |
334 | - |
335 | - /* Repeat button */ |
336 | - Item { |
337 | - id: nowPlayingRepeatButton |
338 | - objectName: "repeatShape" |
339 | - anchors.right: nowPlayingPreviousButton.left |
340 | - anchors.rightMargin: units.gu(1) |
341 | - anchors.verticalCenter: parent.verticalCenter |
342 | - height: units.gu(6) |
343 | - opacity: player.repeat && !emptyPage.noMusic ? 1 : .4 |
344 | - width: height |
345 | - |
346 | - function trigger() { |
347 | - if (emptyPage.noMusic) { |
348 | - return; |
349 | - } |
350 | - |
351 | - // Invert repeat settings |
352 | - player.repeat = !player.repeat |
353 | - } |
354 | - |
355 | - Image { |
356 | - id: repeatIcon |
357 | - height: units.gu(3) |
358 | - width: height |
359 | - anchors.verticalCenter: parent.verticalCenter |
360 | - anchors.horizontalCenter: parent.horizontalCenter |
361 | - source: Qt.resolvedUrl("images/media-playlist-repeat.svg") |
362 | - verticalAlignment: Text.AlignVCenter |
363 | - opacity: player.repeat && !emptyPage.noMusic ? 1 : .4 |
364 | - } |
365 | - } |
366 | - |
367 | - /* Previous button */ |
368 | - Item { |
369 | - id: nowPlayingPreviousButton |
370 | - anchors.right: nowPlayingPlayButton.left |
371 | - anchors.rightMargin: units.gu(1) |
372 | - anchors.verticalCenter: parent.verticalCenter |
373 | - height: units.gu(6) |
374 | - objectName: "previousShape" |
375 | - opacity: trackQueue.model.count === 0 ? .4 : 1 |
376 | - width: height |
377 | - |
378 | - function trigger() { |
379 | - if (trackQueue.model.count === 0) { |
380 | - return; |
381 | - } |
382 | - |
383 | - player.previousSong() |
384 | - } |
385 | - |
386 | - Image { |
387 | - id: nowPlayingPreviousIndicator |
388 | - height: units.gu(3) |
389 | - width: height |
390 | - anchors.horizontalCenter: parent.horizontalCenter |
391 | - anchors.verticalCenter: parent.verticalCenter |
392 | - source: Qt.resolvedUrl("images/media-skip-backward.svg") |
393 | - opacity: 1 |
394 | - } |
395 | - } |
396 | - |
397 | - /* Play/Pause button */ |
398 | - Rectangle { |
399 | - id: nowPlayingPlayButton |
400 | - anchors.horizontalCenter: parent.horizontalCenter |
401 | - anchors.verticalCenter: parent.verticalCenter |
402 | - antialiasing: true |
403 | - color: styleMusic.toolbar.fullOuterPlayCircleColor |
404 | - height: units.gu(12) |
405 | - radius: height / 2 |
406 | - width: height |
407 | - |
408 | - // draws the outter shadow/highlight |
409 | - Rectangle { |
410 | - id: sourceOutterFull |
411 | - anchors { fill: parent; margins: -units.gu(0.1) } |
412 | - radius: (width / 2) |
413 | - antialiasing: true |
414 | - gradient: Gradient { |
415 | - GradientStop { position: 0.0; color: "black" } |
416 | - GradientStop { position: 0.5; color: "transparent" } |
417 | - GradientStop { position: 1.0; color: UbuntuColors.warmGrey } |
418 | - } |
419 | - |
420 | - Rectangle { |
421 | - anchors.horizontalCenter: parent.horizontalCenter |
422 | - anchors.verticalCenter: parent.verticalCenter |
423 | - antialiasing: true |
424 | - color: styleMusic.toolbar.fullOuterPlayCircleColor |
425 | - height: nowPlayingPlayButton.height - units.gu(.1) |
426 | - radius: height / 2 |
427 | - width: height |
428 | - |
429 | - Rectangle { |
430 | - id: nowPlayingPlayButtonInner |
431 | - anchors.horizontalCenter: parent.horizontalCenter |
432 | - anchors.verticalCenter: parent.verticalCenter |
433 | - antialiasing: true |
434 | - color: styleMusic.toolbar.fullInnerPlayCircleColor |
435 | - height: units.gu(7) |
436 | - radius: height / 2 |
437 | - width: height |
438 | - |
439 | - // draws the inner shadow/highlight |
440 | - Rectangle { |
441 | - id: sourceInnerFull |
442 | - anchors { fill: parent; margins: -units.gu(0.1) } |
443 | - radius: (width / 2) |
444 | - antialiasing: true |
445 | - gradient: Gradient { |
446 | - GradientStop { position: 0.0; color: UbuntuColors.warmGrey } |
447 | - GradientStop { position: 0.5; color: "transparent" } |
448 | - GradientStop { position: 1.0; color: "black" } |
449 | - } |
450 | - |
451 | - Rectangle { |
452 | - anchors.horizontalCenter: parent.horizontalCenter |
453 | - anchors.verticalCenter: parent.verticalCenter |
454 | - antialiasing: true |
455 | - color: styleMusic.toolbar.fullInnerPlayCircleColor |
456 | - height: nowPlayingPlayButtonInner.height - units.gu(.1) |
457 | - objectName: "playShape" |
458 | - radius: height / 2 |
459 | - width: height |
460 | - |
461 | - function trigger() { |
462 | - if (emptyPage.noMusic) { |
463 | - return; |
464 | - } |
465 | - |
466 | - if (trackQueue.model.count === 0) { |
467 | - playRandomSong(); |
468 | - } |
469 | - else { |
470 | - player.toggle(); |
471 | - } |
472 | - } |
473 | - |
474 | - Image { |
475 | - id: nowPlayingPlayIndicator |
476 | - height: units.gu(6) |
477 | - width: height |
478 | - anchors.horizontalCenter: parent.horizontalCenter |
479 | - anchors.verticalCenter: parent.verticalCenter |
480 | - opacity: emptyPage.noMusic ? .4 : 1 |
481 | - source: player.playbackState === MediaPlayer.PlayingState ? |
482 | - Qt.resolvedUrl("images/media-playback-pause.svg") : Qt.resolvedUrl("images/media-playback-start.svg") |
483 | - } |
484 | - } |
485 | - } |
486 | - } |
487 | - } |
488 | - } |
489 | - } |
490 | - |
491 | - /* Next button */ |
492 | - Item { |
493 | - id: nowPlayingNextButton |
494 | - anchors.left: nowPlayingPlayButton.right |
495 | - anchors.leftMargin: units.gu(1) |
496 | - anchors.verticalCenter: parent.verticalCenter |
497 | - height: units.gu(6) |
498 | - objectName: "forwardShape" |
499 | - opacity: trackQueue.model.count === 0 ? .4 : 1 |
500 | - width: height |
501 | - |
502 | - function trigger() { |
503 | - if (trackQueue.model.count === 0 || emptyPage.noMusic) { |
504 | - return; |
505 | - } |
506 | - |
507 | - player.nextSong() |
508 | - } |
509 | - |
510 | - Image { |
511 | - id: nowPlayingNextIndicator |
512 | - height: units.gu(3) |
513 | - width: height |
514 | - anchors.horizontalCenter: parent.horizontalCenter |
515 | - anchors.verticalCenter: parent.verticalCenter |
516 | - source: Qt.resolvedUrl("images/media-skip-forward.svg") |
517 | - opacity: 1 |
518 | - } |
519 | - } |
520 | - |
521 | - /* Shuffle button */ |
522 | - Item { |
523 | - id: nowPlayingShuffleButton |
524 | - objectName: "shuffleShape" |
525 | - anchors.left: nowPlayingNextButton.right |
526 | - anchors.leftMargin: units.gu(1) |
527 | - anchors.verticalCenter: parent.verticalCenter |
528 | - height: units.gu(6) |
529 | - opacity: player.shuffle && !emptyPage.noMusic ? 1 : .4 |
530 | - width: height |
531 | - |
532 | - function trigger() { |
533 | - if (emptyPage.noMusic) { |
534 | - return; |
535 | - } |
536 | - |
537 | - // Invert shuffle settings |
538 | - player.shuffle = !player.shuffle |
539 | - } |
540 | - |
541 | - Image { |
542 | - id: shuffleIcon |
543 | - height: units.gu(3) |
544 | - width: height |
545 | - anchors.verticalCenter: parent.verticalCenter |
546 | - anchors.horizontalCenter: parent.horizontalCenter |
547 | - source: Qt.resolvedUrl("images/media-playlist-shuffle.svg") |
548 | - opacity: player.shuffle && !emptyPage.noMusic ? 1 : .4 |
549 | - } |
550 | - } |
551 | - |
552 | - /* Search button in wideAspect */ |
553 | - Item { |
554 | - id: nowPlayingSearchButton |
555 | - objectName: "searchShape" |
556 | - anchors { |
557 | - right: parent.right |
558 | - rightMargin: units.gu(1) |
559 | - verticalCenter: parent.verticalCenter |
560 | - } |
561 | - height: units.gu(6) |
562 | - opacity: !emptyPage.noMusic ? 1 : .4 |
563 | - width: height |
564 | - visible: wideAspect |
565 | - |
566 | - function trigger() { |
567 | - if (emptyPage.noMusic) { |
568 | - return; |
569 | - } |
570 | - |
571 | - if (!searchSheet.sheetVisible) { |
572 | - PopupUtils.open(searchSheet.sheet, |
573 | - mainView, { title: i18n.tr("Search")} ) |
574 | - } |
575 | - } |
576 | - |
577 | - Image { |
578 | - id: searchIcon |
579 | - anchors { |
580 | - horizontalCenter: parent.horizontalCenter |
581 | - verticalCenter: parent.verticalCenter |
582 | - } |
583 | - height: units.gu(3) |
584 | - opacity: !emptyPage.noMusic ? 1 : .4 |
585 | - source: Qt.resolvedUrl("images/search.svg") |
586 | - width: height |
587 | - } |
588 | - } |
589 | - } |
590 | - |
591 | - /* Progress bar component */ |
592 | - Rectangle { |
593 | - id: musicToolbarFullProgressContainer |
594 | - anchors.left: parent.left |
595 | - anchors.top: parent.top |
596 | - color: styleMusic.toolbar.fullBackgroundColor |
597 | - height: units.gu(3) |
598 | - width: parent.width |
599 | - |
600 | - /* Position label */ |
601 | - Label { |
602 | - id: musicToolbarFullPositionLabel |
603 | - anchors.left: parent.left |
604 | - anchors.leftMargin: units.gu(2) |
605 | - anchors.top: parent.top |
606 | - color: styleMusic.nowPlaying.labelColor |
607 | - fontSize: "x-small" |
608 | - height: parent.height |
609 | - horizontalAlignment: Text.AlignHCenter |
610 | - text: durationToString(player.position) |
611 | - verticalAlignment: Text.AlignVCenter |
612 | - width: units.gu(3) |
613 | - } |
614 | - |
615 | - /* Progress bar */ |
616 | - Rectangle { |
617 | - id: musicToolbarFullProgressBarContainer |
618 | - objectName: "progressBarShape" |
619 | - anchors.left: musicToolbarFullPositionLabel.right |
620 | - anchors.leftMargin: units.gu(2) |
621 | - anchors.right: musicToolbarFullDurationLabel.left |
622 | - anchors.rightMargin: units.gu(2) |
623 | - anchors.verticalCenter: parent.verticalCenter |
624 | - color: "transparent" |
625 | - height: units.gu(1); |
626 | - state: trackQueue.model.count === 0 ? "disabled" : "enabled" |
627 | - |
628 | - states: [ |
629 | - State { |
630 | - name: "disabled" |
631 | - PropertyChanges { |
632 | - target: musicToolbarFullProgressMouseArea |
633 | - enabled: false |
634 | - } |
635 | - PropertyChanges { |
636 | - target: musicToolbarFullProgressTrough |
637 | - visible: false |
638 | - } |
639 | - PropertyChanges { |
640 | - target: musicToolbarFullProgressHandle |
641 | - visible: false |
642 | - } |
643 | - }, |
644 | - State { |
645 | - name: "enabled" |
646 | - PropertyChanges { |
647 | - target: musicToolbarFullProgressMouseArea |
648 | - enabled: true |
649 | - } |
650 | - PropertyChanges { |
651 | - target: musicToolbarFullProgressTrough |
652 | - visible: true |
653 | - } |
654 | - PropertyChanges { |
655 | - target: musicToolbarFullProgressHandle |
656 | - visible: true |
657 | - } |
658 | - } |
659 | - ] |
660 | - |
661 | - property bool seeking: false |
662 | - |
663 | - onSeekingChanged: { |
664 | - if (seeking === false) { |
665 | - musicToolbarFullPositionLabel.text = durationToString(player.position) |
666 | - } |
667 | - } |
668 | - |
669 | - Connections { |
670 | - target: player |
671 | - onDurationChanged: { |
672 | - console.debug("Duration changed: " + player.duration) |
673 | - musicToolbarFullDurationLabel.text = durationToString(player.duration) |
674 | - } |
675 | - onPositionChanged: { |
676 | - if (musicToolbarFullProgressBarContainer.seeking === false) |
677 | - { |
678 | - musicToolbarFullPositionLabel.text = durationToString(player.position) |
679 | - musicToolbarFullDurationLabel.text = durationToString(player.duration) |
680 | - musicToolbarFullProgressHandle.x = (player.position / player.duration) * musicToolbarFullProgressBarContainer.width |
681 | - - musicToolbarFullProgressHandle.width / 2; |
682 | - } |
683 | - } |
684 | - onStopped: { |
685 | - musicToolbarFullProgressHandle.x = -musicToolbarFullProgressHandle.width / 2; |
686 | - |
687 | - musicToolbarFullPositionLabel.text = durationToString(0); |
688 | - musicToolbarFullDurationLabel.text = durationToString(0); |
689 | - } |
690 | - } |
691 | - |
692 | - // Black background behind the progress bar |
693 | - Rectangle { |
694 | - id: musicToolbarFullProgressBackground |
695 | - anchors.verticalCenter: parent.verticalCenter; |
696 | - color: styleMusic.toolbar.fullProgressBackgroundColor; |
697 | - height: parent.height; |
698 | - radius: units.gu(0.5) |
699 | - width: parent.width; |
700 | - } |
701 | - |
702 | - // The orange fill of the progress bar |
703 | - Rectangle { |
704 | - id: musicToolbarFullProgressTrough |
705 | - anchors.verticalCenter: parent.verticalCenter; |
706 | - antialiasing: true |
707 | - color: styleMusic.toolbar.fullProgressTroughColor; |
708 | - height: parent.height; |
709 | - radius: units.gu(0.5) |
710 | - width: musicToolbarFullProgressHandle.x + (height / 2); // +radius |
711 | - } |
712 | - |
713 | - // The current position (handle) of the progress bar |
714 | - Rectangle { |
715 | - id: musicToolbarFullProgressHandle |
716 | - anchors.verticalCenter: musicToolbarFullProgressBackground.verticalCenter |
717 | - antialiasing: true |
718 | - color: styleMusic.nowPlaying.progressHandleColor |
719 | - height: units.gu(1.5) |
720 | - radius: height / 2 |
721 | - width: height |
722 | - |
723 | - // On X change update the position string |
724 | - onXChanged: { |
725 | - if (musicToolbarFullProgressBarContainer.seeking) { |
726 | - var fraction = (x + (width / 2)) / parent.width; |
727 | - musicToolbarFullPositionLabel.text = durationToString(fraction * player.duration) |
728 | - } |
729 | - } |
730 | - } |
731 | - } |
732 | - |
733 | - /* Duration label */ |
734 | - Label { |
735 | - id: musicToolbarFullDurationLabel |
736 | - anchors.right: parent.right |
737 | - anchors.rightMargin: units.gu(2) |
738 | - anchors.top: parent.top |
739 | - color: styleMusic.nowPlaying.labelColor |
740 | - fontSize: "x-small" |
741 | - height: parent.height |
742 | - horizontalAlignment: Text.AlignHCenter |
743 | - text: durationToString(player.duration) |
744 | - verticalAlignment: Text.AlignVCenter |
745 | - width: units.gu(3) |
746 | - } |
747 | - |
748 | - /* Border at the bottom */ |
749 | - Rectangle { |
750 | - anchors.bottom: parent.bottom |
751 | - anchors.left: parent.left |
752 | - anchors.right: parent.right |
753 | - color: styleMusic.common.white |
754 | - height: units.gu(0.1) |
755 | - opacity: 0.1 |
756 | - } |
757 | - } |
758 | - } |
759 | - |
760 | /* Expanded toolbar */ |
761 | Rectangle { |
762 | id: musicToolbarExpandedContainer |
763 | @@ -651,7 +93,6 @@ |
764 | fill: parent |
765 | } |
766 | color: "transparent" |
767 | - visible: musicToolbarPanel.currentMode === "expanded" |
768 | |
769 | Rectangle { |
770 | id: musicToolbarPlayerControls |
771 | @@ -835,7 +276,7 @@ |
772 | height: units.gu(2.5) |
773 | name: player.playbackState === MediaPlayer.PlayingState ? |
774 | "media-playback-pause" : "media-playback-start" |
775 | - objectName: "smallPlayShape" |
776 | + objectName: "playShape" |
777 | width: height |
778 | } |
779 | |
780 | @@ -872,6 +313,7 @@ |
781 | top: parent.top |
782 | } |
783 | color: "transparent" |
784 | + objectName: "jumpNowPlaying" |
785 | function trigger() { |
786 | tabs.pushNowPlaying(); |
787 | } |
788 | @@ -912,39 +354,6 @@ |
789 | } |
790 | } |
791 | } |
792 | - |
793 | - /* Mouse events for the progress bar |
794 | - is after musicToolbarMouseArea so that it captures mouse events for dragging */ |
795 | - MouseArea { |
796 | - id: musicToolbarFullProgressMouseArea |
797 | - height: units.gu(2) |
798 | - width: musicToolbarFullProgressBarContainer.width |
799 | - x: musicToolbarFullProgressBarContainer.x |
800 | - y: musicToolbarFullProgressBarContainer.y |
801 | - |
802 | - drag.axis: Drag.XAxis |
803 | - drag.minimumX: -(musicToolbarFullProgressHandle.width / 2) |
804 | - drag.maximumX: musicToolbarFullProgressBarContainer.width - (musicToolbarFullProgressHandle.width / 2) |
805 | - drag.target: musicToolbarFullProgressHandle |
806 | - |
807 | - onPressed: { |
808 | - musicToolbarFullProgressBarContainer.seeking = true; |
809 | - |
810 | - // Jump the handle to the current mouse position |
811 | - musicToolbarFullProgressHandle.x = mouse.x - (musicToolbarFullProgressHandle.width / 2); |
812 | - } |
813 | - |
814 | - onReleased: { |
815 | - var fraction = mouse.x / musicToolbarFullProgressBarContainer.width; |
816 | - |
817 | - // Limit the bounds of the fraction |
818 | - fraction = fraction < 0 ? 0 : fraction |
819 | - fraction = fraction > 1 ? 1 : fraction |
820 | - |
821 | - player.seek((fraction) * player.duration); |
822 | - musicToolbarFullProgressBarContainer.seeking = false; |
823 | - } |
824 | - } |
825 | } |
826 | } |
827 | |
828 | |
829 | === modified file 'common/MusicPage.qml' |
830 | --- common/MusicPage.qml 2014-09-30 15:18:25 +0000 |
831 | +++ common/MusicPage.qml 2014-10-07 15:28:54 +0000 |
832 | @@ -24,7 +24,7 @@ |
833 | Page { |
834 | id: thisPage |
835 | anchors { |
836 | - bottomMargin: musicToolbar.currentHeight |
837 | + bottomMargin: musicToolbar.visible ? musicToolbar.currentHeight : 0 |
838 | fill: parent |
839 | } |
840 | |
841 | |
842 | === modified file 'music-app.qml' |
843 | --- music-app.qml 2014-10-04 01:45:45 +0000 |
844 | +++ music-app.qml 2014-10-07 15:28:54 +0000 |
845 | @@ -581,7 +581,7 @@ |
846 | property string lastfmpassword |
847 | property string timestamp // used to scrobble |
848 | property var chosenElement: null |
849 | - property bool toolbarShown: musicToolbar.shown |
850 | + property bool toolbarShown: musicToolbar.visible |
851 | property bool selectedAlbum: false |
852 | |
853 | signal listItemSwiping(int i) |
854 | @@ -973,7 +973,6 @@ |
855 | Tabs { |
856 | id: tabs |
857 | anchors { |
858 | - bottomMargin: wideAspect ? musicToolbar.fullHeight : undefined |
859 | fill: parent |
860 | } |
861 | |
862 | |
863 | === modified file 'tests/autopilot/music_app/__init__.py' |
864 | --- tests/autopilot/music_app/__init__.py 2014-09-25 17:58:55 +0000 |
865 | +++ tests/autopilot/music_app/__init__.py 2014-10-07 15:28:54 +0000 |
866 | @@ -21,11 +21,22 @@ |
867 | return func_wrapper |
868 | |
869 | |
870 | -def ensure_toolbar_visible(func): |
871 | - """Wrapper which ensures the toolbar is shown before clicking""" |
872 | - def func_wrapper(self, *args, **kwargs): |
873 | - if not self.opened: |
874 | - self.show() |
875 | +def ensure_now_playing_full(func): |
876 | + """Wrapper which ensures the now playing is full before clicking""" |
877 | + def func_wrapper(self, *args, **kwargs): |
878 | + if self.isListView: |
879 | + self.click_toggle_view() |
880 | + |
881 | + return func(self, *args, **kwargs) |
882 | + |
883 | + return func_wrapper |
884 | + |
885 | + |
886 | +def ensure_now_playing_list(func): |
887 | + """Wrapper which ensures the now playing is list before clicking""" |
888 | + def func_wrapper(self, *args, **kwargs): |
889 | + if not self.isListView: |
890 | + self.click_toggle_view() |
891 | |
892 | return func(self, *args, **kwargs) |
893 | |
894 | @@ -221,96 +232,54 @@ |
895 | def __init__(self, *args): |
896 | super(MusicPage, self).__init__(*args) |
897 | |
898 | - def get_count(self): |
899 | - return self.select_single("QQuickListView", |
900 | - objectName="nowPlayingQueueList").count |
901 | - |
902 | - def get_track(self, i): |
903 | - return (self.wait_select_single(ListItemWithActions, |
904 | - objectName="nowPlayingListItem" + str(i))) |
905 | - |
906 | - |
907 | -class AlbumsPage(MusicPage): |
908 | - """ Autopilot helper for the albums page """ |
909 | - def __init__(self, *args): |
910 | - super(MusicPage, self).__init__(*args) |
911 | - |
912 | - self.visible.wait_for(True) |
913 | - |
914 | - @click_object |
915 | - def click_artist(self, i): |
916 | - return self.wait_select_single("Standard", |
917 | - objectName="albumsArtistListItem" |
918 | - + str(i)) |
919 | - |
920 | - def get_artist(self): |
921 | - return self.wait_select_single("Label", objectName="artistLabel").text |
922 | - |
923 | - |
924 | -class SongsPage(MusicPage): |
925 | - """ Autopilot helper for the songs page """ |
926 | - def __init__(self, *args): |
927 | - super(MusicPage, self).__init__(*args) |
928 | - |
929 | - self.visible.wait_for(True) |
930 | - |
931 | - @click_object |
932 | - def click_track(self, i): |
933 | - return self.get_track(i) |
934 | - |
935 | - def get_header_artist_label(self): |
936 | - return self.wait_select_single("Label", |
937 | - objectName="songsPageHeaderAlbumArtist") |
938 | - |
939 | - def get_track(self, i): |
940 | - return (self.wait_select_single(ListItemWithActions, |
941 | - objectName="songsPageListItem" + str(i))) |
942 | - |
943 | - |
944 | -class MusicToolbar(UbuntuUIToolkitCustomProxyObjectBase): |
945 | - """Autopilot helper for the toolbar |
946 | - |
947 | - expanded - refers to things when the toolbar is in its smaller state |
948 | - full - refers to things when the toolbar is in its larger state |
949 | - """ |
950 | - def __init__(self, *args): |
951 | - super(MusicToolbar, self).__init__(*args) |
952 | - |
953 | root = self.get_root_instance() |
954 | self.player = root.select_single(Player, objectName="player") |
955 | |
956 | - @ensure_toolbar_visible |
957 | + @ensure_now_playing_full |
958 | @click_object |
959 | def click_forward_button(self): |
960 | return self.wait_select_single("*", objectName="forwardShape") |
961 | |
962 | - @ensure_toolbar_visible |
963 | + @ensure_now_playing_full |
964 | @click_object |
965 | def click_play_button(self): |
966 | - if self.currentMode == "full": |
967 | - return self.wait_select_single("*", objectName="playShape") |
968 | - else: |
969 | - return self.wait_select_single("*", objectName="smallPlayShape") |
970 | + return self.wait_select_single("*", objectName="playShape") |
971 | |
972 | - @ensure_toolbar_visible |
973 | + @ensure_now_playing_full |
974 | @click_object |
975 | def click_previous_button(self): |
976 | return self.wait_select_single("*", objectName="previousShape") |
977 | |
978 | - @ensure_toolbar_visible |
979 | + @ensure_now_playing_full |
980 | @click_object |
981 | def click_repeat_button(self): |
982 | return self.wait_select_single("*", objectName="repeatShape") |
983 | |
984 | - @ensure_toolbar_visible |
985 | + @ensure_now_playing_full |
986 | @click_object |
987 | def click_shuffle_button(self): |
988 | return self.wait_select_single("*", objectName="shuffleShape") |
989 | |
990 | - @ensure_toolbar_visible |
991 | + def click_toggle_view(self): |
992 | + self.main_view.get_header().click_action_button("toggleView") |
993 | + |
994 | + def get_count(self): |
995 | + return self.select_single("QQuickListView", |
996 | + objectName="nowPlayingQueueList").count |
997 | + |
998 | + def go_back(self): |
999 | + """Use custom back button to go back""" |
1000 | + self.main_view.get_header().click_custom_back_button() |
1001 | + |
1002 | + @ensure_now_playing_list |
1003 | + def get_track(self, i): |
1004 | + return (self.wait_select_single(ListItemWithActions, |
1005 | + objectName="nowPlayingListItem" + str(i))) |
1006 | + |
1007 | + @ensure_now_playing_full |
1008 | def seek_to(self, percentage): |
1009 | progress_bar = self.wait_select_single( |
1010 | - "*", objectName="progressBarShape") |
1011 | + "*", objectName="progressSliderShape") |
1012 | |
1013 | x1, y1, width, height = progress_bar.globalRect |
1014 | y1 += height // 2 |
1015 | @@ -319,28 +288,77 @@ |
1016 | |
1017 | self.pointing_device.drag(x1, y1, x2, y1) |
1018 | |
1019 | - @ensure_toolbar_visible |
1020 | def set_repeat(self, state): |
1021 | if self.player.repeat != state: |
1022 | self.click_repeat_button() |
1023 | |
1024 | self.player.repeat.wait_for(state) |
1025 | |
1026 | - @ensure_toolbar_visible |
1027 | def set_shuffle(self, state): |
1028 | if self.player.shuffle != state: |
1029 | self.click_shuffle_button() |
1030 | |
1031 | self.player.shuffle.wait_for(state) |
1032 | |
1033 | - def show(self): |
1034 | - self.pointing_device.move_to_object(self) |
1035 | - |
1036 | - x1, y1 = self.pointing_device.position() |
1037 | - |
1038 | - y1 -= (self.height / 2) + 1 # get position at top of toolbar |
1039 | - |
1040 | - self.pointing_device.drag(x1, y1, x1, y1 - self.fullHeight) |
1041 | + |
1042 | +class AlbumsPage(MusicPage): |
1043 | + """ Autopilot helper for the albums page """ |
1044 | + def __init__(self, *args): |
1045 | + super(MusicPage, self).__init__(*args) |
1046 | + |
1047 | + self.visible.wait_for(True) |
1048 | + |
1049 | + @click_object |
1050 | + def click_artist(self, i): |
1051 | + return self.wait_select_single("Standard", |
1052 | + objectName="albumsArtistListItem" |
1053 | + + str(i)) |
1054 | + |
1055 | + def get_artist(self): |
1056 | + return self.wait_select_single("Label", objectName="artistLabel").text |
1057 | + |
1058 | + |
1059 | +class SongsPage(MusicPage): |
1060 | + """ Autopilot helper for the songs page """ |
1061 | + def __init__(self, *args): |
1062 | + super(MusicPage, self).__init__(*args) |
1063 | + |
1064 | + self.visible.wait_for(True) |
1065 | + |
1066 | + @click_object |
1067 | + def click_track(self, i): |
1068 | + return self.get_track(i) |
1069 | + |
1070 | + def get_header_artist_label(self): |
1071 | + return self.wait_select_single("Label", |
1072 | + objectName="songsPageHeaderAlbumArtist") |
1073 | + |
1074 | + def get_track(self, i): |
1075 | + return (self.wait_select_single(ListItemWithActions, |
1076 | + objectName="songsPageListItem" + str(i))) |
1077 | + |
1078 | + |
1079 | +class MusicToolbar(UbuntuUIToolkitCustomProxyObjectBase): |
1080 | + """Autopilot helper for the toolbar""" |
1081 | + def __init__(self, *args): |
1082 | + super(MusicToolbar, self).__init__(*args) |
1083 | + |
1084 | + @click_object |
1085 | + def click_play_button(self): |
1086 | + return self.wait_select_single("*", objectName="playShape") |
1087 | + |
1088 | + @click_object |
1089 | + def click_jump_to_now_playing(self): |
1090 | + return self.wait_select_single("*", objectName="jumpNowPlaying") |
1091 | + |
1092 | + def switch_to_now_playing(self): |
1093 | + self.click_jump_to_now_playing() |
1094 | + |
1095 | + root = self.get_root_instance() |
1096 | + now_playing_page = root.wait_select_single(MusicNowPlaying, |
1097 | + objectName="nowPlayingPage") |
1098 | + |
1099 | + now_playing_page.visible.wait_for(True) |
1100 | |
1101 | |
1102 | class ListItemWithActions(UbuntuUIToolkitCustomProxyObjectBase): |
1103 | |
1104 | === modified file 'tests/autopilot/music_app/tests/test_music.py' |
1105 | --- tests/autopilot/music_app/tests/test_music.py 2014-09-23 20:45:41 +0000 |
1106 | +++ tests/autopilot/music_app/tests/test_music.py 2014-10-07 15:28:54 +0000 |
1107 | @@ -91,6 +91,11 @@ |
1108 | Eventually(NotEquals(end_tracks_count))) |
1109 | self.assertThat(self.player.isPlaying, Eventually(Equals(False))) |
1110 | |
1111 | + toolbar.switch_to_now_playing() # Switch to the now playing page |
1112 | + |
1113 | + # Re get now playing page as it has changed |
1114 | + now_playing_page = self.app.get_now_playing_page() |
1115 | + |
1116 | # verify song's metadata matches the item added to the Now Playing view |
1117 | current_track = now_playing_page.get_track(self.player.currentIndex) |
1118 | |
1119 | @@ -99,14 +104,14 @@ |
1120 | self.assertThat(current_track.get_label_text("titleLabel"), |
1121 | Equals(self.tracks[0]["title"])) |
1122 | |
1123 | - # click on close button to close the page |
1124 | - self.app.main_view.go_back() |
1125 | + # click on close button to close the page and now playing page |
1126 | + now_playing_page.go_back() |
1127 | |
1128 | - # click the play button to start playing |
1129 | + # click the play button (toolbar) to start playing |
1130 | toolbar.click_play_button() |
1131 | self.assertThat(self.player.isPlaying, Eventually(Equals(True))) |
1132 | |
1133 | - # click the play button to stop playing |
1134 | + # click the play button (toolbar) to stop playing |
1135 | toolbar.click_play_button() |
1136 | self.assertThat(self.player.isPlaying, Eventually(Equals(False))) |
1137 | |
1138 | @@ -115,15 +120,15 @@ |
1139 | |
1140 | self.app.populate_queue() # populate queue |
1141 | |
1142 | - toolbar = self.app.get_toolbar() |
1143 | + now_playing_page = self.app.get_now_playing_page() |
1144 | |
1145 | # check that the player is playing and then select pause |
1146 | self.assertThat(self.player.isPlaying, Eventually(Equals(True))) |
1147 | - toolbar.click_play_button() |
1148 | + now_playing_page.click_play_button() |
1149 | |
1150 | # check that the player is paused and then select play |
1151 | self.assertThat(self.player.isPlaying, Eventually(Equals(False))) |
1152 | - toolbar.click_play_button() |
1153 | + now_playing_page.click_play_button() |
1154 | |
1155 | # check that the player is playing |
1156 | self.assertThat(self.player.isPlaying, Eventually(Equals(True))) |
1157 | @@ -133,7 +138,7 @@ |
1158 | |
1159 | self.app.populate_queue() # populate queue |
1160 | |
1161 | - toolbar = self.app.get_toolbar() |
1162 | + now_playing_page = self.app.get_now_playing_page() |
1163 | |
1164 | # save original song data for later |
1165 | org_title = self.player.currentMetaTitle |
1166 | @@ -144,17 +149,17 @@ |
1167 | logger.debug("Original Song %s, %s" % (org_title, org_artist)) |
1168 | |
1169 | # select pause and check the player has stopped |
1170 | - toolbar.click_play_button() |
1171 | + now_playing_page.click_play_button() |
1172 | self.assertThat(self.player.isPlaying, Eventually(Equals(False))) |
1173 | |
1174 | - toolbar.set_shuffle(False) # ensure shuffe is off |
1175 | + now_playing_page.set_shuffle(False) # ensure shuffe is off |
1176 | |
1177 | # goal is to go back and forth and ensure 2 different songs |
1178 | - toolbar.click_forward_button() |
1179 | + now_playing_page.click_forward_button() |
1180 | self.assertThat(self.player.isPlaying, Eventually(Equals(True))) |
1181 | |
1182 | # select pause and check the player has stopped |
1183 | - toolbar.click_play_button() |
1184 | + now_playing_page.click_play_button() |
1185 | self.assertThat(self.player.isPlaying, Eventually(Equals(False))) |
1186 | |
1187 | # ensure different song |
1188 | @@ -166,14 +171,14 @@ |
1189 | logger.debug("Next Song %s, %s" % (self.player.currentMetaTitle, |
1190 | self.player.currentMetaArtist)) |
1191 | |
1192 | - toolbar.seek_to(0) # seek to 0 (start) |
1193 | + now_playing_page.seek_to(0) # seek to 0 (start) |
1194 | |
1195 | # select previous and ensure the track is playing |
1196 | - toolbar.click_previous_button() |
1197 | + now_playing_page.click_previous_button() |
1198 | self.assertThat(self.player.isPlaying, Eventually(Equals(True))) |
1199 | |
1200 | # select pause and check the player has stopped |
1201 | - toolbar.click_play_button() |
1202 | + now_playing_page.click_play_button() |
1203 | self.assertThat(self.player.isPlaying, Eventually(Equals(False))) |
1204 | |
1205 | # ensure we're back to original song |
1206 | @@ -207,13 +212,13 @@ |
1207 | self.assertThat(self.player.source.endswith("mp3"), |
1208 | Equals(True)) |
1209 | |
1210 | - # Start playing the track |
1211 | + # Start playing the track (click from toolbar) |
1212 | toolbar.click_play_button() |
1213 | |
1214 | # Check that the track is playing |
1215 | self.assertThat(self.player.isPlaying, Eventually(Equals(True))) |
1216 | |
1217 | - # Stop playing the track |
1218 | + # Stop playing the track (click from toolbar) |
1219 | toolbar.click_play_button() |
1220 | |
1221 | # Check current meta data is correct |
1222 | @@ -229,15 +234,15 @@ |
1223 | |
1224 | # at this point the track is playing and shuffle is enabled |
1225 | |
1226 | - toolbar = self.app.get_toolbar() |
1227 | + now_playing_page = self.app.get_now_playing_page() |
1228 | |
1229 | # pause the track if it is playing |
1230 | if self.player.isPlaying: |
1231 | - toolbar.click_play_button() |
1232 | + now_playing_page.click_play_button() |
1233 | |
1234 | self.player.isPlaying.wait_for(False) |
1235 | |
1236 | - toolbar.set_shuffle(True) # enable shuffle |
1237 | + now_playing_page.set_shuffle(True) # enable shuffle |
1238 | |
1239 | # save original song metadata |
1240 | org_title = self.player.currentMetaTitle |
1241 | @@ -256,11 +261,11 @@ |
1242 | self.assertThat(count, LessThan(100)) |
1243 | |
1244 | # select next track |
1245 | - toolbar.click_forward_button() |
1246 | + now_playing_page.click_forward_button() |
1247 | |
1248 | # pause the track if it is playing |
1249 | if self.player.isPlaying: |
1250 | - toolbar.click_play_button() |
1251 | + now_playing_page.click_play_button() |
1252 | |
1253 | # check it is paused |
1254 | self.assertThat(self.player.isPlaying, Eventually(Equals(False))) |
1255 | @@ -270,11 +275,11 @@ |
1256 | |
1257 | # select previous track while will break if this previous track |
1258 | # is different and therefore a shuffle has occurred |
1259 | - toolbar.click_previous_button() |
1260 | + now_playing_page.click_previous_button() |
1261 | |
1262 | # pause the track if it is playing |
1263 | if self.player.isPlaying: |
1264 | - toolbar.click_play_button() |
1265 | + now_playing_page.click_play_button() |
1266 | |
1267 | # check it is paused |
1268 | self.assertThat(self.player.isPlaying, Eventually(Equals(False))) |
1269 | @@ -314,6 +319,7 @@ |
1270 | """tests navigating to the Albums tab and adding a song to queue""" |
1271 | |
1272 | now_playing_page = self.app.get_now_playing_page() |
1273 | + toolbar = self.app.get_toolbar() |
1274 | |
1275 | # get number of tracks in queue before queuing a track |
1276 | initial_tracks_count = now_playing_page.get_count() |
1277 | @@ -341,6 +347,11 @@ |
1278 | # Assert that the song added to the list is not playing |
1279 | self.assertThat(self.player.isPlaying, Eventually(Equals(False))) |
1280 | |
1281 | + toolbar.switch_to_now_playing() # Switch to the now playing page |
1282 | + |
1283 | + # Re get now playing page as it has changed |
1284 | + now_playing_page = self.app.get_now_playing_page() |
1285 | + |
1286 | # verify song's metadata matches the item added to the Now Playing view |
1287 | current_track = now_playing_page.get_track(self.player.currentIndex) |
1288 | |
1289 | @@ -349,8 +360,8 @@ |
1290 | self.assertThat(current_track.get_label_text("titleLabel"), |
1291 | Equals(tracks[0]["title"])) |
1292 | |
1293 | - # click on close button to close songs page |
1294 | - self.app.main_view.go_back() |
1295 | + # click on close button to close nowplaying and songs page |
1296 | + now_playing_page.go_back() |
1297 | |
1298 | # check that the albums page is now visible |
1299 | self.assertThat(albums_page.visible, Eventually(Equals(True))) |
1300 | @@ -391,6 +402,7 @@ |
1301 | to the queue via the expandable list view item. """ |
1302 | |
1303 | now_playing_page = self.app.get_now_playing_page() |
1304 | + toolbar = self.app.get_toolbar() |
1305 | |
1306 | # get number of tracks in queue before queuing a track |
1307 | initial_tracks_count = now_playing_page.get_count() |
1308 | @@ -413,6 +425,11 @@ |
1309 | Eventually(NotEquals(now_playing_page.get_count()))) |
1310 | self.assertThat(self.player.isPlaying, Eventually(Equals(False))) |
1311 | |
1312 | + toolbar.switch_to_now_playing() # Switch to the now playing page |
1313 | + |
1314 | + # Re get now playing page as it has changed |
1315 | + now_playing_page = self.app.get_now_playing_page() |
1316 | + |
1317 | # verify song's metadata matches the item added to the Now Playing view |
1318 | current_track = now_playing_page.get_track(self.player.currentIndex) |
1319 | |
1320 | @@ -552,14 +569,13 @@ |
1321 | self.app.populate_queue() # populate queue |
1322 | |
1323 | now_playing_page = self.app.get_now_playing_page() |
1324 | - toolbar = self.app.get_toolbar() |
1325 | |
1326 | - toolbar.set_shuffle(False) |
1327 | - toolbar.set_repeat(False) |
1328 | + now_playing_page.set_shuffle(False) |
1329 | + now_playing_page.set_repeat(False) |
1330 | |
1331 | # Skip through all songs in queue, stopping on last one. |
1332 | for count in range(0, now_playing_page.get_count() - 1): |
1333 | - toolbar.click_forward_button() |
1334 | + now_playing_page.click_forward_button() |
1335 | |
1336 | # When the last song ends, playback should stop |
1337 | self.assertThat(self.player.isPlaying, Eventually(Equals(False))) |
1338 | @@ -570,14 +586,13 @@ |
1339 | self.app.populate_queue() # populate queue |
1340 | |
1341 | now_playing_page = self.app.get_now_playing_page() |
1342 | - toolbar = self.app.get_toolbar() |
1343 | |
1344 | - toolbar.set_shuffle(False) |
1345 | - toolbar.set_repeat(True) |
1346 | + now_playing_page.set_shuffle(False) |
1347 | + now_playing_page.set_repeat(True) |
1348 | |
1349 | # Skip through all songs in queue, stopping on last one. |
1350 | for count in range(0, now_playing_page.get_count() - 1): |
1351 | - toolbar.click_forward_button() |
1352 | + now_playing_page.click_forward_button() |
1353 | |
1354 | # Make sure we loop back to first song after last song ends |
1355 | self.assertThat(self.player.currentMetaTitle, |
1356 | @@ -590,14 +605,13 @@ |
1357 | self.app.populate_queue() # populate queue |
1358 | |
1359 | now_playing_page = self.app.get_now_playing_page() |
1360 | - toolbar = self.app.get_toolbar() |
1361 | |
1362 | - toolbar.set_shuffle(False) |
1363 | - toolbar.set_repeat(True) |
1364 | + now_playing_page.set_shuffle(False) |
1365 | + now_playing_page.set_repeat(True) |
1366 | |
1367 | # Skip through all songs in queue, INCLUDING last one. |
1368 | for count in range(0, now_playing_page.get_count() - 1): |
1369 | - toolbar.click_forward_button() |
1370 | + now_playing_page.click_forward_button() |
1371 | |
1372 | # Make sure we loop back to first song after last song ends |
1373 | self.assertThat(self.player.currentMetaTitle, |
1374 | @@ -609,19 +623,19 @@ |
1375 | |
1376 | self.app.populate_queue() # populate queue |
1377 | |
1378 | - toolbar = self.app.get_toolbar() |
1379 | + now_playing_page = self.app.get_now_playing_page() |
1380 | |
1381 | - toolbar.set_shuffle(False) |
1382 | - toolbar.set_repeat(True) |
1383 | + now_playing_page.set_shuffle(False) |
1384 | + now_playing_page.set_repeat(True) |
1385 | |
1386 | initial_song = self.player.currentMetaTitle |
1387 | - toolbar.click_previous_button() |
1388 | + now_playing_page.click_previous_button() |
1389 | |
1390 | # If we're far enough into a song, pressing prev just takes us to the |
1391 | # beginning of that track. In that case, hit prev again to actually |
1392 | # skip over the track. |
1393 | if self.player.currentMetaTitle == initial_song: |
1394 | - toolbar.click_previous_button() |
1395 | + now_playing_page.click_previous_button() |
1396 | |
1397 | self.assertThat(self.player.currentMetaTitle, |
1398 | Eventually(Equals(self.tracks[-1]["title"]))) |
1399 | @@ -632,17 +646,17 @@ |
1400 | |
1401 | self.app.populate_queue() # populate queue |
1402 | |
1403 | - toolbar = self.app.get_toolbar() |
1404 | + now_playing_page = self.app.get_now_playing_page() |
1405 | |
1406 | self.player.isPlaying.wait_for(True) # ensure the track is playing |
1407 | self.player.position.wait_for(GreaterThan(5000)) # wait until > 5s |
1408 | |
1409 | - toolbar.click_play_button() # pause the track |
1410 | + now_playing_page.click_play_button() # pause the track |
1411 | self.player.isPlaying.wait_for(False) # ensure the track has paused |
1412 | |
1413 | source = self.player.source # store current source |
1414 | |
1415 | - toolbar.click_previous_button() # click previous |
1416 | + now_playing_page.click_previous_button() # click previous |
1417 | |
1418 | self.player.position.wait_for(LessThan(5000)) # wait until < 5s |
1419 |
FAILED: Continuous integration, rev:652 91.189. 93.70:8080/ job/music- app-remix- ci/34/ 91.189. 93.70:8080/ job/generic- mediumtests- utopic- python3/ 714 91.189. 93.70:8080/ job/generic- mediumtests- utopic- python3/ 714/artifact/ work/output/ *zip*/output. zip 91.189. 93.70:8080/ job/music- app-remix- utopic- amd64-ci/ 34
http://
Executed test runs:
UNSTABLE: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/music- app-remix- ci/34/rebuild
http://