Log key count in input test
This commit is contained in:
parent
a036d2373a
commit
1e578f1a50
|
@ -227,22 +227,22 @@ filter_out_color_escape_sequences
|
||||||
trim_lines
|
trim_lines
|
||||||
|
|
||||||
compare_output_to {
|
compare_output_to {
|
||||||
[init -> test-input] Input event #0 PRESS KEY_X 65534
|
[init -> test-input] Input event #0 PRESS KEY_X 65534 key count: 1
|
||||||
[init -> test-input] Input event #1 RELEASE KEY_X
|
[init -> test-input] Input event #1 RELEASE KEY_X key count: 0
|
||||||
[init -> test-input] Input event #2 PRESS BTN_LEFT 65534
|
[init -> test-input] Input event #2 PRESS BTN_LEFT 65534 key count: 1
|
||||||
[init -> test-input] Input event #3 REL_MOTION -1+0
|
[init -> test-input] Input event #3 REL_MOTION -1+0 key count: 1
|
||||||
[init -> test-input] Input event #4 REL_MOTION +0+1
|
[init -> test-input] Input event #4 REL_MOTION +0+1 key count: 1
|
||||||
[init -> test-input] Input event #5 RELEASE BTN_LEFT
|
[init -> test-input] Input event #5 RELEASE BTN_LEFT key count: 0
|
||||||
[init -> usb_drv] dev_info: USB disconnect, device
|
[init -> usb_drv] dev_info: USB disconnect, device
|
||||||
[init -> usb_drv] dev_info: new full-speed USB device
|
[init -> usb_drv] dev_info: new full-speed USB device
|
||||||
[init -> usb_drv] dev_info: D L
|
[init -> usb_drv] dev_info: D L
|
||||||
[init -> usb_drv] dev_info: input: USB HID v1.11 Keyboard [D L]
|
[init -> usb_drv] dev_info: input: USB HID v1.11 Keyboard [D L]
|
||||||
[init -> usb_drv] dev_info: D L
|
[init -> usb_drv] dev_info: D L
|
||||||
[init -> usb_drv] dev_info: input: USB HID v1.11 Mouse [D L]
|
[init -> usb_drv] dev_info: input: USB HID v1.11 Mouse [D L]
|
||||||
[init -> test-input] Input event #6 PRESS KEY_X 65534
|
[init -> test-input] Input event #6 PRESS KEY_X 65534 key count: 1
|
||||||
[init -> test-input] Input event #7 RELEASE KEY_X
|
[init -> test-input] Input event #7 RELEASE KEY_X key count: 0
|
||||||
[init -> test-input] Input event #8 PRESS BTN_LEFT 65534
|
[init -> test-input] Input event #8 PRESS BTN_LEFT 65534 key count: 1
|
||||||
[init -> test-input] Input event #9 REL_MOTION -1+0
|
[init -> test-input] Input event #9 REL_MOTION -1+0 key count: 1
|
||||||
[init -> test-input] Input event #10 REL_MOTION +0+1
|
[init -> test-input] Input event #10 REL_MOTION +0+1 key count: 1
|
||||||
[init -> test-input] Input event #11 RELEASE BTN_LEFT
|
[init -> test-input] Input event #11 RELEASE BTN_LEFT key count: 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -236,20 +236,20 @@ filter_out_color_escape_sequences
|
||||||
trim_lines
|
trim_lines
|
||||||
|
|
||||||
compare_output_to {
|
compare_output_to {
|
||||||
[init -> test-input] Input event #0 PRESS KEY_X 65534
|
[init -> test-input] Input event #0 PRESS KEY_X 65534 key count: 1
|
||||||
[init -> test-input] Input event #1 RELEASE KEY_X
|
[init -> test-input] Input event #1 RELEASE KEY_X key count: 0
|
||||||
[init -> test-input] Input event #2 PRESS BTN_LEFT 65534
|
[init -> test-input] Input event #2 PRESS BTN_LEFT 65534 key count: 1
|
||||||
[init -> test-input] Input event #3 REL_MOTION -1+0
|
[init -> test-input] Input event #3 REL_MOTION -1+0 key count: 1
|
||||||
[init -> test-input] Input event #4 REL_MOTION +0+1
|
[init -> test-input] Input event #4 REL_MOTION +0+1 key count: 1
|
||||||
[init -> test-input] Input event #5 RELEASE BTN_LEFT
|
[init -> test-input] Input event #5 RELEASE BTN_LEFT key count: 0
|
||||||
[init -> usb_drv] dev_info: USB disconnect, device
|
[init -> usb_drv] dev_info: USB disconnect, device
|
||||||
[init -> usb_drv] dev_info: new full-speed USB device
|
[init -> usb_drv] dev_info: new full-speed USB device
|
||||||
[init -> usb_hid_drv] dev_info: input: USB HID v1.11 Keyboard [HID 03eb:204d]
|
[init -> usb_hid_drv] dev_info: input: USB HID v1.11 Keyboard [HID 03eb:204d]
|
||||||
[init -> usb_hid_drv] dev_info: input: USB HID v1.11 Mouse [HID 03eb:204d]
|
[init -> usb_hid_drv] dev_info: input: USB HID v1.11 Mouse [HID 03eb:204d]
|
||||||
[init -> test-input] Input event #6 PRESS KEY_X 65534
|
[init -> test-input] Input event #6 PRESS KEY_X 65534 key count: 1
|
||||||
[init -> test-input] Input event #7 RELEASE KEY_X
|
[init -> test-input] Input event #7 RELEASE KEY_X key count: 0
|
||||||
[init -> test-input] Input event #8 PRESS BTN_LEFT 65534
|
[init -> test-input] Input event #8 PRESS BTN_LEFT 65534 key count: 1
|
||||||
[init -> test-input] Input event #9 REL_MOTION -1+0
|
[init -> test-input] Input event #9 REL_MOTION -1+0 key count: 1
|
||||||
[init -> test-input] Input event #10 REL_MOTION +0+1
|
[init -> test-input] Input event #10 REL_MOTION +0+1 key count: 1
|
||||||
[init -> test-input] Input event #11 RELEASE BTN_LEFT
|
[init -> test-input] Input event #11 RELEASE BTN_LEFT key count: 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,11 +25,15 @@ struct Main
|
||||||
Input::Connection _input { _env };
|
Input::Connection _input { _env };
|
||||||
Signal_handler<Main> _input_sigh { _env.ep(), *this, &Main::_handle_input };
|
Signal_handler<Main> _input_sigh { _env.ep(), *this, &Main::_handle_input };
|
||||||
unsigned _event_cnt { 0 };
|
unsigned _event_cnt { 0 };
|
||||||
|
int _key_cnt { 0 };
|
||||||
|
|
||||||
void _handle_input()
|
void _handle_input()
|
||||||
{
|
{
|
||||||
_input.for_each_event([&] (Input::Event const &ev) {
|
_input.for_each_event([&] (Input::Event const &ev) {
|
||||||
log("Input event #", _event_cnt++, "\t", ev); });
|
if (ev.press()) ++_key_cnt;
|
||||||
|
if (ev.release()) --_key_cnt;
|
||||||
|
log("Input event #", _event_cnt++, "\t", ev, "\tkey count: ", _key_cnt);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Main(Env &env) : _env(env)
|
Main(Env &env) : _env(env)
|
||||||
|
|
|
@ -288,12 +288,12 @@ filter_out_color_escape_sequences
|
||||||
trim_lines
|
trim_lines
|
||||||
|
|
||||||
compare_output_to {
|
compare_output_to {
|
||||||
[init -> log_terminal] [init -> test-input] Input event #0 PRESS KEY_X 65534
|
[init -> log_terminal] [init -> test-input] Input event #0 PRESS KEY_X 65534 key count: 1
|
||||||
[init -> log_terminal] [init -> test-input] Input event #1 RELEASE KEY_X
|
[init -> log_terminal] [init -> test-input] Input event #1 RELEASE KEY_X key count: 0
|
||||||
[init -> log_terminal] [init -> test-input] Input event #2 PRESS BTN_LEFT 65534
|
[init -> log_terminal] [init -> test-input] Input event #2 PRESS BTN_LEFT 65534 key count: 1
|
||||||
[init -> log_terminal] [init -> test-input] Input event #3 REL_MOTION -1+0
|
[init -> log_terminal] [init -> test-input] Input event #3 REL_MOTION -1+0 key count: 1
|
||||||
[init -> log_terminal] [init -> test-input] Input event #4 REL_MOTION +0+1
|
[init -> log_terminal] [init -> test-input] Input event #4 REL_MOTION +0+1 key count: 1
|
||||||
[init -> log_terminal] [init -> test-input] Input event #5 RELEASE BTN_LEFT
|
[init -> log_terminal] [init -> test-input] Input event #5 RELEASE BTN_LEFT key count: 0
|
||||||
[init -> usb_drv] dev_info: USB disconnect, device
|
[init -> usb_drv] dev_info: USB disconnect, device
|
||||||
[init -> log_terminal] [init -> usb_drv] dev_info: USB disconnect, device
|
[init -> log_terminal] [init -> usb_drv] dev_info: USB disconnect, device
|
||||||
[init -> usb_drv] dev_info: new full-speed USB device
|
[init -> usb_drv] dev_info: new full-speed USB device
|
||||||
|
@ -303,10 +303,10 @@ compare_output_to {
|
||||||
[init -> log_terminal] [init -> usb_drv] dev_info: input: USB HID v1.11 Keyboard [D L]
|
[init -> log_terminal] [init -> usb_drv] dev_info: input: USB HID v1.11 Keyboard [D L]
|
||||||
[init -> log_terminal] [init -> usb_drv] dev_info: D L
|
[init -> log_terminal] [init -> usb_drv] dev_info: D L
|
||||||
[init -> log_terminal] [init -> usb_drv] dev_info: input: USB HID v1.11 Mouse [D L]
|
[init -> log_terminal] [init -> usb_drv] dev_info: input: USB HID v1.11 Mouse [D L]
|
||||||
[init -> log_terminal] [init -> test-input] Input event #6 PRESS KEY_X 65534
|
[init -> log_terminal] [init -> test-input] Input event #6 PRESS KEY_X 65534 key count: 1
|
||||||
[init -> log_terminal] [init -> test-input] Input event #7 RELEASE KEY_X
|
[init -> log_terminal] [init -> test-input] Input event #7 RELEASE KEY_X key count: 0
|
||||||
[init -> log_terminal] [init -> test-input] Input event #8 PRESS BTN_LEFT 65534
|
[init -> log_terminal] [init -> test-input] Input event #8 PRESS BTN_LEFT 65534 key count: 1
|
||||||
[init -> log_terminal] [init -> test-input] Input event #9 REL_MOTION -1+0
|
[init -> log_terminal] [init -> test-input] Input event #9 REL_MOTION -1+0 key count: 1
|
||||||
[init -> log_terminal] [init -> test-input] Input event #10 REL_MOTION +0+1
|
[init -> log_terminal] [init -> test-input] Input event #10 REL_MOTION +0+1 key count: 1
|
||||||
[init -> log_terminal] [init -> test-input] Input event #11 RELEASE BTN_LEFT
|
[init -> log_terminal] [init -> test-input] Input event #11 RELEASE BTN_LEFT key count: 0
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue