From a4d73a8d7ec72e2f91296b8a5efc4ddb0fe67984 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Mon, 20 Jun 2011 00:33:57 +0300 Subject: [PATCH] Test and implement mpris.CanControl property --- mopidy/frontends/mpris.py | 7 +++++-- tests/frontends/mpris/player_interface_test.py | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mopidy/frontends/mpris.py b/mopidy/frontends/mpris.py index b995978a..5232a385 100644 --- a/mopidy/frontends/mpris.py +++ b/mopidy/frontends/mpris.py @@ -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 diff --git a/tests/frontends/mpris/player_interface_test.py b/tests/frontends/mpris/player_interface_test.py index 7316e78a..32562fca 100644 --- a/tests/frontends/mpris/player_interface_test.py +++ b/tests/frontends/mpris/player_interface_test.py @@ -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()