Add test_time_position_when_playing and test_time_position_when_paused fixing code to pass them
This commit is contained in:
parent
5fc47b8611
commit
ba7a836d8b
@ -94,7 +94,10 @@ class GStreamerPlaybackController(BasePlaybackController):
|
||||
|
||||
@property
|
||||
def time_position(self):
|
||||
return 0
|
||||
try:
|
||||
return self.bin.query_position(gst.FORMAT_TIME)[0] // gst.MSECOND
|
||||
except gst.QueryError:
|
||||
return 0
|
||||
|
||||
def destroy(self):
|
||||
self.bin.set_state(gst.STATE_NULL)
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import random
|
||||
import time
|
||||
|
||||
from mopidy.models import Playlist, Track
|
||||
|
||||
@ -559,11 +560,25 @@ class BasePlaybackControllerTest(object):
|
||||
def test_time_position_when_stopped_with_playlist(self):
|
||||
self.assertEqual(self.playback.time_position, 0)
|
||||
|
||||
@populate_playlist
|
||||
def test_time_position_when_playing(self):
|
||||
raise NotImplementedError
|
||||
self.playback.play()
|
||||
time.sleep(0.1)
|
||||
first = self.playback.time_position
|
||||
time.sleep(0.1)
|
||||
second = self.playback.time_position
|
||||
|
||||
self.assert_(second > first, '%s - %s' % (first, second))
|
||||
|
||||
@populate_playlist
|
||||
def test_time_position_when_paused(self):
|
||||
raise NotImplementedError
|
||||
self.playback.play()
|
||||
time.sleep(0.1)
|
||||
self.playback.pause()
|
||||
first = self.playback.time_position
|
||||
second = self.playback.time_position
|
||||
|
||||
self.assertEqual(first, second)
|
||||
|
||||
def test_volume(self):
|
||||
if not self.supports_volume:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user