diff --git a/test/litest.h b/test/litest.h index ab66ff9e..ac32433f 100644 --- a/test/litest.h +++ b/test/litest.h @@ -1149,4 +1149,9 @@ litest_send_file(int sock, int fd) return write(sock, buf, n); } +static inline int litest_slot_count(struct litest_device *dev) +{ + return libevdev_get_num_slots(dev->evdev); +} + #endif /* LITEST_H */ diff --git a/test/test-gestures.c b/test/test-gestures.c index 85fdc321..d16175ed 100644 --- a/test/test-gestures.c +++ b/test/test-gestures.c @@ -77,7 +77,7 @@ START_TEST(gestures_swipe_3fg) { -30, 30 }, }; - if (libevdev_get_num_slots(dev->evdev) < 3) + if (litest_slot_count(dev) < 3) return; dir_x = cardinals[cardinal][0]; @@ -176,7 +176,7 @@ START_TEST(gestures_swipe_3fg_btntool) { -30, 30 }, }; - if (libevdev_get_num_slots(dev->evdev) > 2 || + if (litest_slot_count(dev) > 2 || !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP) || !libinput_device_has_capability(dev->libinput_device, LIBINPUT_DEVICE_CAP_GESTURE)) @@ -266,7 +266,7 @@ START_TEST(gestures_swipe_3fg_btntool_pinch_like) struct libinput_event *event; struct libinput_event_gesture *gevent; - if (libevdev_get_num_slots(dev->evdev) > 2 || + if (litest_slot_count(dev) > 2 || !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP) || !libinput_device_has_capability(dev->libinput_device, LIBINPUT_DEVICE_CAP_GESTURE)) @@ -330,7 +330,7 @@ START_TEST(gestures_swipe_4fg) }; int i; - if (libevdev_get_num_slots(dev->evdev) < 4) + if (litest_slot_count(dev) < 4) return; dir_x = cardinals[cardinal][0]; @@ -456,7 +456,7 @@ START_TEST(gestures_swipe_4fg_btntool) { -30, 30 }, }; - if (libevdev_get_num_slots(dev->evdev) > 2 || + if (litest_slot_count(dev) > 2 || !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_QUADTAP) || !libinput_device_has_capability(dev->libinput_device, LIBINPUT_DEVICE_CAP_GESTURE)) @@ -562,7 +562,7 @@ START_TEST(gestures_pinch) { -30, 30 }, }; - if (libevdev_get_num_slots(dev->evdev) < 2 || + if (litest_slot_count(dev) < 2 || !libinput_device_has_capability(dev->libinput_device, LIBINPUT_DEVICE_CAP_GESTURE)) return; @@ -674,7 +674,7 @@ START_TEST(gestures_pinch_3fg) { -30, 30 }, }; - if (libevdev_get_num_slots(dev->evdev) < 3) + if (litest_slot_count(dev) < 3) return; dir_x = cardinals[cardinal][0]; @@ -779,7 +779,7 @@ START_TEST(gestures_pinch_4fg) { -30, 30 }, }; - if (libevdev_get_num_slots(dev->evdev) < 4) + if (litest_slot_count(dev) < 4) return; dir_x = cardinals[cardinal][0]; @@ -890,7 +890,7 @@ START_TEST(gestures_spread) { -30, 30 }, }; - if (libevdev_get_num_slots(dev->evdev) < 2 || + if (litest_slot_count(dev) < 2 || !libinput_device_has_capability(dev->libinput_device, LIBINPUT_DEVICE_CAP_GESTURE)) return; @@ -985,7 +985,7 @@ START_TEST(gestures_time_usec) struct libinput_event_gesture *gevent; uint64_t time_usec; - if (libevdev_get_num_slots(dev->evdev) < 3) + if (litest_slot_count(dev) < 3) return; litest_drain_events(li); @@ -1014,7 +1014,7 @@ START_TEST(gestures_3fg_buttonarea_scroll) struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; - if (libevdev_get_num_slots(dev->evdev) < 3) + if (litest_slot_count(dev) < 3) return; litest_enable_buttonareas(dev); @@ -1040,7 +1040,7 @@ START_TEST(gestures_3fg_buttonarea_scroll_btntool) struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; - if (libevdev_get_num_slots(dev->evdev) > 2) + if (litest_slot_count(dev) > 2) return; litest_enable_buttonareas(dev); diff --git a/test/test-touchpad-buttons.c b/test/test-touchpad-buttons.c index c88ccbb5..d6a5cebe 100644 --- a/test/test-touchpad-buttons.c +++ b/test/test-touchpad-buttons.c @@ -219,7 +219,7 @@ START_TEST(touchpad_3fg_clickfinger) struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; - if (libevdev_get_num_slots(dev->evdev) < 3) + if (litest_slot_count(dev) < 3) return; litest_enable_clickfinger(dev); @@ -253,7 +253,7 @@ START_TEST(touchpad_3fg_clickfinger_btntool) struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; - if (libevdev_get_num_slots(dev->evdev) >= 3 || + if (litest_slot_count(dev) >= 3 || !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) return; @@ -293,7 +293,7 @@ START_TEST(touchpad_4fg_clickfinger) struct libinput *li = dev->libinput; struct libinput_event *event; - if (libevdev_get_num_slots(dev->evdev) < 4) + if (litest_slot_count(dev) < 4) return; litest_enable_clickfinger(dev); @@ -337,7 +337,7 @@ START_TEST(touchpad_4fg_clickfinger_btntool_2slots) struct libinput *li = dev->libinput; struct libinput_event *event; - if (libevdev_get_num_slots(dev->evdev) >= 3 || + if (litest_slot_count(dev) >= 3 || !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_QUADTAP)) return; @@ -382,7 +382,7 @@ START_TEST(touchpad_4fg_clickfinger_btntool_3slots) struct libinput *li = dev->libinput; struct libinput_event *event; - if (libevdev_get_num_slots(dev->evdev) != 3 || + if (litest_slot_count(dev) != 3 || !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) return; @@ -489,7 +489,7 @@ START_TEST(touchpad_3fg_clickfinger_distance) struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; - if (libevdev_get_num_slots(dev->evdev) < 3) + if (litest_slot_count(dev) < 3) return; litest_enable_clickfinger(dev); @@ -522,7 +522,7 @@ START_TEST(touchpad_3fg_clickfinger_distance_btntool) struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; - if (libevdev_get_num_slots(dev->evdev) > 2) + if (litest_slot_count(dev) > 2) return; litest_enable_clickfinger(dev); @@ -963,7 +963,7 @@ START_TEST(touchpad_clickfinger_click_drag) struct libinput *li = dev->libinput; int nfingers = _i; /* ranged test */ unsigned int button; - int nslots = libevdev_get_num_slots(dev->evdev); + int nslots = litest_slot_count(dev); litest_enable_clickfinger(dev); litest_drain_events(li); diff --git a/test/test-touchpad-tap.c b/test/test-touchpad-tap.c index c0c67477..3d131a9b 100644 --- a/test/test-touchpad-tap.c +++ b/test/test-touchpad-tap.c @@ -936,7 +936,7 @@ START_TEST(touchpad_2fg_tap_n_drag_3fg_btntool) struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; - if (libevdev_get_num_slots(dev->evdev) > 2 || + if (litest_slot_count(dev) > 2 || !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) return; @@ -981,7 +981,7 @@ START_TEST(touchpad_2fg_tap_n_drag_3fg) struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; - if (libevdev_get_num_slots(dev->evdev) < 3) + if (litest_slot_count(dev) < 3) return; litest_enable_tap(dev->libinput_device); @@ -1522,7 +1522,7 @@ START_TEST(touchpad_3fg_tap) unsigned int button = 0; int i; - if (libevdev_get_num_slots(dev->evdev) < 3) + if (litest_slot_count(dev) < 3) return; litest_enable_tap(dev->libinput_device); @@ -1584,7 +1584,7 @@ START_TEST(touchpad_3fg_tap_tap_again) struct libinput *li = dev->libinput; int i; - if (libevdev_get_num_slots(dev->evdev) < 3) + if (litest_slot_count(dev) < 3) return; litest_enable_tap(dev->libinput_device); @@ -1635,7 +1635,7 @@ START_TEST(touchpad_3fg_tap_quickrelease) struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; - if (libevdev_get_num_slots(dev->evdev) < 3) + if (litest_slot_count(dev) < 3) return; litest_enable_tap(dev->libinput_device); @@ -1673,7 +1673,7 @@ START_TEST(touchpad_3fg_tap_pressure_btntool) struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; - if (libevdev_get_num_slots(dev->evdev) >= 3 || + if (litest_slot_count(dev) >= 3 || !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) return; @@ -1734,7 +1734,7 @@ START_TEST(touchpad_3fg_tap_hover_btntool) struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; - if (libevdev_get_num_slots(dev->evdev) >= 3 || + if (litest_slot_count(dev) >= 3 || !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) return; @@ -1788,7 +1788,7 @@ START_TEST(touchpad_3fg_tap_btntool) enum libinput_config_tap_button_map map = _i; /* ranged test */ unsigned int button = 0; - if (libevdev_get_num_slots(dev->evdev) > 3 || + if (litest_slot_count(dev) >= 3 || !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) return; @@ -1838,7 +1838,7 @@ START_TEST(touchpad_3fg_tap_btntool_inverted) enum libinput_config_tap_button_map map = _i; /* ranged test */ unsigned int button = 0; - if (libevdev_get_num_slots(dev->evdev) > 3 || + if (litest_slot_count(dev) > 3 || !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) return; @@ -1888,7 +1888,7 @@ START_TEST(touchpad_3fg_tap_btntool_pointerjump) enum libinput_config_tap_button_map map = _i; /* ranged test */ unsigned int button = 0; - if (libevdev_get_num_slots(dev->evdev) > 3 || + if (litest_slot_count(dev) > 3 || !libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP)) return; @@ -2031,7 +2031,7 @@ START_TEST(touchpad_3fg_tap_after_scroll) struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; - if (libevdev_get_num_slots(dev->evdev) <= 3) + if (litest_slot_count(dev) <= 3) return; litest_enable_2fg_scroll(dev); @@ -2067,7 +2067,7 @@ START_TEST(touchpad_4fg_tap) struct libinput *li = dev->libinput; int i; - if (libevdev_get_num_slots(dev->evdev) <= 4) + if (litest_slot_count(dev) <= 4) return; litest_enable_tap(dev->libinput_device); @@ -2098,7 +2098,7 @@ START_TEST(touchpad_4fg_tap_quickrelease) struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; - if (libevdev_get_num_slots(dev->evdev) <= 4) + if (litest_slot_count(dev) <= 4) return; litest_enable_tap(dev->libinput_device); @@ -2135,7 +2135,7 @@ START_TEST(touchpad_move_after_touch) struct libinput *li = dev->libinput; int nfingers = _i; /* ranged test */ - if (nfingers > libevdev_get_num_slots(dev->evdev)) + if (nfingers > litest_slot_count(dev)) return; litest_enable_tap(dev->libinput_device); @@ -2207,7 +2207,7 @@ START_TEST(touchpad_5fg_tap) struct libinput *li = dev->libinput; int i; - if (libevdev_get_num_slots(dev->evdev) < 5) + if (litest_slot_count(dev) < 5) return; litest_enable_tap(dev->libinput_device); @@ -2240,7 +2240,7 @@ START_TEST(touchpad_5fg_tap_quickrelease) struct litest_device *dev = litest_current_device(); struct libinput *li = dev->libinput; - if (libevdev_get_num_slots(dev->evdev) < 5) + if (litest_slot_count(dev) < 5) return; litest_enable_tap(dev->libinput_device); @@ -3204,7 +3204,7 @@ START_TEST(touchpad_tap_palm_on_touch_3) int which = _i; /* ranged test */ int this = which % 3; - if (libevdev_get_num_slots(dev->evdev) < 3) + if (litest_slot_count(dev) < 3) return; if (!touchpad_has_palm_pressure(dev)) @@ -3250,7 +3250,7 @@ START_TEST(touchpad_tap_palm_on_touch_3_retouch) int which = _i; /* ranged test */ int this = which % 3; - if (libevdev_get_num_slots(dev->evdev) < 3) + if (litest_slot_count(dev) < 3) return; if (!touchpad_has_palm_pressure(dev)) @@ -3301,7 +3301,7 @@ START_TEST(touchpad_tap_palm_on_touch_4) int which = _i; /* ranged test */ int this = which % 4; - if (libevdev_get_num_slots(dev->evdev) < 4) + if (litest_slot_count(dev) < 4) return; if (!touchpad_has_palm_pressure(dev))