Merge lp:~ahayzen/music-app/remix-remove-legacy-toolbar into lp:music-app/remix

Proposed by Andrew Hayzen
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
Reviewer Review Type Date Requested Status
Victor Thompson Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+237208@code.launchpad.net

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

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
653. By Andrew Hayzen

* Various fixes for autopilot

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
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

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
657. By Andrew Hayzen

* Further fixes for autopilot

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
658. By Andrew Hayzen

* Fix for pyflakes

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
659. By Andrew Hayzen

* Wait for now playing page to be visible when switching

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
660. By Andrew Hayzen

* Reget now playing page after switching

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
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.

review: Needs Fixing
661. By Andrew Hayzen

* Fix for pagestack jumping
* Added extra code comment

Revision history for this message
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

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
663. By Andrew Hayzen

* Add objectName for back button

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
664. By Andrew Hayzen

* Use custom back button

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
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.imgur.com/59PjmEn.png

I'm not sure exactly what the fix is for this.

review: Needs Fixing
Revision history for this message
Victor Thompson (vthompson) wrote :

The bug mentioned above was not introduced by this code change, so we will not block on it. This LGTM!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'MusicNowPlaying.qml'
--- MusicNowPlaying.qml 2014-10-06 00:26:56 +0000
+++ MusicNowPlaying.qml 2014-10-07 15:28:54 +0000
@@ -28,19 +28,31 @@
2828
29MusicPage {29MusicPage {
30 id: nowPlaying30 id: nowPlaying
31 flickable: isListView ? queuelist : null // Ensures that the header is shown in fullview
31 objectName: "nowPlayingPage"32 objectName: "nowPlayingPage"
32 title: i18n.tr("Now Playing")33 title: i18n.tr("Now Playing")
33 visible: false34 visible: false
34 onVisibleChanged: {35 onVisibleChanged: {
35 if (!visible) {36 if (!visible) {
36 // Reset the isListView property37 // Reset the isListView property
37 // TODO: In the future this will default to false38 isListView = false
38 isListView = true
39 }39 }
40 }40 }
4141
42 property int ensureVisibleIndex: 0 // ensure first index is visible at startup42 property int ensureVisibleIndex: 0 // ensure first index is visible at startup
43 property bool isListView: true43 property bool isListView: false
44
45 head.backAction: Action {
46 iconName: "back";
47 objectName: "backButton"
48 onTriggered: {
49 mainPageStack.pop();
50
51 while (mainPageStack.depth > 1) { // jump back to the tab layer if via SongsPage
52 mainPageStack.pop();
53 }
54 }
55 }
4456
45 head {57 head {
46 actions: [58 actions: [
@@ -88,10 +100,9 @@
88100
89 Rectangle {101 Rectangle {
90 id: fullview102 id: fullview
91 visible: !isListView
92 anchors.fill: parent103 anchors.fill: parent
93 color: "transparent"104 color: "transparent"
94 clip: true105 visible: !isListView
95106
96 BlurredBackground {107 BlurredBackground {
97 id: blurredBackground108 id: blurredBackground
@@ -195,6 +206,7 @@
195 id: progressSliderMusic206 id: progressSliderMusic
196 anchors.left: parent.left207 anchors.left: parent.left
197 anchors.right: parent.right208 anchors.right: parent.right
209 objectName: "progressSliderShape"
198 function formatValue(v) { return durationToString(v) }210 function formatValue(v) { return durationToString(v) }
199211
200 property bool seeking: false212 property bool seeking: false
@@ -255,7 +267,6 @@
255 /* Repeat button */267 /* Repeat button */
256 MouseArea {268 MouseArea {
257 id: nowPlayingRepeatButton269 id: nowPlayingRepeatButton
258 objectName: "repeatShape"
259 anchors.right: nowPlayingPreviousButton.left270 anchors.right: nowPlayingPreviousButton.left
260 anchors.rightMargin: units.gu(1)271 anchors.rightMargin: units.gu(1)
261 anchors.verticalCenter: nowPlayingPlayButton.verticalCenter272 anchors.verticalCenter: nowPlayingPlayButton.verticalCenter
@@ -272,6 +283,7 @@
272 anchors.horizontalCenter: parent.horizontalCenter283 anchors.horizontalCenter: parent.horizontalCenter
273 color: "white"284 color: "white"
274 name: "media-playlist-repeat"285 name: "media-playlist-repeat"
286 objectName: "repeatShape"
275 opacity: player.repeat && !emptyPage.noMusic ? 1 : .4287 opacity: player.repeat && !emptyPage.noMusic ? 1 : .4
276 }288 }
277 }289 }
@@ -283,7 +295,6 @@
283 anchors.rightMargin: units.gu(1)295 anchors.rightMargin: units.gu(1)
284 anchors.verticalCenter: nowPlayingPlayButton.verticalCenter296 anchors.verticalCenter: nowPlayingPlayButton.verticalCenter
285 height: units.gu(6)297 height: units.gu(6)
286 objectName: "previousShape"
287 opacity: trackQueue.model.count === 0 ? .4 : 1298 opacity: trackQueue.model.count === 0 ? .4 : 1
288 width: height299 width: height
289 onClicked: player.previousSong()300 onClicked: player.previousSong()
@@ -296,6 +307,7 @@
296 anchors.horizontalCenter: parent.horizontalCenter307 anchors.horizontalCenter: parent.horizontalCenter
297 color: "white"308 color: "white"
298 name: "media-skip-backward"309 name: "media-skip-backward"
310 objectName: "previousShape"
299 opacity: 1311 opacity: 1
300 }312 }
301 }313 }
@@ -307,7 +319,6 @@
307 anchors.top: musicToolbarFullProgressContainer.bottom319 anchors.top: musicToolbarFullProgressContainer.bottom
308 anchors.topMargin: units.gu(2)320 anchors.topMargin: units.gu(2)
309 height: units.gu(12)321 height: units.gu(12)
310 objectName: "playShape"
311 width: height322 width: height
312 onClicked: player.toggle()323 onClicked: player.toggle()
313324
@@ -320,6 +331,7 @@
320 opacity: emptyPage.noMusic ? .4 : 1331 opacity: emptyPage.noMusic ? .4 : 1
321 color: "white"332 color: "white"
322 name: player.playbackState === MediaPlayer.PlayingState ? "media-playback-pause" : "media-playback-start"333 name: player.playbackState === MediaPlayer.PlayingState ? "media-playback-pause" : "media-playback-start"
334 objectName: "playShape"
323 }335 }
324 }336 }
325337
@@ -330,7 +342,6 @@
330 anchors.leftMargin: units.gu(1)342 anchors.leftMargin: units.gu(1)
331 anchors.verticalCenter: nowPlayingPlayButton.verticalCenter343 anchors.verticalCenter: nowPlayingPlayButton.verticalCenter
332 height: units.gu(6)344 height: units.gu(6)
333 objectName: "forwardShape"
334 opacity: trackQueue.model.count === 0 ? .4 : 1345 opacity: trackQueue.model.count === 0 ? .4 : 1
335 width: height346 width: height
336 onClicked: player.nextSong()347 onClicked: player.nextSong()
@@ -343,6 +354,7 @@
343 anchors.horizontalCenter: parent.horizontalCenter354 anchors.horizontalCenter: parent.horizontalCenter
344 color: "white"355 color: "white"
345 name: "media-skip-forward"356 name: "media-skip-forward"
357 objectName: "forwardShape"
346 opacity: 1358 opacity: 1
347 }359 }
348 }360 }
@@ -350,7 +362,6 @@
350 /* Shuffle button */362 /* Shuffle button */
351 MouseArea {363 MouseArea {
352 id: nowPlayingShuffleButton364 id: nowPlayingShuffleButton
353 objectName: "shuffleShape"
354 anchors.left: nowPlayingNextButton.right365 anchors.left: nowPlayingNextButton.right
355 anchors.leftMargin: units.gu(1)366 anchors.leftMargin: units.gu(1)
356 anchors.verticalCenter: nowPlayingPlayButton.verticalCenter367 anchors.verticalCenter: nowPlayingPlayButton.verticalCenter
@@ -367,6 +378,7 @@
367 anchors.horizontalCenter: parent.horizontalCenter378 anchors.horizontalCenter: parent.horizontalCenter
368 color: "white"379 color: "white"
369 name: "media-playlist-shuffle"380 name: "media-playlist-shuffle"
381 objectName: "shuffleShape"
370 opacity: player.shuffle && !emptyPage.noMusic ? 1 : .4382 opacity: player.shuffle && !emptyPage.noMusic ? 1 : .4
371 }383 }
372 }384 }
@@ -375,14 +387,16 @@
375387
376 ListView {388 ListView {
377 id: queuelist389 id: queuelist
378 visible: isListView
379 objectName: "nowPlayingQueueList"
380 anchors {390 anchors {
381 fill: parent391 fill: parent
382 }392 }
383 delegate: queueDelegate393 delegate: queueDelegate
394 footer: Item {
395 height: mainView.height - (styleMusic.common.expandHeight + queuelist.currentHeight) + units.gu(8)
396 }
397 highlightFollowsCurrentItem: false
384 model: trackQueue.model398 model: trackQueue.model
385 highlightFollowsCurrentItem: false399 objectName: "nowPlayingQueueList"
386 state: "normal"400 state: "normal"
387 states: [401 states: [
388 State {402 State {
@@ -400,9 +414,7 @@
400 }414 }
401 }415 }
402 ]416 ]
403 footer: Item {417 visible: isListView
404 height: mainView.height - (styleMusic.common.expandHeight + queuelist.currentHeight) + units.gu(8)
405 }
406418
407 property int normalHeight: units.gu(12)419 property int normalHeight: units.gu(12)
408 property int currentHeight: units.gu(40)420 property int currentHeight: units.gu(40)
409421
=== modified file 'MusicToolbar.qml'
--- MusicToolbar.qml 2014-10-04 03:49:08 +0000
+++ MusicToolbar.qml 2014-10-07 15:28:54 +0000
@@ -35,40 +35,11 @@
35 property var currentPage: null35 property var currentPage: null
36 property var currentSheet: []36 property var currentSheet: []
37 property var currentTab: null37 property var currentTab: null
38 property var previousPage: null
3938
40 // Properties and signals for the toolbar39 // Properties and signals for the toolbar
41 property var cachedStates: []
42 property bool shown: false
43 property int transitionDuration: 100
44
45 property alias currentHeight: musicToolbarPanel.height40 property alias currentHeight: musicToolbarPanel.height
46 property alias expandedHeight: musicToolbarPanel.expandedHeight
47 property alias fullHeight: musicToolbarPanel.fullHeight
48 property alias mouseAreaOffset: musicToolbarPanel.hintSize
49
50 property alias animating: musicToolbarPanel.animating
51 property alias opened: musicToolbarPanel.opened41 property alias opened: musicToolbarPanel.opened
5242
53 // Alias for autopilot
54 property alias currentMode: musicToolbarPanel.currentMode
55
56 Connections {
57 id: pageStackConn
58 target: mainPageStack
59
60 onCurrentPageChanged: {
61 previousPage = currentPage;
62
63 // If going back from nowPlaying jump back to tabs
64 if (previousPage === nowPlaying && mainPageStack.currentPage !== nowPlaying) {
65 while (mainPageStack.depth > 1) {
66 mainPageStack.pop(mainPageStack.currentPage)
67 }
68 }
69 }
70 }
71
72 /* Helper functions */43 /* Helper functions */
7344
74 // Back button has been pressed, jump up pageStack or back to parent page45 // Back button has been pressed, jump up pageStack or back to parent page
@@ -97,8 +68,6 @@
97 function setPage(childPage)68 function setPage(childPage)
98 {69 {
99 currentPage = childPage;70 currentPage = childPage;
100 // note: If pageStack tracking is needed readd here
101 //currentPageStack = pageStack === undefined ? null : pageStack;
102 }71 }
10372
104 // Set the current sheet (overrides page)73 // Set the current sheet (overrides page)
@@ -113,537 +82,10 @@
113 right: parent.right82 right: parent.right
114 bottom: parent.bottom83 bottom: parent.bottom
115 }84 }
116 // TODO: this will be removed when the toolbar is redone85 height: units.gu(7.25)
117 height: currentMode === "hidden" ? 0 : (currentMode === "full" ? fullHeight : expandedHeight)
118 locked: true86 locked: true
119 opened: true87 opened: true
12088
121 // TODO: this will be removed when the toolbar is redone
122 // The current mode of the controls
123 property string currentMode: !nowPlaying.isListView && currentPage === nowPlaying
124 ? "hidden" : (wideAspect || currentPage === nowPlaying
125 ? "full" : "expanded")
126
127 // Properties for the different heights
128 property int expandedHeight: units.gu(7.25)
129 property int fullHeight: units.gu(11)
130
131 onCurrentModeChanged: {
132 musicToolbarFullProgressMouseArea.enabled = currentMode === "full"
133 }
134
135 /* Full toolbar */
136 Rectangle {
137 id: musicToolbarFullContainer
138 anchors {
139 fill: parent
140 }
141 color: styleMusic.toolbar.fullBackgroundColor
142 visible: musicToolbarPanel.currentMode === "full"
143
144 /* Buttons component */
145 Rectangle {
146 id: musicToolbarFullButtonsContainer
147 anchors.left: parent.left
148 anchors.top: musicToolbarFullProgressContainer.bottom
149 color: "transparent"
150 height: parent.height - musicToolbarFullProgressContainer.height
151 width: parent.width
152
153 /* Column for labels in wideAspect */
154 Column {
155 id: nowPlayingWideAspectLabels
156 anchors {
157 left: parent.left
158 leftMargin: units.gu(1)
159 right: nowPlayingRepeatButton.left
160 rightMargin: units.gu(1)
161 verticalCenter: parent.verticalCenter
162 }
163 visible: wideAspect
164
165 /* Clicking in the area shows the queue */
166 function trigger() {
167 if (trackQueue.model.count !== 0 && currentPage !== nowPlaying) {
168 tabs.pushNowPlaying();
169 }
170 else if (currentPage === nowPlaying) {
171 musicToolbar.goBack();
172 }
173 }
174
175 /* Title of track */
176 Label {
177 id: nowPlayingWideAspectTitle
178 anchors {
179 left: parent.left
180 leftMargin: units.gu(1)
181 right: parent.right
182 rightMargin: units.gu(1)
183 }
184 color: styleMusic.playerControls.labelColor
185 elide: Text.ElideRight
186 fontSize: "medium"
187 objectName: "playercontroltitle"
188 text: trackQueue.model.count === 0 ? "" : player.currentMetaTitle === "" ? player.currentMetaFile : player.currentMetaTitle
189 }
190
191 /* Artist of track */
192 Label {
193 id: nowPlayingWideAspectArtist
194 anchors {
195 left: parent.left
196 leftMargin: units.gu(1)
197 right: parent.right
198 rightMargin: units.gu(1)
199 }
200 color: styleMusic.playerControls.labelColor
201 elide: Text.ElideRight
202 fontSize: "small"
203 text: trackQueue.model.count === 0 ? "" : player.currentMetaArtist
204 }
205
206 /* Album of track */
207 Label {
208 id: nowPlayingWideAspectAlbum
209 anchors {
210 left: parent.left
211 leftMargin: units.gu(1)
212 right: parent.right
213 rightMargin: units.gu(1)
214 }
215 color: styleMusic.playerControls.labelColor
216 elide: Text.ElideRight
217 fontSize: "small"
218 text: trackQueue.model.count === 0 ? "" : player.currentMetaAlbum
219 }
220 }
221
222 /* Repeat button */
223 Item {
224 id: nowPlayingRepeatButton
225 objectName: "repeatShape"
226 anchors.right: nowPlayingPreviousButton.left
227 anchors.rightMargin: units.gu(1)
228 anchors.verticalCenter: parent.verticalCenter
229 height: units.gu(6)
230 opacity: player.repeat && !emptyPage.noMusic ? 1 : .4
231 width: height
232
233 function trigger() {
234 if (emptyPage.noMusic) {
235 return;
236 }
237
238 // Invert repeat settings
239 player.repeat = !player.repeat
240 }
241
242 Image {
243 id: repeatIcon
244 height: units.gu(3)
245 width: height
246 anchors.verticalCenter: parent.verticalCenter
247 anchors.horizontalCenter: parent.horizontalCenter
248 source: Qt.resolvedUrl("images/media-playlist-repeat.svg")
249 verticalAlignment: Text.AlignVCenter
250 opacity: player.repeat && !emptyPage.noMusic ? 1 : .4
251 }
252 }
253
254 /* Previous button */
255 Item {
256 id: nowPlayingPreviousButton
257 anchors.right: nowPlayingPlayButton.left
258 anchors.rightMargin: units.gu(1)
259 anchors.verticalCenter: parent.verticalCenter
260 height: units.gu(6)
261 objectName: "previousShape"
262 opacity: trackQueue.model.count === 0 ? .4 : 1
263 width: height
264
265 function trigger() {
266 if (trackQueue.model.count === 0) {
267 return;
268 }
269
270 player.previousSong()
271 }
272
273 Image {
274 id: nowPlayingPreviousIndicator
275 height: units.gu(3)
276 width: height
277 anchors.horizontalCenter: parent.horizontalCenter
278 anchors.verticalCenter: parent.verticalCenter
279 source: Qt.resolvedUrl("images/media-skip-backward.svg")
280 opacity: 1
281 }
282 }
283
284 /* Play/Pause button */
285 Rectangle {
286 id: nowPlayingPlayButton
287 anchors.horizontalCenter: parent.horizontalCenter
288 anchors.verticalCenter: parent.verticalCenter
289 antialiasing: true
290 color: styleMusic.toolbar.fullOuterPlayCircleColor
291 height: units.gu(12)
292 radius: height / 2
293 width: height
294
295 // draws the outter shadow/highlight
296 Rectangle {
297 id: sourceOutterFull
298 anchors { fill: parent; margins: -units.gu(0.1) }
299 radius: (width / 2)
300 antialiasing: true
301 gradient: Gradient {
302 GradientStop { position: 0.0; color: "black" }
303 GradientStop { position: 0.5; color: "transparent" }
304 GradientStop { position: 1.0; color: UbuntuColors.warmGrey }
305 }
306
307 Rectangle {
308 anchors.horizontalCenter: parent.horizontalCenter
309 anchors.verticalCenter: parent.verticalCenter
310 antialiasing: true
311 color: styleMusic.toolbar.fullOuterPlayCircleColor
312 height: nowPlayingPlayButton.height - units.gu(.1)
313 radius: height / 2
314 width: height
315
316 Rectangle {
317 id: nowPlayingPlayButtonInner
318 anchors.horizontalCenter: parent.horizontalCenter
319 anchors.verticalCenter: parent.verticalCenter
320 antialiasing: true
321 color: styleMusic.toolbar.fullInnerPlayCircleColor
322 height: units.gu(7)
323 radius: height / 2
324 width: height
325
326 // draws the inner shadow/highlight
327 Rectangle {
328 id: sourceInnerFull
329 anchors { fill: parent; margins: -units.gu(0.1) }
330 radius: (width / 2)
331 antialiasing: true
332 gradient: Gradient {
333 GradientStop { position: 0.0; color: UbuntuColors.warmGrey }
334 GradientStop { position: 0.5; color: "transparent" }
335 GradientStop { position: 1.0; color: "black" }
336 }
337
338 Rectangle {
339 anchors.horizontalCenter: parent.horizontalCenter
340 anchors.verticalCenter: parent.verticalCenter
341 antialiasing: true
342 color: styleMusic.toolbar.fullInnerPlayCircleColor
343 height: nowPlayingPlayButtonInner.height - units.gu(.1)
344 objectName: "playShape"
345 radius: height / 2
346 width: height
347
348 function trigger() {
349 if (emptyPage.noMusic) {
350 return;
351 }
352
353 if (trackQueue.model.count === 0) {
354 playRandomSong();
355 }
356 else {
357 player.toggle();
358 }
359 }
360
361 Image {
362 id: nowPlayingPlayIndicator
363 height: units.gu(6)
364 width: height
365 anchors.horizontalCenter: parent.horizontalCenter
366 anchors.verticalCenter: parent.verticalCenter
367 opacity: emptyPage.noMusic ? .4 : 1
368 source: player.playbackState === MediaPlayer.PlayingState ?
369 Qt.resolvedUrl("images/media-playback-pause.svg") : Qt.resolvedUrl("images/media-playback-start.svg")
370 }
371 }
372 }
373 }
374 }
375 }
376 }
377
378 /* Next button */
379 Item {
380 id: nowPlayingNextButton
381 anchors.left: nowPlayingPlayButton.right
382 anchors.leftMargin: units.gu(1)
383 anchors.verticalCenter: parent.verticalCenter
384 height: units.gu(6)
385 objectName: "forwardShape"
386 opacity: trackQueue.model.count === 0 ? .4 : 1
387 width: height
388
389 function trigger() {
390 if (trackQueue.model.count === 0 || emptyPage.noMusic) {
391 return;
392 }
393
394 player.nextSong()
395 }
396
397 Image {
398 id: nowPlayingNextIndicator
399 height: units.gu(3)
400 width: height
401 anchors.horizontalCenter: parent.horizontalCenter
402 anchors.verticalCenter: parent.verticalCenter
403 source: Qt.resolvedUrl("images/media-skip-forward.svg")
404 opacity: 1
405 }
406 }
407
408 /* Shuffle button */
409 Item {
410 id: nowPlayingShuffleButton
411 objectName: "shuffleShape"
412 anchors.left: nowPlayingNextButton.right
413 anchors.leftMargin: units.gu(1)
414 anchors.verticalCenter: parent.verticalCenter
415 height: units.gu(6)
416 opacity: player.shuffle && !emptyPage.noMusic ? 1 : .4
417 width: height
418
419 function trigger() {
420 if (emptyPage.noMusic) {
421 return;
422 }
423
424 // Invert shuffle settings
425 player.shuffle = !player.shuffle
426 }
427
428 Image {
429 id: shuffleIcon
430 height: units.gu(3)
431 width: height
432 anchors.verticalCenter: parent.verticalCenter
433 anchors.horizontalCenter: parent.horizontalCenter
434 source: Qt.resolvedUrl("images/media-playlist-shuffle.svg")
435 opacity: player.shuffle && !emptyPage.noMusic ? 1 : .4
436 }
437 }
438
439 /* Search button in wideAspect */
440 Item {
441 id: nowPlayingSearchButton
442 objectName: "searchShape"
443 anchors {
444 right: parent.right
445 rightMargin: units.gu(1)
446 verticalCenter: parent.verticalCenter
447 }
448 height: units.gu(6)
449 opacity: !emptyPage.noMusic ? 1 : .4
450 width: height
451 visible: wideAspect
452
453 function trigger() {
454 if (emptyPage.noMusic) {
455 return;
456 }
457
458 if (!searchSheet.sheetVisible) {
459 PopupUtils.open(searchSheet.sheet,
460 mainView, { title: i18n.tr("Search")} )
461 }
462 }
463
464 Image {
465 id: searchIcon
466 anchors {
467 horizontalCenter: parent.horizontalCenter
468 verticalCenter: parent.verticalCenter
469 }
470 height: units.gu(3)
471 opacity: !emptyPage.noMusic ? 1 : .4
472 source: Qt.resolvedUrl("images/search.svg")
473 width: height
474 }
475 }
476 }
477
478 /* Progress bar component */
479 Rectangle {
480 id: musicToolbarFullProgressContainer
481 anchors.left: parent.left
482 anchors.top: parent.top
483 color: styleMusic.toolbar.fullBackgroundColor
484 height: units.gu(3)
485 width: parent.width
486
487 /* Position label */
488 Label {
489 id: musicToolbarFullPositionLabel
490 anchors.left: parent.left
491 anchors.leftMargin: units.gu(2)
492 anchors.top: parent.top
493 color: styleMusic.nowPlaying.labelColor
494 fontSize: "x-small"
495 height: parent.height
496 horizontalAlignment: Text.AlignHCenter
497 text: durationToString(player.position)
498 verticalAlignment: Text.AlignVCenter
499 width: units.gu(3)
500 }
501
502 /* Progress bar */
503 Rectangle {
504 id: musicToolbarFullProgressBarContainer
505 objectName: "progressBarShape"
506 anchors.left: musicToolbarFullPositionLabel.right
507 anchors.leftMargin: units.gu(2)
508 anchors.right: musicToolbarFullDurationLabel.left
509 anchors.rightMargin: units.gu(2)
510 anchors.verticalCenter: parent.verticalCenter
511 color: "transparent"
512 height: units.gu(1);
513 state: trackQueue.model.count === 0 ? "disabled" : "enabled"
514
515 states: [
516 State {
517 name: "disabled"
518 PropertyChanges {
519 target: musicToolbarFullProgressMouseArea
520 enabled: false
521 }
522 PropertyChanges {
523 target: musicToolbarFullProgressTrough
524 visible: false
525 }
526 PropertyChanges {
527 target: musicToolbarFullProgressHandle
528 visible: false
529 }
530 },
531 State {
532 name: "enabled"
533 PropertyChanges {
534 target: musicToolbarFullProgressMouseArea
535 enabled: true
536 }
537 PropertyChanges {
538 target: musicToolbarFullProgressTrough
539 visible: true
540 }
541 PropertyChanges {
542 target: musicToolbarFullProgressHandle
543 visible: true
544 }
545 }
546 ]
547
548 property bool seeking: false
549
550 onSeekingChanged: {
551 if (seeking === false) {
552 musicToolbarFullPositionLabel.text = durationToString(player.position)
553 }
554 }
555
556 Connections {
557 target: player
558 onDurationChanged: {
559 console.debug("Duration changed: " + player.duration)
560 musicToolbarFullDurationLabel.text = durationToString(player.duration)
561 }
562 onPositionChanged: {
563 if (musicToolbarFullProgressBarContainer.seeking === false)
564 {
565 musicToolbarFullPositionLabel.text = durationToString(player.position)
566 musicToolbarFullDurationLabel.text = durationToString(player.duration)
567 musicToolbarFullProgressHandle.x = (player.position / player.duration) * musicToolbarFullProgressBarContainer.width
568 - musicToolbarFullProgressHandle.width / 2;
569 }
570 }
571 onStopped: {
572 musicToolbarFullProgressHandle.x = -musicToolbarFullProgressHandle.width / 2;
573
574 musicToolbarFullPositionLabel.text = durationToString(0);
575 musicToolbarFullDurationLabel.text = durationToString(0);
576 }
577 }
578
579 // Black background behind the progress bar
580 Rectangle {
581 id: musicToolbarFullProgressBackground
582 anchors.verticalCenter: parent.verticalCenter;
583 color: styleMusic.toolbar.fullProgressBackgroundColor;
584 height: parent.height;
585 radius: units.gu(0.5)
586 width: parent.width;
587 }
588
589 // The orange fill of the progress bar
590 Rectangle {
591 id: musicToolbarFullProgressTrough
592 anchors.verticalCenter: parent.verticalCenter;
593 antialiasing: true
594 color: styleMusic.toolbar.fullProgressTroughColor;
595 height: parent.height;
596 radius: units.gu(0.5)
597 width: musicToolbarFullProgressHandle.x + (height / 2); // +radius
598 }
599
600 // The current position (handle) of the progress bar
601 Rectangle {
602 id: musicToolbarFullProgressHandle
603 anchors.verticalCenter: musicToolbarFullProgressBackground.verticalCenter
604 antialiasing: true
605 color: styleMusic.nowPlaying.progressHandleColor
606 height: units.gu(1.5)
607 radius: height / 2
608 width: height
609
610 // On X change update the position string
611 onXChanged: {
612 if (musicToolbarFullProgressBarContainer.seeking) {
613 var fraction = (x + (width / 2)) / parent.width;
614 musicToolbarFullPositionLabel.text = durationToString(fraction * player.duration)
615 }
616 }
617 }
618 }
619
620 /* Duration label */
621 Label {
622 id: musicToolbarFullDurationLabel
623 anchors.right: parent.right
624 anchors.rightMargin: units.gu(2)
625 anchors.top: parent.top
626 color: styleMusic.nowPlaying.labelColor
627 fontSize: "x-small"
628 height: parent.height
629 horizontalAlignment: Text.AlignHCenter
630 text: durationToString(player.duration)
631 verticalAlignment: Text.AlignVCenter
632 width: units.gu(3)
633 }
634
635 /* Border at the bottom */
636 Rectangle {
637 anchors.bottom: parent.bottom
638 anchors.left: parent.left
639 anchors.right: parent.right
640 color: styleMusic.common.white
641 height: units.gu(0.1)
642 opacity: 0.1
643 }
644 }
645 }
646
647 /* Expanded toolbar */89 /* Expanded toolbar */
648 Rectangle {90 Rectangle {
649 id: musicToolbarExpandedContainer91 id: musicToolbarExpandedContainer
@@ -651,7 +93,6 @@
651 fill: parent93 fill: parent
652 }94 }
653 color: "transparent"95 color: "transparent"
654 visible: musicToolbarPanel.currentMode === "expanded"
65596
656 Rectangle {97 Rectangle {
657 id: musicToolbarPlayerControls98 id: musicToolbarPlayerControls
@@ -835,7 +276,7 @@
835 height: units.gu(2.5)276 height: units.gu(2.5)
836 name: player.playbackState === MediaPlayer.PlayingState ?277 name: player.playbackState === MediaPlayer.PlayingState ?
837 "media-playback-pause" : "media-playback-start"278 "media-playback-pause" : "media-playback-start"
838 objectName: "smallPlayShape"279 objectName: "playShape"
839 width: height280 width: height
840 }281 }
841282
@@ -872,6 +313,7 @@
872 top: parent.top313 top: parent.top
873 }314 }
874 color: "transparent"315 color: "transparent"
316 objectName: "jumpNowPlaying"
875 function trigger() {317 function trigger() {
876 tabs.pushNowPlaying();318 tabs.pushNowPlaying();
877 }319 }
@@ -912,39 +354,6 @@
912 }354 }
913 }355 }
914 }356 }
915
916 /* Mouse events for the progress bar
917 is after musicToolbarMouseArea so that it captures mouse events for dragging */
918 MouseArea {
919 id: musicToolbarFullProgressMouseArea
920 height: units.gu(2)
921 width: musicToolbarFullProgressBarContainer.width
922 x: musicToolbarFullProgressBarContainer.x
923 y: musicToolbarFullProgressBarContainer.y
924
925 drag.axis: Drag.XAxis
926 drag.minimumX: -(musicToolbarFullProgressHandle.width / 2)
927 drag.maximumX: musicToolbarFullProgressBarContainer.width - (musicToolbarFullProgressHandle.width / 2)
928 drag.target: musicToolbarFullProgressHandle
929
930 onPressed: {
931 musicToolbarFullProgressBarContainer.seeking = true;
932
933 // Jump the handle to the current mouse position
934 musicToolbarFullProgressHandle.x = mouse.x - (musicToolbarFullProgressHandle.width / 2);
935 }
936
937 onReleased: {
938 var fraction = mouse.x / musicToolbarFullProgressBarContainer.width;
939
940 // Limit the bounds of the fraction
941 fraction = fraction < 0 ? 0 : fraction
942 fraction = fraction > 1 ? 1 : fraction
943
944 player.seek((fraction) * player.duration);
945 musicToolbarFullProgressBarContainer.seeking = false;
946 }
947 }
948 }357 }
949}358}
950359
951360
=== modified file 'common/MusicPage.qml'
--- common/MusicPage.qml 2014-09-30 15:18:25 +0000
+++ common/MusicPage.qml 2014-10-07 15:28:54 +0000
@@ -24,7 +24,7 @@
24Page {24Page {
25 id: thisPage25 id: thisPage
26 anchors {26 anchors {
27 bottomMargin: musicToolbar.currentHeight27 bottomMargin: musicToolbar.visible ? musicToolbar.currentHeight : 0
28 fill: parent28 fill: parent
29 }29 }
3030
3131
=== modified file 'music-app.qml'
--- music-app.qml 2014-10-04 01:45:45 +0000
+++ music-app.qml 2014-10-07 15:28:54 +0000
@@ -581,7 +581,7 @@
581 property string lastfmpassword581 property string lastfmpassword
582 property string timestamp // used to scrobble582 property string timestamp // used to scrobble
583 property var chosenElement: null583 property var chosenElement: null
584 property bool toolbarShown: musicToolbar.shown584 property bool toolbarShown: musicToolbar.visible
585 property bool selectedAlbum: false585 property bool selectedAlbum: false
586586
587 signal listItemSwiping(int i)587 signal listItemSwiping(int i)
@@ -973,7 +973,6 @@
973 Tabs {973 Tabs {
974 id: tabs974 id: tabs
975 anchors {975 anchors {
976 bottomMargin: wideAspect ? musicToolbar.fullHeight : undefined
977 fill: parent976 fill: parent
978 }977 }
979978
980979
=== modified file 'tests/autopilot/music_app/__init__.py'
--- tests/autopilot/music_app/__init__.py 2014-09-25 17:58:55 +0000
+++ tests/autopilot/music_app/__init__.py 2014-10-07 15:28:54 +0000
@@ -21,11 +21,22 @@
21 return func_wrapper21 return func_wrapper
2222
2323
24def ensure_toolbar_visible(func):24def ensure_now_playing_full(func):
25 """Wrapper which ensures the toolbar is shown before clicking"""25 """Wrapper which ensures the now playing is full before clicking"""
26 def func_wrapper(self, *args, **kwargs):26 def func_wrapper(self, *args, **kwargs):
27 if not self.opened:27 if self.isListView:
28 self.show()28 self.click_toggle_view()
29
30 return func(self, *args, **kwargs)
31
32 return func_wrapper
33
34
35def ensure_now_playing_list(func):
36 """Wrapper which ensures the now playing is list before clicking"""
37 def func_wrapper(self, *args, **kwargs):
38 if not self.isListView:
39 self.click_toggle_view()
2940
30 return func(self, *args, **kwargs)41 return func(self, *args, **kwargs)
3142
@@ -221,96 +232,54 @@
221 def __init__(self, *args):232 def __init__(self, *args):
222 super(MusicPage, self).__init__(*args)233 super(MusicPage, self).__init__(*args)
223234
224 def get_count(self):
225 return self.select_single("QQuickListView",
226 objectName="nowPlayingQueueList").count
227
228 def get_track(self, i):
229 return (self.wait_select_single(ListItemWithActions,
230 objectName="nowPlayingListItem" + str(i)))
231
232
233class AlbumsPage(MusicPage):
234 """ Autopilot helper for the albums page """
235 def __init__(self, *args):
236 super(MusicPage, self).__init__(*args)
237
238 self.visible.wait_for(True)
239
240 @click_object
241 def click_artist(self, i):
242 return self.wait_select_single("Standard",
243 objectName="albumsArtistListItem"
244 + str(i))
245
246 def get_artist(self):
247 return self.wait_select_single("Label", objectName="artistLabel").text
248
249
250class SongsPage(MusicPage):
251 """ Autopilot helper for the songs page """
252 def __init__(self, *args):
253 super(MusicPage, self).__init__(*args)
254
255 self.visible.wait_for(True)
256
257 @click_object
258 def click_track(self, i):
259 return self.get_track(i)
260
261 def get_header_artist_label(self):
262 return self.wait_select_single("Label",
263 objectName="songsPageHeaderAlbumArtist")
264
265 def get_track(self, i):
266 return (self.wait_select_single(ListItemWithActions,
267 objectName="songsPageListItem" + str(i)))
268
269
270class MusicToolbar(UbuntuUIToolkitCustomProxyObjectBase):
271 """Autopilot helper for the toolbar
272
273 expanded - refers to things when the toolbar is in its smaller state
274 full - refers to things when the toolbar is in its larger state
275 """
276 def __init__(self, *args):
277 super(MusicToolbar, self).__init__(*args)
278
279 root = self.get_root_instance()235 root = self.get_root_instance()
280 self.player = root.select_single(Player, objectName="player")236 self.player = root.select_single(Player, objectName="player")
281237
282 @ensure_toolbar_visible238 @ensure_now_playing_full
283 @click_object239 @click_object
284 def click_forward_button(self):240 def click_forward_button(self):
285 return self.wait_select_single("*", objectName="forwardShape")241 return self.wait_select_single("*", objectName="forwardShape")
286242
287 @ensure_toolbar_visible243 @ensure_now_playing_full
288 @click_object244 @click_object
289 def click_play_button(self):245 def click_play_button(self):
290 if self.currentMode == "full":246 return self.wait_select_single("*", objectName="playShape")
291 return self.wait_select_single("*", objectName="playShape")
292 else:
293 return self.wait_select_single("*", objectName="smallPlayShape")
294247
295 @ensure_toolbar_visible248 @ensure_now_playing_full
296 @click_object249 @click_object
297 def click_previous_button(self):250 def click_previous_button(self):
298 return self.wait_select_single("*", objectName="previousShape")251 return self.wait_select_single("*", objectName="previousShape")
299252
300 @ensure_toolbar_visible253 @ensure_now_playing_full
301 @click_object254 @click_object
302 def click_repeat_button(self):255 def click_repeat_button(self):
303 return self.wait_select_single("*", objectName="repeatShape")256 return self.wait_select_single("*", objectName="repeatShape")
304257
305 @ensure_toolbar_visible258 @ensure_now_playing_full
306 @click_object259 @click_object
307 def click_shuffle_button(self):260 def click_shuffle_button(self):
308 return self.wait_select_single("*", objectName="shuffleShape")261 return self.wait_select_single("*", objectName="shuffleShape")
309262
310 @ensure_toolbar_visible263 def click_toggle_view(self):
264 self.main_view.get_header().click_action_button("toggleView")
265
266 def get_count(self):
267 return self.select_single("QQuickListView",
268 objectName="nowPlayingQueueList").count
269
270 def go_back(self):
271 """Use custom back button to go back"""
272 self.main_view.get_header().click_custom_back_button()
273
274 @ensure_now_playing_list
275 def get_track(self, i):
276 return (self.wait_select_single(ListItemWithActions,
277 objectName="nowPlayingListItem" + str(i)))
278
279 @ensure_now_playing_full
311 def seek_to(self, percentage):280 def seek_to(self, percentage):
312 progress_bar = self.wait_select_single(281 progress_bar = self.wait_select_single(
313 "*", objectName="progressBarShape")282 "*", objectName="progressSliderShape")
314283
315 x1, y1, width, height = progress_bar.globalRect284 x1, y1, width, height = progress_bar.globalRect
316 y1 += height // 2285 y1 += height // 2
@@ -319,28 +288,77 @@
319288
320 self.pointing_device.drag(x1, y1, x2, y1)289 self.pointing_device.drag(x1, y1, x2, y1)
321290
322 @ensure_toolbar_visible
323 def set_repeat(self, state):291 def set_repeat(self, state):
324 if self.player.repeat != state:292 if self.player.repeat != state:
325 self.click_repeat_button()293 self.click_repeat_button()
326294
327 self.player.repeat.wait_for(state)295 self.player.repeat.wait_for(state)
328296
329 @ensure_toolbar_visible
330 def set_shuffle(self, state):297 def set_shuffle(self, state):
331 if self.player.shuffle != state:298 if self.player.shuffle != state:
332 self.click_shuffle_button()299 self.click_shuffle_button()
333300
334 self.player.shuffle.wait_for(state)301 self.player.shuffle.wait_for(state)
335302
336 def show(self):303
337 self.pointing_device.move_to_object(self)304class AlbumsPage(MusicPage):
338305 """ Autopilot helper for the albums page """
339 x1, y1 = self.pointing_device.position()306 def __init__(self, *args):
340307 super(MusicPage, self).__init__(*args)
341 y1 -= (self.height / 2) + 1 # get position at top of toolbar308
342309 self.visible.wait_for(True)
343 self.pointing_device.drag(x1, y1, x1, y1 - self.fullHeight)310
311 @click_object
312 def click_artist(self, i):
313 return self.wait_select_single("Standard",
314 objectName="albumsArtistListItem"
315 + str(i))
316
317 def get_artist(self):
318 return self.wait_select_single("Label", objectName="artistLabel").text
319
320
321class SongsPage(MusicPage):
322 """ Autopilot helper for the songs page """
323 def __init__(self, *args):
324 super(MusicPage, self).__init__(*args)
325
326 self.visible.wait_for(True)
327
328 @click_object
329 def click_track(self, i):
330 return self.get_track(i)
331
332 def get_header_artist_label(self):
333 return self.wait_select_single("Label",
334 objectName="songsPageHeaderAlbumArtist")
335
336 def get_track(self, i):
337 return (self.wait_select_single(ListItemWithActions,
338 objectName="songsPageListItem" + str(i)))
339
340
341class MusicToolbar(UbuntuUIToolkitCustomProxyObjectBase):
342 """Autopilot helper for the toolbar"""
343 def __init__(self, *args):
344 super(MusicToolbar, self).__init__(*args)
345
346 @click_object
347 def click_play_button(self):
348 return self.wait_select_single("*", objectName="playShape")
349
350 @click_object
351 def click_jump_to_now_playing(self):
352 return self.wait_select_single("*", objectName="jumpNowPlaying")
353
354 def switch_to_now_playing(self):
355 self.click_jump_to_now_playing()
356
357 root = self.get_root_instance()
358 now_playing_page = root.wait_select_single(MusicNowPlaying,
359 objectName="nowPlayingPage")
360
361 now_playing_page.visible.wait_for(True)
344362
345363
346class ListItemWithActions(UbuntuUIToolkitCustomProxyObjectBase):364class ListItemWithActions(UbuntuUIToolkitCustomProxyObjectBase):
347365
=== modified file 'tests/autopilot/music_app/tests/test_music.py'
--- tests/autopilot/music_app/tests/test_music.py 2014-09-23 20:45:41 +0000
+++ tests/autopilot/music_app/tests/test_music.py 2014-10-07 15:28:54 +0000
@@ -91,6 +91,11 @@
91 Eventually(NotEquals(end_tracks_count)))91 Eventually(NotEquals(end_tracks_count)))
92 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))92 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
9393
94 toolbar.switch_to_now_playing() # Switch to the now playing page
95
96 # Re get now playing page as it has changed
97 now_playing_page = self.app.get_now_playing_page()
98
94 # verify song's metadata matches the item added to the Now Playing view99 # verify song's metadata matches the item added to the Now Playing view
95 current_track = now_playing_page.get_track(self.player.currentIndex)100 current_track = now_playing_page.get_track(self.player.currentIndex)
96101
@@ -99,14 +104,14 @@
99 self.assertThat(current_track.get_label_text("titleLabel"),104 self.assertThat(current_track.get_label_text("titleLabel"),
100 Equals(self.tracks[0]["title"]))105 Equals(self.tracks[0]["title"]))
101106
102 # click on close button to close the page107 # click on close button to close the page and now playing page
103 self.app.main_view.go_back()108 now_playing_page.go_back()
104109
105 # click the play button to start playing110 # click the play button (toolbar) to start playing
106 toolbar.click_play_button()111 toolbar.click_play_button()
107 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))112 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
108113
109 # click the play button to stop playing114 # click the play button (toolbar) to stop playing
110 toolbar.click_play_button()115 toolbar.click_play_button()
111 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))116 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
112117
@@ -115,15 +120,15 @@
115120
116 self.app.populate_queue() # populate queue121 self.app.populate_queue() # populate queue
117122
118 toolbar = self.app.get_toolbar()123 now_playing_page = self.app.get_now_playing_page()
119124
120 # check that the player is playing and then select pause125 # check that the player is playing and then select pause
121 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))126 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
122 toolbar.click_play_button()127 now_playing_page.click_play_button()
123128
124 # check that the player is paused and then select play129 # check that the player is paused and then select play
125 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))130 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
126 toolbar.click_play_button()131 now_playing_page.click_play_button()
127132
128 # check that the player is playing133 # check that the player is playing
129 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))134 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
@@ -133,7 +138,7 @@
133138
134 self.app.populate_queue() # populate queue139 self.app.populate_queue() # populate queue
135140
136 toolbar = self.app.get_toolbar()141 now_playing_page = self.app.get_now_playing_page()
137142
138 # save original song data for later143 # save original song data for later
139 org_title = self.player.currentMetaTitle144 org_title = self.player.currentMetaTitle
@@ -144,17 +149,17 @@
144 logger.debug("Original Song %s, %s" % (org_title, org_artist))149 logger.debug("Original Song %s, %s" % (org_title, org_artist))
145150
146 # select pause and check the player has stopped151 # select pause and check the player has stopped
147 toolbar.click_play_button()152 now_playing_page.click_play_button()
148 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))153 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
149154
150 toolbar.set_shuffle(False) # ensure shuffe is off155 now_playing_page.set_shuffle(False) # ensure shuffe is off
151156
152 # goal is to go back and forth and ensure 2 different songs157 # goal is to go back and forth and ensure 2 different songs
153 toolbar.click_forward_button()158 now_playing_page.click_forward_button()
154 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))159 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
155160
156 # select pause and check the player has stopped161 # select pause and check the player has stopped
157 toolbar.click_play_button()162 now_playing_page.click_play_button()
158 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))163 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
159164
160 # ensure different song165 # ensure different song
@@ -166,14 +171,14 @@
166 logger.debug("Next Song %s, %s" % (self.player.currentMetaTitle,171 logger.debug("Next Song %s, %s" % (self.player.currentMetaTitle,
167 self.player.currentMetaArtist))172 self.player.currentMetaArtist))
168173
169 toolbar.seek_to(0) # seek to 0 (start)174 now_playing_page.seek_to(0) # seek to 0 (start)
170175
171 # select previous and ensure the track is playing176 # select previous and ensure the track is playing
172 toolbar.click_previous_button()177 now_playing_page.click_previous_button()
173 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))178 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
174179
175 # select pause and check the player has stopped180 # select pause and check the player has stopped
176 toolbar.click_play_button()181 now_playing_page.click_play_button()
177 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))182 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
178183
179 # ensure we're back to original song184 # ensure we're back to original song
@@ -207,13 +212,13 @@
207 self.assertThat(self.player.source.endswith("mp3"),212 self.assertThat(self.player.source.endswith("mp3"),
208 Equals(True))213 Equals(True))
209214
210 # Start playing the track215 # Start playing the track (click from toolbar)
211 toolbar.click_play_button()216 toolbar.click_play_button()
212217
213 # Check that the track is playing218 # Check that the track is playing
214 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))219 self.assertThat(self.player.isPlaying, Eventually(Equals(True)))
215220
216 # Stop playing the track221 # Stop playing the track (click from toolbar)
217 toolbar.click_play_button()222 toolbar.click_play_button()
218223
219 # Check current meta data is correct224 # Check current meta data is correct
@@ -229,15 +234,15 @@
229234
230 # at this point the track is playing and shuffle is enabled235 # at this point the track is playing and shuffle is enabled
231236
232 toolbar = self.app.get_toolbar()237 now_playing_page = self.app.get_now_playing_page()
233238
234 # pause the track if it is playing239 # pause the track if it is playing
235 if self.player.isPlaying:240 if self.player.isPlaying:
236 toolbar.click_play_button()241 now_playing_page.click_play_button()
237242
238 self.player.isPlaying.wait_for(False)243 self.player.isPlaying.wait_for(False)
239244
240 toolbar.set_shuffle(True) # enable shuffle245 now_playing_page.set_shuffle(True) # enable shuffle
241246
242 # save original song metadata247 # save original song metadata
243 org_title = self.player.currentMetaTitle248 org_title = self.player.currentMetaTitle
@@ -256,11 +261,11 @@
256 self.assertThat(count, LessThan(100))261 self.assertThat(count, LessThan(100))
257262
258 # select next track263 # select next track
259 toolbar.click_forward_button()264 now_playing_page.click_forward_button()
260265
261 # pause the track if it is playing266 # pause the track if it is playing
262 if self.player.isPlaying:267 if self.player.isPlaying:
263 toolbar.click_play_button()268 now_playing_page.click_play_button()
264269
265 # check it is paused270 # check it is paused
266 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))271 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
@@ -270,11 +275,11 @@
270275
271 # select previous track while will break if this previous track276 # select previous track while will break if this previous track
272 # is different and therefore a shuffle has occurred277 # is different and therefore a shuffle has occurred
273 toolbar.click_previous_button()278 now_playing_page.click_previous_button()
274279
275 # pause the track if it is playing280 # pause the track if it is playing
276 if self.player.isPlaying:281 if self.player.isPlaying:
277 toolbar.click_play_button()282 now_playing_page.click_play_button()
278283
279 # check it is paused284 # check it is paused
280 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))285 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
@@ -314,6 +319,7 @@
314 """tests navigating to the Albums tab and adding a song to queue"""319 """tests navigating to the Albums tab and adding a song to queue"""
315320
316 now_playing_page = self.app.get_now_playing_page()321 now_playing_page = self.app.get_now_playing_page()
322 toolbar = self.app.get_toolbar()
317323
318 # get number of tracks in queue before queuing a track324 # get number of tracks in queue before queuing a track
319 initial_tracks_count = now_playing_page.get_count()325 initial_tracks_count = now_playing_page.get_count()
@@ -341,6 +347,11 @@
341 # Assert that the song added to the list is not playing347 # Assert that the song added to the list is not playing
342 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))348 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
343349
350 toolbar.switch_to_now_playing() # Switch to the now playing page
351
352 # Re get now playing page as it has changed
353 now_playing_page = self.app.get_now_playing_page()
354
344 # verify song's metadata matches the item added to the Now Playing view355 # verify song's metadata matches the item added to the Now Playing view
345 current_track = now_playing_page.get_track(self.player.currentIndex)356 current_track = now_playing_page.get_track(self.player.currentIndex)
346357
@@ -349,8 +360,8 @@
349 self.assertThat(current_track.get_label_text("titleLabel"),360 self.assertThat(current_track.get_label_text("titleLabel"),
350 Equals(tracks[0]["title"]))361 Equals(tracks[0]["title"]))
351362
352 # click on close button to close songs page363 # click on close button to close nowplaying and songs page
353 self.app.main_view.go_back()364 now_playing_page.go_back()
354365
355 # check that the albums page is now visible366 # check that the albums page is now visible
356 self.assertThat(albums_page.visible, Eventually(Equals(True)))367 self.assertThat(albums_page.visible, Eventually(Equals(True)))
@@ -391,6 +402,7 @@
391 to the queue via the expandable list view item. """402 to the queue via the expandable list view item. """
392403
393 now_playing_page = self.app.get_now_playing_page()404 now_playing_page = self.app.get_now_playing_page()
405 toolbar = self.app.get_toolbar()
394406
395 # get number of tracks in queue before queuing a track407 # get number of tracks in queue before queuing a track
396 initial_tracks_count = now_playing_page.get_count()408 initial_tracks_count = now_playing_page.get_count()
@@ -413,6 +425,11 @@
413 Eventually(NotEquals(now_playing_page.get_count())))425 Eventually(NotEquals(now_playing_page.get_count())))
414 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))426 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
415427
428 toolbar.switch_to_now_playing() # Switch to the now playing page
429
430 # Re get now playing page as it has changed
431 now_playing_page = self.app.get_now_playing_page()
432
416 # verify song's metadata matches the item added to the Now Playing view433 # verify song's metadata matches the item added to the Now Playing view
417 current_track = now_playing_page.get_track(self.player.currentIndex)434 current_track = now_playing_page.get_track(self.player.currentIndex)
418435
@@ -552,14 +569,13 @@
552 self.app.populate_queue() # populate queue569 self.app.populate_queue() # populate queue
553570
554 now_playing_page = self.app.get_now_playing_page()571 now_playing_page = self.app.get_now_playing_page()
555 toolbar = self.app.get_toolbar()
556572
557 toolbar.set_shuffle(False)573 now_playing_page.set_shuffle(False)
558 toolbar.set_repeat(False)574 now_playing_page.set_repeat(False)
559575
560 # Skip through all songs in queue, stopping on last one.576 # Skip through all songs in queue, stopping on last one.
561 for count in range(0, now_playing_page.get_count() - 1):577 for count in range(0, now_playing_page.get_count() - 1):
562 toolbar.click_forward_button()578 now_playing_page.click_forward_button()
563579
564 # When the last song ends, playback should stop580 # When the last song ends, playback should stop
565 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))581 self.assertThat(self.player.isPlaying, Eventually(Equals(False)))
@@ -570,14 +586,13 @@
570 self.app.populate_queue() # populate queue586 self.app.populate_queue() # populate queue
571587
572 now_playing_page = self.app.get_now_playing_page()588 now_playing_page = self.app.get_now_playing_page()
573 toolbar = self.app.get_toolbar()
574589
575 toolbar.set_shuffle(False)590 now_playing_page.set_shuffle(False)
576 toolbar.set_repeat(True)591 now_playing_page.set_repeat(True)
577592
578 # Skip through all songs in queue, stopping on last one.593 # Skip through all songs in queue, stopping on last one.
579 for count in range(0, now_playing_page.get_count() - 1):594 for count in range(0, now_playing_page.get_count() - 1):
580 toolbar.click_forward_button()595 now_playing_page.click_forward_button()
581596
582 # Make sure we loop back to first song after last song ends597 # Make sure we loop back to first song after last song ends
583 self.assertThat(self.player.currentMetaTitle,598 self.assertThat(self.player.currentMetaTitle,
@@ -590,14 +605,13 @@
590 self.app.populate_queue() # populate queue605 self.app.populate_queue() # populate queue
591606
592 now_playing_page = self.app.get_now_playing_page()607 now_playing_page = self.app.get_now_playing_page()
593 toolbar = self.app.get_toolbar()
594608
595 toolbar.set_shuffle(False)609 now_playing_page.set_shuffle(False)
596 toolbar.set_repeat(True)610 now_playing_page.set_repeat(True)
597611
598 # Skip through all songs in queue, INCLUDING last one.612 # Skip through all songs in queue, INCLUDING last one.
599 for count in range(0, now_playing_page.get_count() - 1):613 for count in range(0, now_playing_page.get_count() - 1):
600 toolbar.click_forward_button()614 now_playing_page.click_forward_button()
601615
602 # Make sure we loop back to first song after last song ends616 # Make sure we loop back to first song after last song ends
603 self.assertThat(self.player.currentMetaTitle,617 self.assertThat(self.player.currentMetaTitle,
@@ -609,19 +623,19 @@
609623
610 self.app.populate_queue() # populate queue624 self.app.populate_queue() # populate queue
611625
612 toolbar = self.app.get_toolbar()626 now_playing_page = self.app.get_now_playing_page()
613627
614 toolbar.set_shuffle(False)628 now_playing_page.set_shuffle(False)
615 toolbar.set_repeat(True)629 now_playing_page.set_repeat(True)
616630
617 initial_song = self.player.currentMetaTitle631 initial_song = self.player.currentMetaTitle
618 toolbar.click_previous_button()632 now_playing_page.click_previous_button()
619633
620 # If we're far enough into a song, pressing prev just takes us to the634 # If we're far enough into a song, pressing prev just takes us to the
621 # beginning of that track. In that case, hit prev again to actually635 # beginning of that track. In that case, hit prev again to actually
622 # skip over the track.636 # skip over the track.
623 if self.player.currentMetaTitle == initial_song:637 if self.player.currentMetaTitle == initial_song:
624 toolbar.click_previous_button()638 now_playing_page.click_previous_button()
625639
626 self.assertThat(self.player.currentMetaTitle,640 self.assertThat(self.player.currentMetaTitle,
627 Eventually(Equals(self.tracks[-1]["title"])))641 Eventually(Equals(self.tracks[-1]["title"])))
@@ -632,17 +646,17 @@
632646
633 self.app.populate_queue() # populate queue647 self.app.populate_queue() # populate queue
634648
635 toolbar = self.app.get_toolbar()649 now_playing_page = self.app.get_now_playing_page()
636650
637 self.player.isPlaying.wait_for(True) # ensure the track is playing651 self.player.isPlaying.wait_for(True) # ensure the track is playing
638 self.player.position.wait_for(GreaterThan(5000)) # wait until > 5s652 self.player.position.wait_for(GreaterThan(5000)) # wait until > 5s
639653
640 toolbar.click_play_button() # pause the track654 now_playing_page.click_play_button() # pause the track
641 self.player.isPlaying.wait_for(False) # ensure the track has paused655 self.player.isPlaying.wait_for(False) # ensure the track has paused
642656
643 source = self.player.source # store current source657 source = self.player.source # store current source
644658
645 toolbar.click_previous_button() # click previous659 now_playing_page.click_previous_button() # click previous
646660
647 self.player.position.wait_for(LessThan(5000)) # wait until < 5s661 self.player.position.wait_for(LessThan(5000)) # wait until < 5s
648662

Subscribers

People subscribed via source and target branches