From 67f22a6c9092f81ad574b6d31f3a69abe6d62b2f Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Wed, 5 Apr 2017 13:41:17 +0200 Subject: [PATCH] Fix key count in input test --- repos/dde_linux/run/usb_hid.run | 8 ++++---- repos/os/src/test/input/test.cc | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/repos/dde_linux/run/usb_hid.run b/repos/dde_linux/run/usb_hid.run index 5d3fce9cae..1d3db4a068 100644 --- a/repos/dde_linux/run/usb_hid.run +++ b/repos/dde_linux/run/usb_hid.run @@ -166,11 +166,11 @@ trim_lines compare_output_to { [init -> test-input] Input event #1 type=PRESS code=45 rx=0 ry=0 ax=0 ay=0 key_cnt=1 KEY_X -[init -> test-input] Input event #2 type=RELEASE code=45 rx=0 ry=0 ax=0 ay=0 key_cnt=-1 KEY_X +[init -> test-input] Input event #2 type=RELEASE code=45 rx=0 ry=0 ax=0 ay=0 key_cnt=0 KEY_X [init -> test-input] Input event #3 type=PRESS code=272 rx=0 ry=0 ax=0 ay=0 key_cnt=1 BTN_LEFT [init -> test-input] Input event #4 type=MOTION code=0 rx=-1 ry=0 ax=0 ay=0 key_cnt=1 [init -> test-input] Input event #5 type=MOTION code=0 rx=0 ry=1 ax=0 ay=0 key_cnt=1 -[init -> test-input] Input event #6 type=RELEASE code=272 rx=0 ry=0 ax=0 ay=0 key_cnt=-1 BTN_LEFT +[init -> test-input] Input event #6 type=RELEASE code=272 rx=0 ry=0 ax=0 ay=0 key_cnt=0 BTN_LEFT [init -> usb_drv] dev_info: USB disconnect, device [init -> usb_drv] dev_info: new full-speed USB device [init -> usb_drv] dev_info: D L @@ -178,9 +178,9 @@ compare_output_to { [init -> usb_drv] dev_info: D L [init -> usb_drv] dev_info: input: USB HID v1.11 Mouse [D L] [init -> test-input] Input event #7 type=PRESS code=45 rx=0 ry=0 ax=0 ay=0 key_cnt=1 KEY_X -[init -> test-input] Input event #8 type=RELEASE code=45 rx=0 ry=0 ax=0 ay=0 key_cnt=-1 KEY_X +[init -> test-input] Input event #8 type=RELEASE code=45 rx=0 ry=0 ax=0 ay=0 key_cnt=0 KEY_X [init -> test-input] Input event #9 type=PRESS code=272 rx=0 ry=0 ax=0 ay=0 key_cnt=1 BTN_LEFT [init -> test-input] Input event #10 type=MOTION code=0 rx=-1 ry=0 ax=0 ay=0 key_cnt=1 [init -> test-input] Input event #11 type=MOTION code=0 rx=0 ry=1 ax=0 ay=0 key_cnt=1 -[init -> test-input] Input event #12 type=RELEASE code=272 rx=0 ry=0 ax=0 ay=0 key_cnt=-1 BTN_LEFT +[init -> test-input] Input event #12 type=RELEASE code=272 rx=0 ry=0 ax=0 ay=0 key_cnt=0 BTN_LEFT } diff --git a/repos/os/src/test/input/test.cc b/repos/os/src/test/input/test.cc index 9c3f18f6db..d4c0ae6eb0 100644 --- a/repos/os/src/test/input/test.cc +++ b/repos/os/src/test/input/test.cc @@ -51,6 +51,7 @@ struct Main Env &env; Input::Connection input { env }; Signal_handler
input_sigh { env.ep(), *this, &Main::handle_input }; + int key_cnt { 0 }; unsigned event_cnt { 0 }; void handle_input(); @@ -65,7 +66,6 @@ struct Main void Main::handle_input() { - int key_cnt = 0; input.for_each_event([&] (Input::Event const &ev) { event_cnt++;