Test and implement mpris.CanControl property

This commit is contained in:
Stein Magnus Jodal 2011-06-20 00:33:57 +03:00
parent 22cba6f75c
commit a4d73a8d7e
2 changed files with 9 additions and 2 deletions

View File

@ -157,8 +157,7 @@ class MprisObject(dbus.service.Object):
'CanPause': (False, None),
# TODO Set to True when the rest is implemented
'CanSeek': (False, None),
# TODO Set to True when the rest is implemented
'CanControl': (False, None),
'CanControl': (self.get_CanControl, None),
}
def _connect_to_dbus(self):
@ -386,3 +385,7 @@ class MprisObject(dbus.service.Object):
def get_Position(self):
return self.backend.playback.time_position.get() * 1000
def get_CanControl(self):
# TODO This could be a setting for the end user to change.
return True

View File

@ -157,6 +157,10 @@ class PlayerInterfaceTest(unittest.TestCase):
result = self.mpris.Get(mpris.PLAYER_IFACE, 'MaximumRate')
self.assert_(result >= 1.0)
def test_can_control_is_true(self):
result = self.mpris.Get(mpris.PLAYER_IFACE, 'CanControl')
self.assertTrue(result)
def test_next_when_playing_should_skip_to_next_track_and_keep_playing(self):
self.backend.current_playlist.append([Track(uri='a'), Track(uri='b')])
self.backend.playback.play()