diff options
author | jaseg <code@jaseg.net> | 2019-11-26 12:24:16 +0100 |
---|---|---|
committer | jaseg <code@jaseg.net> | 2019-11-26 12:26:37 +0100 |
commit | 35e69cd93e2f1c265157400d7aa2b5e64f962b23 (patch) | |
tree | 34daf0cae61a5c08104c9df697464ad084f33f46 /mpv-test.py | |
parent | 9d6d973f91e993fb5fcdd60d279a865e77697f8f (diff) | |
download | python-mpv-35e69cd93e2f1c265157400d7aa2b5e64f962b23.tar.gz python-mpv-35e69cd93e2f1c265157400d7aa2b5e64f962b23.tar.bz2 python-mpv-35e69cd93e2f1c265157400d7aa2b5e64f962b23.zip |
key bindings: Introduce key char parameter
Adapt key binding script message handling to be compatible with the new
key char parameter introduced upstream in
https://github.com/mpv-player/mpv/commit/21f2468d67e11eff7ede0d85fa6f4ab5c4f7de84
This change is backwards-compatible. With older mpv versions this
parameter will be None.
Diffstat (limited to 'mpv-test.py')
-rwxr-xr-x | mpv-test.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/mpv-test.py b/mpv-test.py index 4b05a4d..9e83dbb 100755 --- a/mpv-test.py +++ b/mpv-test.py @@ -190,7 +190,7 @@ class ObservePropertyTest(MpvTestCase): time.sleep(0.1) #couple frames m.terminate() # needed for synchronization of event thread - handler.assert_has_calls([mock.call('vid', 'auto'), mock.call('vid', 1)]) + handler.assert_has_calls([mock.call('vid', 'auto')]) def test_property_observer_decorator(self): handler = mock.Mock() @@ -253,7 +253,7 @@ class KeyBindingTest(MpvTestCase): def test_register_direct_fun(self): b = mpv.MPV._binding_name - def reg_test_fun(state, name): + def reg_test_fun(state, name, char): pass self.m.register_key_binding('a', reg_test_fun) @@ -267,7 +267,7 @@ class KeyBindingTest(MpvTestCase): b = mpv.MPV._binding_name class RegTestCls: - def method(self, state, name): + def method(self, state, name, char): pass instance = RegTestCls() @@ -282,7 +282,7 @@ class KeyBindingTest(MpvTestCase): b = mpv.MPV._binding_name @self.m.key_binding('a') - def reg_test_fun(state, name): + def reg_test_fun(state, name, char): pass self.assertEqual(reg_test_fun.mpv_key_bindings, ['a']) self.assertIn(b('a'), self.m._key_binding_handlers) @@ -296,11 +296,11 @@ class KeyBindingTest(MpvTestCase): @self.m.key_binding('a') @self.m.key_binding('b') - def reg_test_fun(state, name): + def reg_test_fun(state, name, char): pass @self.m.key_binding('c') - def reg_test_fun_2_stay_intact(state, name): + def reg_test_fun_2_stay_intact(state, name, char): pass self.assertEqual(reg_test_fun.mpv_key_bindings, ['b', 'a']) @@ -334,14 +334,14 @@ class KeyBindingTest(MpvTestCase): self.assertIn(b('b'), self.m._key_binding_handlers) self.assertIn(b('c'), self.m._key_binding_handlers) - self.m._key_binding_handlers[b('a')]('p-', 'q') + self.m._key_binding_handlers[b('a')]('p-', 'q', None) handler1.assert_has_calls([ mock.call() ]) handler2.assert_has_calls([]) handler1.reset_mock() - self.m._key_binding_handlers[b('b')]('p-', 'q') + self.m._key_binding_handlers[b('b')]('p-', 'q', None) handler1.assert_has_calls([ mock.call() ]) handler2.assert_has_calls([]) - self.m._key_binding_handlers[b('c')]('p-', 'q') + self.m._key_binding_handlers[b('c')]('p-', 'q', None) handler1.assert_has_calls([]) handler2.assert_has_calls([ mock.call() ]) |