Add test_previous_track_with_consume and test_previous_track_with_random

This commit is contained in:
Thomas Adamcik 2010-02-20 03:16:38 +01:00
parent 5c62bc642c
commit ce5c3780a3
2 changed files with 19 additions and 10 deletions

View File

@ -163,6 +163,9 @@ class BasePlaybackController(object):
def previous_track(self):
playlist = self.backend.current_playlist.playlist
if self.repeat or self.consume:
return self.current_track
if self.current_track is None:
return None

View File

@ -413,6 +413,22 @@ class BasePlaybackControllerTest(object):
def test_previous_track_empty_playlist(self):
self.assertEqual(self.playback.previous_track, None)
@populate_playlist
def test_previous_track_with_consume(self):
self.playback.consume = True
for track in self.tracks:
self.playback.next()
self.assertEqual(self.playback.previous_track,
self.playback.current_track)
@populate_playlist
def test_previous_track_with_random(self):
self.playback.repeat = True
for track in self.tracks:
self.playback.next()
self.assertEqual(self.playback.previous_track,
self.playback.current_track)
@populate_playlist
def test_initial_current_track(self):
tracks = self.backend.current_playlist.playlist.tracks
@ -662,13 +678,6 @@ class BasePlaybackControllerTest(object):
tracks = self.backend.current_playlist.playlist.tracks
self.assert_(self.tracks[0] not in tracks)
@populate_playlist
def test_previous_track_with_consume(self):
self.playback.consume = True
self.playback.play()
self.playback.next()
self.assertEqual(self.playback.previous_track, None)
def test_play_with_random(self):
raise NotImplementedError
@ -681,9 +690,6 @@ class BasePlaybackControllerTest(object):
def test_next_track_with_random(self):
raise NotImplementedError
def test_previous_track_with_random(self):
raise NotImplementedError
@populate_playlist
def test_end_of_song_starts_next_track(self):
tracks = self.backend.current_playlist.playlist.tracks