Tests for paused state and gstreamer impl
This commit is contained in:
parent
d38d64d30f
commit
ff001a899c
@ -114,6 +114,9 @@ class BasePlaybackController(object):
|
||||
def next(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def pause(self):
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def next_track(self):
|
||||
playlist = self.backend.current_playlist.playlist
|
||||
|
||||
@ -77,6 +77,10 @@ class GStreamerPlaybackController(BasePlaybackController):
|
||||
def stop(self):
|
||||
self.bin.set_state(gst.STATE_NULL)
|
||||
|
||||
def pause(self):
|
||||
if self.state == self.PLAYING:
|
||||
self.bin.set_state(gst.STATE_PAUSED)
|
||||
|
||||
def next(self):
|
||||
playlist = self.backend.current_playlist.playlist
|
||||
|
||||
|
||||
@ -349,20 +349,34 @@ class BasePlaybackControllerTest(object):
|
||||
def test_new_playlist_loaded_callback(self):
|
||||
raise NotImplementedError
|
||||
|
||||
@populate_playlist
|
||||
def test_pause_when_stopped(self):
|
||||
raise NotImplementedError
|
||||
self.playback.pause()
|
||||
self.assertEqual(self.playback.state, self.playback.STOPPED)
|
||||
|
||||
@populate_playlist
|
||||
def test_pause_when_playing(self):
|
||||
raise NotImplementedError
|
||||
self.playback.play()
|
||||
self.playback.pause()
|
||||
self.assertEqual(self.playback.state, self.playback.PAUSED)
|
||||
|
||||
@populate_playlist
|
||||
def test_pause_when_paused(self):
|
||||
raise NotImplementedError
|
||||
self.playback.play()
|
||||
self.playback.pause()
|
||||
self.playback.pause()
|
||||
self.assertEqual(self.playback.state, self.playback.PAUSED)
|
||||
|
||||
@populate_playlist
|
||||
def test_resume_when_stopped(self):
|
||||
raise NotImplementedError
|
||||
self.playback.resume()
|
||||
self.assertEqual(self.playback.state, self.playback.PLAYING)
|
||||
|
||||
@populate_playlist
|
||||
def test_resume_when_playing(self):
|
||||
raise NotImplementedError
|
||||
self.playback.play()
|
||||
self.playback.resume()
|
||||
self.assertEqual(self.playback.state, self.playback.PLAYING)
|
||||
|
||||
def test_resume_when_paused(self):
|
||||
raise NotImplementedError
|
||||
|
||||
Loading…
Reference in New Issue
Block a user