Skip to content

Commit

Permalink
Add json/input_event_queue/halt_6.jsonc
Browse files Browse the repository at this point in the history
  • Loading branch information
tekezo committed Feb 25, 2024
1 parent 628ed54 commit fd184d6
Show file tree
Hide file tree
Showing 4 changed files with 291 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
[
{
"keyboard_input": {
"keys": [
{
"key_code": "tab"
}
],
"modifiers": []
},
"time_stamp": 5,
"type": "keyboard_input"
},
{
"keyboard_input": {
"keys": [
{
"key_code": "tab"
}
],
"modifiers": [
"left_shift"
]
},
"time_stamp": 10,
"type": "keyboard_input"
},
{
"keyboard_input": {
"keys": [
{
"key_code": "tab"
},
{
"key_code": "f15"
}
],
"modifiers": [
"left_shift"
]
},
"time_stamp": 15,
"type": "keyboard_input"
},
{
"keyboard_input": {
"keys": [
{
"key_code": "tab"
}
],
"modifiers": [
"left_shift"
]
},
"time_stamp": 20,
"type": "keyboard_input"
},
{
"keyboard_input": {
"keys": [],
"modifiers": [
"left_shift"
]
},
"time_stamp": 8,
"type": "keyboard_input"
},
{
"keyboard_input": {
"keys": [],
"modifiers": []
},
"time_stamp": 25,
"type": "keyboard_input"
},
{
"keyboard_input": {
"keys": [
{
"key_code": "f14"
}
],
"modifiers": []
},
"time_stamp": 30,
"type": "keyboard_input"
},
{
"keyboard_input": {
"keys": [],
"modifiers": []
},
"time_stamp": 35,
"type": "keyboard_input"
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
[
// Send events:
// - (not halt case)
// - f13 key_down
// - tab key_down
// - f13 key_up (fire to_after_key_up)
// - tab key_up
// - (halt case)
// - f13 key_down
// - f13 key_up (fire to_if_alone)
//
// Expected result:
// - (not halt case)
// - tab key_down
// - left_shift key_down
// - f15 key_down
// - f15 key_up
// - tab key_up
// - left_shift key_up
// - (halt case)
// - f14 key_down
// - f14 key_up

// f13 key_down
{
"device_id": 1,
"event": {
"momentary_switch_event": {
"key_code": "f13"
},
"type": "momentary_switch_event"
},
"event_origin": "grabbed_device",
"event_time_stamp": {
"time_stamp": 2
},
"event_type": "key_down",
"lazy": false,
"original_event": {
"momentary_switch_event": {
"key_code": "f13"
},
"type": "momentary_switch_event"
},
"validity": true
},
// tab key_down
{
"device_id": 1,
"event": {
"momentary_switch_event": {
"key_code": "tab"
},
"type": "momentary_switch_event"
},
"event_origin": "grabbed_device",
"event_time_stamp": {
"time_stamp": 4
},
"event_type": "key_down",
"lazy": false,
"original_event": {
"momentary_switch_event": {
"key_code": "tab"
},
"type": "momentary_switch_event"
},
"validity": true
},
// f13 key_up
{
"device_id": 1,
"event": {
"momentary_switch_event": {
"key_code": "f13"
},
"type": "momentary_switch_event"
},
"event_origin": "grabbed_device",
"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
},
// tab key_up
{
"device_id": 1,
"event": {
"momentary_switch_event": {
"key_code": "tab"
},
"type": "momentary_switch_event"
},
"event_origin": "grabbed_device",
"event_time_stamp": {
"time_stamp": 8
},
"event_type": "key_up",
"lazy": false,
"original_event": {
"momentary_switch_event": {
"key_code": "tab"
},
"type": "momentary_switch_event"
},
"validity": true
},

// f13 key_down
{
"device_id": 1,
"event": {
"momentary_switch_event": {
"key_code": "f13"
},
"type": "momentary_switch_event"
},
"event_origin": "grabbed_device",
"event_time_stamp": {
"time_stamp": 10
},
"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_origin": "grabbed_device",
"event_time_stamp": {
"time_stamp": 12
},
"event_type": "key_up",
"lazy": false,
"original_event": {
"momentary_switch_event": {
"key_code": "f13"
},
"type": "momentary_switch_event"
},
"validity": true
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,24 @@
"halt": true
}
]
},
{
"description": "with modifiers",
"type": "basic",
"from": {
"key_code": "f13"
},
"to_after_key_up": [
{
"key_code": "f15",
"modifiers": ["left_shift"]
}
],
"to_if_alone": [
{
"key_code": "f14",
"halt": true
}
]
}
]
16 changes: 11 additions & 5 deletions tests/src/post_event_to_virtual_devices/json/tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -745,34 +745,40 @@
},
{
"description": "halt_1 (to_if_held_down, halted)",
"rules": ["json/rules/halt.json"],
"rules": ["json/rules/halt.jsonc"],
"input_event_queue": "json/input_event_queue/halt_1.json",
"expected_post_event_to_virtual_devices_queue": "json/expected_post_event_to_virtual_devices_queue/halt_1.json"
},
{
"description": "halt_2 (to_if_held_down, not halted)",
"rules": ["json/rules/halt.json"],
"rules": ["json/rules/halt.jsonc"],
"input_event_queue": "json/input_event_queue/halt_2.json",
"expected_post_event_to_virtual_devices_queue": "json/expected_post_event_to_virtual_devices_queue/halt_2.json"
},
{
"description": "halt_3 (to_if_alone, halted)",
"rules": ["json/rules/halt.json"],
"rules": ["json/rules/halt.jsonc"],
"input_event_queue": "json/input_event_queue/halt_3.json",
"expected_post_event_to_virtual_devices_queue": "json/expected_post_event_to_virtual_devices_queue/halt_3.json"
},
{
"description": "halt_4 (to_if_alone, not halted)",
"rules": ["json/rules/halt.json"],
"rules": ["json/rules/halt.jsonc"],
"input_event_queue": "json/input_event_queue/halt_4.json",
"expected_post_event_to_virtual_devices_queue": "json/expected_post_event_to_virtual_devices_queue/halt_4.json"
},
{
"description": "halt_5 (simultaneous_options)",
"rules": ["json/rules/halt.json"],
"rules": ["json/rules/halt.jsonc"],
"input_event_queue": "json/input_event_queue/halt_5.json",
"expected_post_event_to_virtual_devices_queue": "json/expected_post_event_to_virtual_devices_queue/halt_5.json"
},
{
"description": "halt_6 (with modifiers)",
"rules": ["json/rules/halt.jsonc"],
"input_event_queue": "json/input_event_queue/halt_6.jsonc",
"expected_post_event_to_virtual_devices_queue": "json/expected_post_event_to_virtual_devices_queue/halt_6.json"
},
{
"description": "f10 to mute (fn function keys)",
"rules": ["json/rules/fn_function_keys.json"],
Expand Down

0 comments on commit fd184d6

Please sign in to comment.