Fix stuff, apply ruff rules.
This commit is contained in:
@@ -348,6 +348,29 @@ class TestInputEventManager:
|
||||
if case["expects_debug_call"]:
|
||||
essential_modules["cthulhu.debug"].print_tokens.assert_called()
|
||||
|
||||
def test_add_grabs_for_keybinding_allows_default_cthulhu_modifiers(
|
||||
self,
|
||||
test_context: CthulhuTestContext,
|
||||
) -> None:
|
||||
"""Plugin bindings can be grabbed before a script supplies modifier keys."""
|
||||
|
||||
input_event_manager, _essential_modules = self._setup_input_event_manager(test_context)
|
||||
|
||||
mock_device = test_context.Mock()
|
||||
mock_device.add_key_grab.return_value = 123
|
||||
input_event_manager._device = mock_device
|
||||
|
||||
mock_kd = test_context.Mock()
|
||||
mock_binding = test_context.Mock()
|
||||
mock_binding.has_grabs.return_value = False
|
||||
mock_binding.key_definitions.return_value = [mock_kd]
|
||||
|
||||
result = input_event_manager.add_grabs_for_keybinding(mock_binding)
|
||||
|
||||
assert result == [123]
|
||||
mock_binding.key_definitions.assert_called_once_with(None)
|
||||
mock_device.add_key_grab.assert_called_once_with(mock_kd, None)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"case",
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user