diff --git a/docs/changelog.rst b/docs/changelog.rst index 7d901aef..41d5cccc 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -19,9 +19,9 @@ Bug fix release. - MPD: Notify idling clients when a seek is performed. (Fixes: :issue:`1331`) -- Core: Fix :meth:`~mopidy.core.PlaybackController._change_track` to mark - track as playing and add it to the history if changing track while paused. - (Fixes: :issue:`1352`) +- Core: Fix bug in playback controller. If changing to another track while + the player is paused, the new track would not be added to the history or + marked as currently playing. (Fixes: :issue:`1352`) v1.1.1 (2015-09-14) diff --git a/mopidy/core/playback.py b/mopidy/core/playback.py index e3a4f68d..eeba5106 100644 --- a/mopidy/core/playback.py +++ b/mopidy/core/playback.py @@ -211,9 +211,8 @@ class PlaybackController(object): # code has already been killed in the gapless branch. backend = self._get_backend() if backend: - success = ( - backend.playback.prepare_change().get and - backend.playback.change_track(tl_track.track).get()) + backend.playback.prepare_change() + success = backend.playback.change_track(tl_track.track).get() if success: self.core.tracklist._mark_playing(tl_track) self.core.history._add_track(tl_track.track) diff --git a/tests/core/test_playback.py b/tests/core/test_playback.py index 6bacb3ed..f7b6dfda 100644 --- a/tests/core/test_playback.py +++ b/tests/core/test_playback.py @@ -813,20 +813,17 @@ class Bug1352RegressionTest(unittest.TestCase): c = core.Core(config, mixer=None, backends=[b]) c.tracklist.add([track1, track2]) - d = mock.Mock() - c.history._add_track = d + c.history._add_track = mock.PropertyMock() + c.tracklist._mark_playing = mock.PropertyMock() - e = mock.Mock() - c.tracklist._mark_playing = e c.playback.play() b.playback.change_track.reset_mock() - d.reset_mock() - e.reset_mock() + c.history._add_track.reset_mock() + c.tracklist._mark_playing.reset_mock() c.playback.pause() c.playback.next() b.playback.change_track.assert_called_once_with(track2) - - d.assert_called_once_with(track2) - e.assert_called_once_with(tl_track2) + c.history._add_track.assert_called_once_with(track2) + c.tracklist._mark_playing.assert_called_once_with(tl_track2) \ No newline at end of file