diff options
Diffstat (limited to 'test/litest.c')
-rw-r--r-- | test/litest.c | 132 |
1 files changed, 98 insertions, 34 deletions
diff --git a/test/litest.c b/test/litest.c index 0835ddfd..9e236456 100644 --- a/test/litest.c +++ b/test/litest.c @@ -358,6 +358,8 @@ extern struct litest_test_device litest_logitech_trackball_device; extern struct litest_test_device litest_atmel_hover_device; extern struct litest_test_device litest_alps_dualpoint_device; extern struct litest_test_device litest_mouse_low_dpi_device; +extern struct litest_test_device litest_generic_multitouch_screen_device; +extern struct litest_test_device litest_nexus4_device; extern struct litest_test_device litest_waltop_tablet_device; struct litest_test_device* devices[] = { @@ -390,6 +392,8 @@ struct litest_test_device* devices[] = { &litest_atmel_hover_device, &litest_alps_dualpoint_device, &litest_mouse_low_dpi_device, + &litest_generic_multitouch_screen_device, + &litest_nexus4_device, &litest_waltop_tablet_device, NULL, }; @@ -1218,10 +1222,26 @@ litest_event(struct litest_device *d, unsigned int type, litest_assert_int_eq(ret, 0); } +static int32_t +axis_replacement_value(struct axis_replacement *axes, + int32_t evcode) +{ + struct axis_replacement *axis = axes; + + while (axis->evcode != -1) { + if (axis->evcode == evcode) + return axis->value; + axis++; + } + + return -1; +} + int litest_auto_assign_value(struct litest_device *d, const struct input_event *ev, int slot, double x, double y, + struct axis_replacement *axes, bool touching) { static int tracking_id; @@ -1248,6 +1268,10 @@ litest_auto_assign_value(struct litest_device *d, case ABS_MT_DISTANCE: value = touching ? 0 : 1; break; + default: + if (axes) + value = axis_replacement_value(axes, ev->code); + break; } return value; @@ -1265,8 +1289,12 @@ send_btntool(struct litest_device *d) } static void -litest_slot_start(struct litest_device *d, unsigned int slot, - double x, double y, bool touching) +litest_slot_start(struct litest_device *d, + unsigned int slot, + double x, + double y, + struct axis_replacement *axes, + bool touching) { struct input_event *ev; @@ -1287,6 +1315,7 @@ litest_slot_start(struct litest_device *d, unsigned int slot, slot, x, y, + axes, touching); litest_event(d, ev->type, ev->code, value); @@ -1295,10 +1324,22 @@ litest_slot_start(struct litest_device *d, unsigned int slot, } void -litest_touch_down(struct litest_device *d, unsigned int slot, - double x, double y) +litest_touch_down(struct litest_device *d, + unsigned int slot, + double x, + double y) { - litest_slot_start(d, slot, x, y, 1); + litest_slot_start(d, slot, x, y, NULL, true); +} + +void +litest_touch_down_extended(struct litest_device *d, + unsigned int slot, + double x, + double y, + struct axis_replacement *axes) +{ + litest_slot_start(d, slot, x, y, axes, true); } void @@ -1331,6 +1372,7 @@ litest_touch_up(struct litest_device *d, unsigned int slot) slot, 0, 0, + NULL, false); litest_event(d, ev->type, ev->code, value); ev++; @@ -1338,8 +1380,12 @@ litest_touch_up(struct litest_device *d, unsigned int slot) } static void -litest_slot_move(struct litest_device *d, unsigned int slot, - double x, double y, bool touching) +litest_slot_move(struct litest_device *d, + unsigned int slot, + double x, + double y, + struct axis_replacement *axes, + bool touching) { struct input_event *ev; @@ -1355,6 +1401,7 @@ litest_slot_move(struct litest_device *d, unsigned int slot, slot, x, y, + axes, touching); litest_event(d, ev->type, ev->code, value); ev++; @@ -1362,10 +1409,22 @@ litest_slot_move(struct litest_device *d, unsigned int slot, } void -litest_touch_move(struct litest_device *d, unsigned int slot, - double x, double y) +litest_touch_move(struct litest_device *d, + unsigned int slot, + double x, + double y) +{ + litest_slot_move(d, slot, x, y, NULL, true); +} + +void +litest_touch_move_extended(struct litest_device *d, + unsigned int slot, + double x, + double y, + struct axis_replacement *axes) { - litest_slot_move(d, slot, x, y, true); + litest_slot_move(d, slot, x, y, axes, true); } void @@ -1388,21 +1447,6 @@ litest_touch_move_to(struct litest_device *d, litest_touch_move(d, slot, x_to, y_to); } -static int32_t -axis_replacement_value(struct axis_replacement *axes, - int32_t evcode) -{ - struct axis_replacement *axis = axes; - - while (axis->evcode != -1) { - if (axis->evcode == evcode) - return axis->value; - axis++; - } - - return -1; -} - static int auto_assign_tablet_value(struct litest_device *d, const struct input_event *ev, @@ -1500,10 +1544,12 @@ litest_touch_move_two_touches(struct litest_device *d, } void -litest_hover_start(struct litest_device *d, unsigned int slot, - double x, double y) +litest_hover_start(struct litest_device *d, + unsigned int slot, + double x, + double y) { - litest_slot_start(d, slot, x, y, 0); + litest_slot_start(d, slot, x, y, NULL, 0); } void @@ -1532,7 +1578,7 @@ litest_hover_end(struct litest_device *d, unsigned int slot) ev = up; while (ev && (int16_t)ev->type != -1 && (int16_t)ev->code != -1) { - int value = litest_auto_assign_value(d, ev, slot, 0, 0, 0); + int value = litest_auto_assign_value(d, ev, slot, 0, 0, NULL, false); litest_event(d, ev->type, ev->code, value); ev++; } @@ -1542,7 +1588,7 @@ void litest_hover_move(struct litest_device *d, unsigned int slot, double x, double y) { - litest_slot_move(d, slot, x, y, false); + litest_slot_move(d, slot, x, y, NULL, false); } void @@ -1754,6 +1800,24 @@ litest_event_type_str(struct libinput_event *event) case LIBINPUT_EVENT_TOUCH_FRAME: str = "TOUCH FRAME"; break; + case LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN: + str = "GESTURE SWIPE START"; + break; + case LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE: + str = "GESTURE SWIPE UPDATE"; + break; + case LIBINPUT_EVENT_GESTURE_SWIPE_END: + str = "GESTURE SWIPE END"; + break; + case LIBINPUT_EVENT_GESTURE_PINCH_BEGIN: + str = "GESTURE PINCH START"; + break; + case LIBINPUT_EVENT_GESTURE_PINCH_UPDATE: + str = "GESTURE PINCH UPDATE"; + break; + case LIBINPUT_EVENT_GESTURE_PINCH_END: + str = "GESTURE PINCH END"; + break; case LIBINPUT_EVENT_TABLET_AXIS: str = "TABLET AXIS"; break; @@ -2314,11 +2378,11 @@ send_abs_xy(struct litest_device *d, double x, double y) e.type = EV_ABS; e.code = ABS_X; e.value = LITEST_AUTO_ASSIGN; - val = litest_auto_assign_value(d, &e, 0, x, y, true); + val = litest_auto_assign_value(d, &e, 0, x, y, NULL, true); litest_event(d, EV_ABS, ABS_X, val); e.code = ABS_Y; - val = litest_auto_assign_value(d, &e, 0, x, y, true); + val = litest_auto_assign_value(d, &e, 0, x, y, NULL, true); litest_event(d, EV_ABS, ABS_Y, val); } @@ -2331,12 +2395,12 @@ send_abs_mt_xy(struct litest_device *d, double x, double y) e.type = EV_ABS; e.code = ABS_MT_POSITION_X; e.value = LITEST_AUTO_ASSIGN; - val = litest_auto_assign_value(d, &e, 0, x, y, true); + val = litest_auto_assign_value(d, &e, 0, x, y, NULL, true); litest_event(d, EV_ABS, ABS_MT_POSITION_X, val); e.code = ABS_MT_POSITION_Y; e.value = LITEST_AUTO_ASSIGN; - val = litest_auto_assign_value(d, &e, 0, x, y, true); + val = litest_auto_assign_value(d, &e, 0, x, y, NULL, true); litest_event(d, EV_ABS, ABS_MT_POSITION_Y, val); } |