libinput_event_get_gesture_event;
} LIBINPUT_0.19.0;
- } LIBINPUT_0.20.0;
+ LIBINPUT_0.21.0 {
+ libinput_device_config_dwt_is_available;
+ libinput_device_config_dwt_set_enabled;
+ libinput_device_config_dwt_get_enabled;
+ libinput_device_config_dwt_get_default_enabled;
+ } LIBINPUT_0.20.0;
++
+/* tablet APIs, they are not part of any stable API promise yet.
+ * keep them separate */
+LIBINPUT_TABLET_SUPPORT {
+ libinput_event_get_tablet_event;
+ libinput_event_tablet_axis_has_changed;
+ libinput_event_tablet_get_axis_delta;
+ libinput_event_tablet_get_axis_delta_discrete;
+ libinput_event_tablet_get_axis_value;
+ libinput_event_tablet_get_base_event;
+ libinput_event_tablet_get_button;
+ libinput_event_tablet_get_button_state;
+ libinput_event_tablet_get_proximity_state;
+ libinput_event_tablet_get_seat_button_count;
+ libinput_event_tablet_get_time;
+ libinput_event_tablet_get_tool;
+ libinput_event_tablet_get_x_transformed;
+ libinput_event_tablet_get_y_transformed;
+ libinput_tool_get_serial;
+ libinput_tool_get_tool_id;
+ libinput_tool_get_type;
+ libinput_tool_get_user_data;
+ libinput_tool_has_button;
+ libinput_tool_has_axis;
+ libinput_tool_ref;
+ libinput_tool_set_user_data;
+ libinput_tool_unref;
++} LIBINPUT_0.21.0;
}
END_TEST
+ START_TEST(device_udev_tag_synaptics_serial)
+ {
+ struct litest_device *dev = litest_current_device();
+ struct libinput_device *device = dev->libinput_device;
+ struct udev_device *d;
+ const char *prop;
+
+ d = libinput_device_get_udev_device(device);
+ prop = udev_device_get_property_value(d,
+ "LIBINPUT_MODEL_SYNAPTICS_SERIAL_TOUCHPAD");
+
+ if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_SYNAPTICS_SERIAL &&
+ libevdev_get_id_product(dev->evdev) == PRODUCT_ID_SYNAPTICS_SERIAL)
+ ck_assert_notnull(prop);
+ else
+ ck_assert(prop == NULL);
+
+ udev_device_unref(d);
+ }
+ END_TEST
+
+START_TEST(device_udev_tag_wacom_tablet)
+{
+ struct litest_device *dev = litest_current_device();
+ struct libinput_device *device = dev->libinput_device;
+ struct udev_device *d;
+ const char *prop;
+
+ d = libinput_device_get_udev_device(device);
+ prop = udev_device_get_property_value(d,
+ "ID_INPUT_TABLET");
+
+ ck_assert_notnull(prop);
+ udev_device_unref(d);
+}
+END_TEST
+
void
litest_setup_tests(void)
{
litest_add("device:udev tags", device_udev_tag_alps, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("device:udev tags", device_udev_tag_wacom, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("device:udev tags", device_udev_tag_apple, LITEST_TOUCHPAD, LITEST_ANY);
+ litest_add("device:udev tags", device_udev_tag_synaptics_serial, LITEST_TOUCHPAD, LITEST_ANY);
+ litest_add("device:udev tags", device_udev_tag_wacom_tablet, LITEST_TABLET, LITEST_ANY);
}
return kevent;
}
+ struct libinput_event_gesture *
+ litest_is_gesture_event(struct libinput_event *event,
+ enum libinput_event_type type,
+ int nfingers)
+ {
+ struct libinput_event_gesture *gevent;
+
+ litest_assert(event != NULL);
+ litest_assert_int_eq(libinput_event_get_type(event), type);
+
+ gevent = libinput_event_get_gesture_event(event);
+ litest_assert(gevent != NULL);
+
+ if (nfingers != -1)
+ litest_assert_int_eq(libinput_event_gesture_get_finger_count(gevent),
+ nfingers);
+ return gevent;
+ }
+
void
+litest_assert_tablet_button_event(struct libinput *li, unsigned int button,
+ enum libinput_button_state state)
+{
+ struct libinput_event *event;
+ struct libinput_event_tablet *tev;
+ enum libinput_event_type type = LIBINPUT_EVENT_TABLET_BUTTON;
+
+ litest_wait_for_event(li);
+ event = libinput_get_event(li);
+
+ litest_assert_notnull(event);
+ litest_assert_int_eq(libinput_event_get_type(event), type);
+ tev = libinput_event_get_tablet_event(event);
+ litest_assert_int_eq(libinput_event_tablet_get_button(tev),
+ button);
+ litest_assert_int_eq(libinput_event_tablet_get_button_state(tev),
+ state);
+ libinput_event_destroy(event);
+}
+
+void
litest_assert_scroll(struct libinput *li,
enum libinput_pointer_axis axis,
int minimum_movement)
ck_assert(libinput_event_get_pointer_event(event) == NULL);
ck_assert(libinput_event_get_keyboard_event(event) == NULL);
ck_assert(libinput_event_get_touch_event(event) == NULL);
+ ck_assert(libinput_event_get_gesture_event(event) == NULL);
+ ck_assert(libinput_event_get_tablet_event(event) == NULL);
litest_restore_log_handler(li);
}
ck_assert(libinput_event_get_device_notify_event(event) == NULL);
ck_assert(libinput_event_get_keyboard_event(event) == NULL);
ck_assert(libinput_event_get_touch_event(event) == NULL);
+ ck_assert(libinput_event_get_gesture_event(event) == NULL);
+ ck_assert(libinput_event_get_tablet_event(event) == NULL);
litest_restore_log_handler(li);
}
libinput_event_destroy(event);
ck_assert(libinput_event_get_device_notify_event(event) == NULL);
ck_assert(libinput_event_get_keyboard_event(event) == NULL);
ck_assert(libinput_event_get_touch_event(event) == NULL);
+ ck_assert(libinput_event_get_gesture_event(event) == NULL);
+ ck_assert(libinput_event_get_tablet_event(event) == NULL);
litest_restore_log_handler(li);
}
libinput_event_destroy(event);
ck_assert(libinput_event_get_device_notify_event(event) == NULL);
ck_assert(libinput_event_get_pointer_event(event) == NULL);
ck_assert(libinput_event_get_touch_event(event) == NULL);
+ ck_assert(libinput_event_get_gesture_event(event) == NULL);
+ ck_assert(libinput_event_get_tablet_event(event) == NULL);
litest_restore_log_handler(li);
}
libinput_event_destroy(event);
ck_assert(libinput_event_get_device_notify_event(event) == NULL);
ck_assert(libinput_event_get_pointer_event(event) == NULL);
ck_assert(libinput_event_get_keyboard_event(event) == NULL);
+ ck_assert(libinput_event_get_gesture_event(event) == NULL);
+ ck_assert(libinput_event_get_tablet_event(event) == NULL);
litest_restore_log_handler(li);
}
libinput_event_destroy(event);
}
END_TEST
+ START_TEST(event_conversion_gesture)
+ {
+ struct litest_device *dev = litest_current_device();
+ struct libinput *li = dev->libinput;
+ struct libinput_event *event;
+ int gestures = 0;
+ int i;
+
+ libinput_dispatch(li);
+
+ litest_touch_down(dev, 0, 70, 30);
+ litest_touch_down(dev, 1, 30, 70);
+ for (i = 0; i < 8; i++) {
+ litest_push_event_frame(dev);
+ litest_touch_move(dev, 0, 70 - i * 5, 30 + i * 5);
+ litest_touch_move(dev, 1, 30 + i * 5, 70 - i * 5);
+ litest_pop_event_frame(dev);
+ libinput_dispatch(li);
+ }
+
+ while ((event = libinput_get_event(li))) {
+ enum libinput_event_type type;
+ type = libinput_event_get_type(event);
+
+ if (type >= LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN &&
+ type <= LIBINPUT_EVENT_GESTURE_PINCH_END) {
+ struct libinput_event_gesture *g;
+ struct libinput_event *base;
+ g = libinput_event_get_gesture_event(event);
+ base = libinput_event_gesture_get_base_event(g);
+ ck_assert(event == base);
+
+ gestures++;
+
+ litest_disable_log_handler(li);
+ ck_assert(libinput_event_get_device_notify_event(event) == NULL);
+ ck_assert(libinput_event_get_pointer_event(event) == NULL);
+ ck_assert(libinput_event_get_keyboard_event(event) == NULL);
+ ck_assert(libinput_event_get_touch_event(event) == NULL);
+ litest_restore_log_handler(li);
+ }
+ libinput_event_destroy(event);
+ }
+
+ ck_assert_int_gt(gestures, 0);
+ }
+ END_TEST
+
+START_TEST(event_conversion_tablet)
+{
+ struct litest_device *dev = litest_current_device();
+ struct libinput *li = dev->libinput;
+ struct libinput_event *event;
+ int events = 0;
+ struct axis_replacement axes[] = {
+ { ABS_DISTANCE, 10 },
+ { -1, -1 }
+ };
+
+ litest_tablet_proximity_in(dev, 50, 50, axes);
+ litest_tablet_motion(dev, 60, 50, axes);
+ litest_button_click(dev, BTN_STYLUS, true);
+ litest_button_click(dev, BTN_STYLUS, false);
+
+ libinput_dispatch(li);
+
+ while ((event = libinput_get_event(li))) {
+ enum libinput_event_type type;
+ type = libinput_event_get_type(event);
+
+ if (type >= LIBINPUT_EVENT_TABLET_AXIS &&
+ type <= LIBINPUT_EVENT_TABLET_BUTTON) {
+ struct libinput_event_tablet *t;
+ struct libinput_event *base;
+ t = libinput_event_get_tablet_event(event);
+ base = libinput_event_tablet_get_base_event(t);
+ ck_assert(event == base);
+
+ events++;
+
+ litest_disable_log_handler(li);
+ ck_assert(libinput_event_get_device_notify_event(event) == NULL);
+ ck_assert(libinput_event_get_pointer_event(event) == NULL);
+ ck_assert(libinput_event_get_keyboard_event(event) == NULL);
+ ck_assert(libinput_event_get_touch_event(event) == NULL);
+ litest_restore_log_handler(li);
+ }
+ libinput_event_destroy(event);
+ }
+
+ ck_assert_int_gt(events, 0);
+}
+END_TEST
+
+START_TEST(bitfield_helpers)
+{
+ /* This value has a bit set on all of the word boundaries we want to
+ * test: 0, 1, 7, 8, 31, 32, and 33
+ */
+ unsigned char read_bitfield[] = { 0x83, 0x1, 0x0, 0x80, 0x3 };
+ unsigned char write_bitfield[ARRAY_LENGTH(read_bitfield)];
+ size_t i;
+
+ /* Now check that the bitfield we wrote to came out to be the same as
+ * the bitfield we were writing from */
+ for (i = 0; i < ARRAY_LENGTH(read_bitfield) * 8; i++) {
+ switch (i) {
+ case 0:
+ case 1:
+ case 7:
+ case 8:
+ case 31:
+ case 32:
+ case 33:
+ ck_assert(bit_is_set(read_bitfield, i));
+ set_bit(write_bitfield, i);
+ break;
+ default:
+ ck_assert(!bit_is_set(read_bitfield, i));
+ clear_bit(write_bitfield, i);
+ break;
+ }
+ }
+
+ ck_assert_int_eq(memcmp(read_bitfield,
+ write_bitfield,
+ sizeof(read_bitfield)),
+ 0);
+}
+END_TEST
+
START_TEST(context_ref_counting)
{
struct libinput *li;
litest_add_for_device("events:conversion", event_conversion_pointer_abs, LITEST_XEN_VIRTUAL_POINTER);
litest_add_for_device("events:conversion", event_conversion_key, LITEST_KEYBOARD);
litest_add_for_device("events:conversion", event_conversion_touch, LITEST_WACOM_TOUCH);
+ litest_add_for_device("events:conversion", event_conversion_gesture, LITEST_BCM5974);
+ litest_add_for_device("events:conversion", event_conversion_tablet, LITEST_WACOM_CINTIQ);
+ litest_add_no_device("bitfield_helpers", bitfield_helpers);
litest_add_no_device("context:refcount", context_ref_counting);
litest_add_no_device("config:status string", config_status_string);