Result of prepare_change no longer affects whether a track is added to the history.

Update changelog and test cases.
This commit is contained in:
jcass 2015-12-07 07:53:34 +02:00
parent 139634b93b
commit fb7b466bee
3 changed files with 11 additions and 15 deletions

View File

@ -19,9 +19,9 @@ Bug fix release.
- MPD: Notify idling clients when a seek is performed. (Fixes: :issue:`1331`) - MPD: Notify idling clients when a seek is performed. (Fixes: :issue:`1331`)
- Core: Fix :meth:`~mopidy.core.PlaybackController._change_track` to mark - Core: Fix bug in playback controller. If changing to another track while
track as playing and add it to the history if changing track while paused. the player is paused, the new track would not be added to the history or
(Fixes: :issue:`1352`) marked as currently playing. (Fixes: :issue:`1352`)
v1.1.1 (2015-09-14) v1.1.1 (2015-09-14)

View File

@ -211,9 +211,8 @@ class PlaybackController(object):
# code has already been killed in the gapless branch. # code has already been killed in the gapless branch.
backend = self._get_backend() backend = self._get_backend()
if backend: if backend:
success = ( backend.playback.prepare_change()
backend.playback.prepare_change().get and success = backend.playback.change_track(tl_track.track).get()
backend.playback.change_track(tl_track.track).get())
if success: if success:
self.core.tracklist._mark_playing(tl_track) self.core.tracklist._mark_playing(tl_track)
self.core.history._add_track(tl_track.track) self.core.history._add_track(tl_track.track)

View File

@ -813,20 +813,17 @@ class Bug1352RegressionTest(unittest.TestCase):
c = core.Core(config, mixer=None, backends=[b]) c = core.Core(config, mixer=None, backends=[b])
c.tracklist.add([track1, track2]) c.tracklist.add([track1, track2])
d = mock.Mock() c.history._add_track = mock.PropertyMock()
c.history._add_track = d c.tracklist._mark_playing = mock.PropertyMock()
e = mock.Mock()
c.tracklist._mark_playing = e
c.playback.play() c.playback.play()
b.playback.change_track.reset_mock() b.playback.change_track.reset_mock()
d.reset_mock() c.history._add_track.reset_mock()
e.reset_mock() c.tracklist._mark_playing.reset_mock()
c.playback.pause() c.playback.pause()
c.playback.next() c.playback.next()
b.playback.change_track.assert_called_once_with(track2) b.playback.change_track.assert_called_once_with(track2)
c.history._add_track.assert_called_once_with(track2)
d.assert_called_once_with(track2) c.tracklist._mark_playing.assert_called_once_with(tl_track2)
e.assert_called_once_with(tl_track2)