Skip to content

Commit

Permalink
Add to_delayed_action_5.jsonc test
Browse files Browse the repository at this point in the history
  • Loading branch information
tekezo committed Jan 26, 2025
1 parent be353a4 commit f1af5ce
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[
{
"keyboard_input": {
"keys": [],
"modifiers": [
"left_shift"
]
},
"time_stamp": 5,
"type": "keyboard_input"
},
{
"keyboard_input": {
"keys": [],
"modifiers": []
},
"time_stamp": 10,
"type": "keyboard_input"
},
{
"keyboard_input": {
"keys": [
{
"key_code": "a"
}
],
"modifiers": []
},
"time_stamp": 15,
"type": "keyboard_input"
},
{
"keyboard_input": {
"keys": [],
"modifiers": []
},
"time_stamp": 20,
"type": "keyboard_input"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
[
// left_shift key_down
{
"device_id": 1,
"event": {
"momentary_switch_event": {
"key_code": "left_shift"
},
"type": "momentary_switch_event"
},
"event_time_stamp": {
"time_stamp": 2
},
"event_type": "key_down",
"lazy": false,
"original_event": {
"momentary_switch_event": {
"key_code": "left_shift"
},
"type": "momentary_switch_event"
},
"validity": true
},
// f13 key_down
{
"device_id": 1,
"event": {
"momentary_switch_event": {
"key_code": "f13"
},
"type": "momentary_switch_event"
},
"event_time_stamp": {
"time_stamp": 4
},
"event_type": "key_down",
"lazy": false,
"original_event": {
"momentary_switch_event": {
"key_code": "f13"
},
"type": "momentary_switch_event"
},
"validity": true
},
// f13 key_up
{
"device_id": 1,
"event": {
"momentary_switch_event": {
"key_code": "f13"
},
"type": "momentary_switch_event"
},
"event_time_stamp": {
"time_stamp": 6
},
"event_type": "key_up",
"lazy": false,
"original_event": {
"momentary_switch_event": {
"key_code": "f13"
},
"type": "momentary_switch_event"
},
"validity": true
},
// left_shift key_up
{
"device_id": 1,
"event": {
"momentary_switch_event": {
"key_code": "left_shift"
},
"type": "momentary_switch_event"
},
"event_time_stamp": {
"time_stamp": 8
},
"event_type": "key_up",
"lazy": false,
"original_event": {
"momentary_switch_event": {
"key_code": "left_shift"
},
"type": "momentary_switch_event"
},
"validity": true
},
// left_shift+a should be sent by to_if_invoked
{
"action": "invoke_dispatcher",
"time_stamp": 2000
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,30 @@
}
]
}
},
{
// from.mandatory == to_delayed_action.to_if_invoked.modifiers == "shift"
"type": "basic",
"from": {
"key_code": "f13",
"modifiers": {
"mandatory": ["shift"],
"optional": ["any"]
}
},
"to_delayed_action": {
"to_if_invoked": [
{
"key_code": "a",
"modifiers": ["left_shift"]
}
],
"to_if_canceled": [
{
"key_code": "b",
"modifiers": ["left_shift"]
}
]
}
}
]
14 changes: 10 additions & 4 deletions tests/src/post_event_to_virtual_devices/json/tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -403,28 +403,34 @@
},
{
"description": "to_delayed_action (no invoke, no cancel)",
"rules": ["json/rules/to_delayed_action.json"],
"rules": ["json/rules/to_delayed_action.jsonc"],
"input_event_queue": "json/input_event_queue/to_delayed_action_1.json",
"expected_post_event_to_virtual_devices_queue": "json/expected_post_event_to_virtual_devices_queue/to_delayed_action_1.json"
},
{
"description": "to_delayed_action (invoke)",
"rules": ["json/rules/to_delayed_action.json"],
"rules": ["json/rules/to_delayed_action.jsonc"],
"input_event_queue": "json/input_event_queue/to_delayed_action_2.json",
"expected_post_event_to_virtual_devices_queue": "json/expected_post_event_to_virtual_devices_queue/to_delayed_action_2.json"
},
{
"description": "to_delayed_action (cancel)",
"rules": ["json/rules/to_delayed_action.json"],
"rules": ["json/rules/to_delayed_action.jsonc"],
"input_event_queue": "json/input_event_queue/to_delayed_action_3.json",
"expected_post_event_to_virtual_devices_queue": "json/expected_post_event_to_virtual_devices_queue/to_delayed_action_3.json"
},
{
"description": "to_delayed_action (cancel by ignored device)",
"rules": ["json/rules/to_delayed_action.json"],
"rules": ["json/rules/to_delayed_action.jsonc"],
"input_event_queue": "json/input_event_queue/to_delayed_action_4.json",
"expected_post_event_to_virtual_devices_queue": "json/expected_post_event_to_virtual_devices_queue/to_delayed_action_4.json"
},
{
"description": "to_delayed_action (from.mandatory == to_delayed_action.to_if_invoked.modifiers == shift)",
"rules": ["json/rules/to_delayed_action.jsonc"],
"input_event_queue": "json/input_event_queue/to_delayed_action_5.jsonc",
"expected_post_event_to_virtual_devices_queue": "json/expected_post_event_to_virtual_devices_queue/to_delayed_action_5.json"
},
{
"description": "to_delayed_action cx",
"rules": ["json/rules/to_delayed_action_cx.json"],
Expand Down

0 comments on commit f1af5ce

Please sign in to comment.