Add test_seek_beyond_end_of_song and test_seek_beyond_end_of_song_for_last_track

This commit is contained in:
Thomas Adamcik 2010-03-07 22:24:05 +01:00
parent c5d89cb57f
commit 3a19794a15
2 changed files with 13 additions and 1 deletions

View File

@ -103,6 +103,9 @@ class GStreamerPlaybackController(BasePlaybackController):
if time_position < 0:
time_position = 0
elif self.current_track and time_position > self.current_track.length:
self.next()
return
self._bin.seek_simple(gst.Format(gst.FORMAT_TIME),
gst.SEEK_FLAG_FLUSH, time_position * gst.MSECOND)

View File

@ -587,8 +587,17 @@ class BasePlaybackControllerTest(object):
self.playback.seek(0)
self.assertEqual(self.playback.state, self.playback.PLAYING)
@populate_playlist
def test_seek_beyond_end_of_song(self):
raise NotImplementedError
self.playback.play()
self.playback.seek(self.tracks[0].length*100)
self.assertEqual(self.playback.current_track, self.tracks[1])
@populate_playlist
def test_seek_beyond_end_of_song_for_last_track(self):
self.playback.play(self.tracks[-1])
self.playback.seek(self.tracks[-1].length*100)
self.assertEqual(self.playback.state, self.playback.STOPPED)
@populate_playlist
def test_seek_beyond_start_of_song(self):