Check if CanControl==true in set_Rate for consistency (even though the spec doesn't mention it)
This commit is contained in:
parent
3f325c936d
commit
26868401c6
@ -381,6 +381,11 @@ class MprisObject(dbus.service.Object):
|
||||
self.backend.playback.single = False
|
||||
|
||||
def set_Rate(self, value):
|
||||
if not self.get_CanControl():
|
||||
# NOTE The spec does not explictly require this check, but it was
|
||||
# added to be consistent with all the other property setters.
|
||||
logger.debug(u'Setting %s.Rate not allowed', PLAYER_IFACE)
|
||||
return # TODO Raise error
|
||||
if value == 0:
|
||||
self.Pause()
|
||||
|
||||
|
||||
@ -89,6 +89,14 @@ class PlayerInterfaceTest(unittest.TestCase):
|
||||
maximum_rate = self.mpris.Get(mpris.PLAYER_IFACE, 'MaximumRate')
|
||||
self.assert_(rate >= maximum_rate)
|
||||
|
||||
def test_set_rate_is_ignored_if_can_control_is_false(self):
|
||||
self.mpris.get_CanControl = lambda *_: False
|
||||
self.backend.current_playlist.append([Track(uri='a'), Track(uri='b')])
|
||||
self.backend.playback.play()
|
||||
self.assertEquals(self.backend.playback.state.get(), PLAYING)
|
||||
self.mpris.Set(mpris.PLAYER_IFACE, 'Rate', 0)
|
||||
self.assertEquals(self.backend.playback.state.get(), PLAYING)
|
||||
|
||||
def test_set_rate_to_zero_pauses_playback(self):
|
||||
self.backend.current_playlist.append([Track(uri='a'), Track(uri='b')])
|
||||
self.backend.playback.play()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user