From 8d448d49f1b23f556dd04b4325d7f6a006fe823d Mon Sep 17 00:00:00 2001 From: jaseg Date: Sun, 17 Apr 2022 23:52:12 +0200 Subject: Add future-based async command API --- tests/test_mpv.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests') 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): -- cgit