Example #1
0
END_TEST

START_TEST(trackpoint_palmdetect)
{
	struct litest_device *trackpoint = litest_current_device();
	struct litest_device *touchpad;
	struct libinput *li = trackpoint->libinput;
	int i;

	touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C);
	litest_drain_events(li);

	for (i = 0; i < 10; i++) {
		litest_event(trackpoint, EV_REL, REL_X, 1);
		litest_event(trackpoint, EV_REL, REL_Y, 1);
		litest_event(trackpoint, EV_SYN, SYN_REPORT, 0);
		libinput_dispatch(li);
	}
	litest_drain_events(li);

	litest_touch_down(touchpad, 0, 30, 30);
	litest_touch_move_to(touchpad, 0, 30, 30, 80, 80, 10, 1);
	litest_touch_up(touchpad, 0);
	litest_assert_empty_queue(li);

	litest_timeout_trackpoint();
	libinput_dispatch(li);

	litest_touch_down(touchpad, 0, 30, 30);
	litest_touch_move_to(touchpad, 0, 30, 30, 80, 80, 10, 1);
	litest_touch_up(touchpad, 0);
	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);

	litest_delete_device(touchpad);
}
END_TEST

START_TEST(device_disable_touchpad)
{
	struct litest_device *dev = litest_current_device();
	struct libinput *li = dev->libinput;
	struct libinput_device *device;
	enum libinput_config_status status;

	device = dev->libinput_device;

	litest_drain_events(li);

	status = libinput_device_config_send_events_set_mode(device,
			LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
	ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);

	/* no event from disabling */
	litest_assert_empty_queue(li);

	litest_touch_down(dev, 0, 50, 50);
	litest_touch_move_to(dev, 0, 50, 50, 90, 90, 10, 0);
	litest_touch_up(dev, 0);

	litest_assert_empty_queue(li);

	/* no event from resuming */
	status = libinput_device_config_send_events_set_mode(device,
			LIBINPUT_CONFIG_SEND_EVENTS_ENABLED);
	ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
	litest_assert_empty_queue(li);
}
Example #3
0
END_TEST

START_TEST(trackpoint_palmdetect_require_min_events)
{
	struct litest_device *trackpoint = litest_current_device();
	struct litest_device *touchpad;
	struct libinput *li = trackpoint->libinput;

	touchpad = litest_add_device(li, LITEST_SYNAPTICS_I2C);
	litest_drain_events(li);

	/* A single event does not trigger palm detection */
	litest_event(trackpoint, EV_REL, REL_X, 1);
	litest_event(trackpoint, EV_REL, REL_Y, 1);
	litest_event(trackpoint, EV_SYN, SYN_REPORT, 0);
	libinput_dispatch(li);
	litest_drain_events(li);

	litest_touch_down(touchpad, 0, 30, 30);
	litest_touch_move_to(touchpad, 0, 30, 30, 80, 80, 10, 1);
	litest_touch_up(touchpad, 0);
	litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);

	litest_delete_device(touchpad);
}