|
@@ -149,9 +149,10 @@ class TestMpdClient(unittest.TestCase):
|
|
|
|
|
|
|
|
def test_commands(self):
|
|
def test_commands(self):
|
|
|
for cmd in (mpd.NEXT, mpd.VOLUME_UP, mpd.VOLUME_DOWN, mpd.TOGGLE, mpd.PREV,
|
|
for cmd in (mpd.NEXT, mpd.VOLUME_UP, mpd.VOLUME_DOWN, mpd.TOGGLE, mpd.PREV,
|
|
|
- mpd.STOP, mpd.PLAY, mpd.REFRESH):
|
|
|
|
|
|
|
+ mpd.STOP, mpd.PLAY, mpd.REFRESH, mpd.SEEK_BACK, mpd.SEEK_FORWARD):
|
|
|
self.client.command(cmd)
|
|
self.client.command(cmd)
|
|
|
- expected = ["next", "volume +1", "volume -1", "pause", "previous", "stop", "play"]
|
|
|
|
|
|
|
+ expected = ["next", "volume +1", "volume -1", "pause", "previous", "stop", "play",
|
|
|
|
|
+ "seekcur -10", "seekcur +10"]
|
|
|
|
|
|
|
|
def sent():
|
|
def sent():
|
|
|
return [c for c in self.server.commands()
|
|
return [c for c in self.server.commands()
|
|
@@ -244,6 +245,29 @@ class TestPanel(unittest.TestCase):
|
|
|
app.close()
|
|
app.close()
|
|
|
self.assertEqual(sent, [mpd.NEXT])
|
|
self.assertEqual(sent, [mpd.NEXT])
|
|
|
|
|
|
|
|
|
|
+ def test_seek_keys(self):
|
|
|
|
|
+ sent = []
|
|
|
|
|
+ app = App("127.0.0.1", free_port(), 240, 160, lambda *a: None)
|
|
|
|
|
+ app.mpd.command = sent.append
|
|
|
|
|
+ s = app.state
|
|
|
|
|
+
|
|
|
|
|
+ def press(name):
|
|
|
|
|
+ app.key_time_ms.clear() # not the lockout under test
|
|
|
|
|
+ app.key(name)
|
|
|
|
|
+ try:
|
|
|
|
|
+ press("left") # nothing playing
|
|
|
|
|
+ s.state, s.total_ms, s.elapsed_ms = st.PLAY_PAUSED, 0, 5000
|
|
|
|
|
+ press("right") # a stream: no length
|
|
|
|
|
+ s.total_ms = 60000
|
|
|
|
|
+ press("left")
|
|
|
|
|
+ press("right")
|
|
|
|
|
+ s.elapsed_ms = 51000
|
|
|
|
|
+ press("right") # past the end
|
|
|
|
|
+ press("left")
|
|
|
|
|
+ finally:
|
|
|
|
|
+ app.close()
|
|
|
|
|
+ self.assertEqual(sent, [mpd.SEEK_BACK, mpd.SEEK_FORWARD, mpd.SEEK_BACK])
|
|
|
|
|
+
|
|
|
def test_patterns(self):
|
|
def test_patterns(self):
|
|
|
for name in ("geometry", "gray"):
|
|
for name in ("geometry", "gray"):
|
|
|
fb = make_pattern(name, 240, 160)
|
|
fb = make_pattern(name, 240, 160)
|