summaryrefslogtreecommitdiff
path: root/tests/test_mpv.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2022-04-17 23:52:12 +0200
committerjaseg <git@jaseg.de>2022-04-17 23:52:12 +0200
commit8d448d49f1b23f556dd04b4325d7f6a006fe823d (patch)
treeccb22e487c8818e11241446e7d1dd4e8fa43729c /tests/test_mpv.py
parentd28f1353827d26e46876a787632f60716a3153fe (diff)
downloadpython-mpv-8d448d49f1b23f556dd04b4325d7f6a006fe823d.tar.gz
python-mpv-8d448d49f1b23f556dd04b4325d7f6a006fe823d.tar.bz2
python-mpv-8d448d49f1b23f556dd04b4325d7f6a006fe823d.zip
Add future-based async command API
Diffstat (limited to 'tests/test_mpv.py')
-rwxr-xr-xtests/test_mpv.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_mpv.py b/tests/test_mpv.py
index 87cd318..2c8a585 100755
--- a/tests/test_mpv.py
+++ b/tests/test_mpv.py
@@ -697,6 +697,24 @@ class CommandTests(MpvTestCase):
handler.assert_any_call('sub-text', 'This is\na subtitle test.')
handler.assert_any_call('sub-text', 'This is the second subtitle line.')
+ def test_async_command(self):
+ handler = mock.Mock()
+ callback = mock.Mock()
+ self.m.property_observer('sub-text')(handler)
+ time.sleep(0.5)
+
+ self.m.loadfile(TESTVID)
+ self.m.wait_until_playing()
+ self.m.command_async('sub_add', TESTSRT, callback=callback)
+ reply = self.m.command_async('expand-text', 'test ${mute}')
+ assert reply.result() == 'test no'
+
+ self.m.wait_for_playback()
+ handler.assert_any_call('sub-text', 'This is\na subtitle test.')
+ handler.assert_any_call('sub-text', 'This is the second subtitle line.')
+ callback.assert_any_call(None, None)
+
+
class RegressionTests(MpvTestCase):