summaryrefslogtreecommitdiff
path: root/mpv-test.py
diff options
context:
space:
mode:
authorjaseg <code@jaseg.net>2020-07-18 14:21:31 +0200
committerjaseg <code@jaseg.net>2020-07-18 14:21:31 +0200
commit846f2a65ae0bc9ee1c7d58a6047a9eaf71f6e6c2 (patch)
tree745169dd210f83dcaef4b13072a4ab147eeb9330 /mpv-test.py
parentad68ec5927e83eb6316c5ae6943bde1157f0f540 (diff)
downloadpython-mpv-846f2a65ae0bc9ee1c7d58a6047a9eaf71f6e6c2.tar.gz
python-mpv-846f2a65ae0bc9ee1c7d58a6047a9eaf71f6e6c2.tar.bz2
python-mpv-846f2a65ae0bc9ee1c7d58a6047a9eaf71f6e6c2.zip
Sprinkle some thread safety over event loop, add *wait_for_event
Diffstat (limited to 'mpv-test.py')
-rwxr-xr-xmpv-test.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/mpv-test.py b/mpv-test.py
index ecc4d18..5a74eb7 100755
--- a/mpv-test.py
+++ b/mpv-test.py
@@ -395,33 +395,32 @@ class KeyBindingTest(MpvTestCase):
self.assertEqual(reg_test_fun.mpv_key_bindings, ['b', 'a'])
def keypress_and_sync(key):
- self.m.keypress(key)
- self.m.frame_step()
- self.m.wait_until_playing()
+ with self.m.prepare_and_wait_for_event('client_message'):
+ self.m.keypress(key)
keypress_and_sync('a')
handler1.assert_has_calls([ mock.call() ])
handler2.assert_has_calls([])
handler1.reset_mock()
- keypress_and_sync('x')
- keypress_and_sync('X')
+ self.m.keypress('x')
+ self.m.keypress('X')
keypress_and_sync('b')
handler1.assert_has_calls([ mock.call() ])
handler2.assert_has_calls([])
handler1.reset_mock()
keypress_and_sync('c')
- keypress_and_sync('B')
+ self.m.keypress('B')
handler1.assert_has_calls([])
handler2.assert_has_calls([ mock.call() ])
handler2.reset_mock()
reg_test_fun.unregister_mpv_key_bindings()
- keypress_and_sync('a')
+ self.m.keypress('a')
keypress_and_sync('c')
- keypress_and_sync('x')
- keypress_and_sync('A')
+ self.m.keypress('x')
+ self.m.keypress('A')
handler1.assert_has_calls([])
handler2.assert_has_calls([ mock.call() ])