2014-06-07 17:35:41 -04:00
|
|
|
/*
|
2015-12-15 08:39:56 +10:00
|
|
|
* Copyright © 2014-2015 Red Hat, Inc.
|
2017-11-17 08:40:07 +10:00
|
|
|
* Copyright © 2014 Lyude Paul
|
2014-06-07 17:35:41 -04:00
|
|
|
*
|
2018-08-07 08:26:53 +10:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
2014-06-07 17:35:41 -04:00
|
|
|
*
|
2018-08-07 08:26:53 +10:00
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
|
* Software.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
2014-06-07 17:35:41 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#include <check.h>
|
|
|
|
|
#include <errno.h>
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
#include <libinput.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <stdbool.h>
|
2017-12-01 09:31:07 +10:00
|
|
|
#include <stdarg.h>
|
2014-06-07 17:35:41 -04:00
|
|
|
|
|
|
|
|
#include "libinput-util.h"
|
|
|
|
|
#include "evdev-tablet.h"
|
|
|
|
|
#include "litest.h"
|
|
|
|
|
|
2017-01-16 14:50:07 +10:00
|
|
|
START_TEST(button_down_up)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
|
|
|
|
{ ABS_PRESSURE, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_STYLUS))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_BUTTON);
|
|
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_button(tev),
|
|
|
|
|
BTN_STYLUS);
|
|
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_button_state(tev),
|
|
|
|
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_BUTTON);
|
|
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_button(tev),
|
|
|
|
|
BTN_STYLUS);
|
|
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_button_state(tev),
|
|
|
|
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(button_seat_count)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
struct litest_device *dev2;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
|
|
|
|
{ ABS_PRESSURE, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_STYLUS))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
dev2 = litest_add_device(li, LITEST_WACOM_CINTIQ_13HDT_PEN);
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_tablet_proximity_in(dev2, 10, 10, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_event(dev2, EV_KEY, BTN_STYLUS, 1);
|
|
|
|
|
litest_event(dev2, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_BUTTON);
|
|
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_button(tev),
|
|
|
|
|
BTN_STYLUS);
|
|
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_button_state(tev),
|
|
|
|
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_seat_button_count(tev), 1);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_BUTTON);
|
|
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_button(tev),
|
|
|
|
|
BTN_STYLUS);
|
|
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_button_state(tev),
|
|
|
|
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_seat_button_count(tev), 2);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev2, EV_KEY, BTN_STYLUS, 0);
|
|
|
|
|
litest_event(dev2, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_BUTTON);
|
|
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_button_state(tev),
|
|
|
|
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_button(tev),
|
|
|
|
|
BTN_STYLUS);
|
|
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_seat_button_count(tev), 1);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_BUTTON);
|
|
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_button_state(tev),
|
|
|
|
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_button(tev),
|
|
|
|
|
BTN_STYLUS);
|
|
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_seat_button_count(tev), 0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_delete_device(dev2);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2018-02-05 11:27:09 +10:00
|
|
|
START_TEST(button_up_on_delete)
|
|
|
|
|
{
|
|
|
|
|
struct libinput *li = litest_create_context();
|
|
|
|
|
struct litest_device *dev = litest_add_device(li, LITEST_WACOM_INTUOS);
|
|
|
|
|
struct libevdev *evdev = libevdev_new();
|
|
|
|
|
unsigned int code;
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, NULL);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
for (code = BTN_LEFT; code <= BTN_TASK; code++) {
|
|
|
|
|
if (!libevdev_has_event_code(dev->evdev, EV_KEY, code))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
libevdev_enable_event_code(evdev, EV_KEY, code, NULL);
|
|
|
|
|
litest_event(dev, EV_KEY, code, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
litest_delete_device(dev);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
for (code = BTN_LEFT; code <= BTN_TASK; code++) {
|
|
|
|
|
if (!libevdev_has_event_code(evdev, EV_KEY, code))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
litest_assert_tablet_button_event(li,
|
|
|
|
|
code,
|
|
|
|
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
litest_assert_tablet_proximity_event(li,
|
|
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
|
|
|
|
libevdev_free(evdev);
|
|
|
|
|
libinput_unref(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-11-11 14:03:05 +10:00
|
|
|
START_TEST(tip_down_up)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
2015-11-11 14:03:05 +10:00
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2015-11-11 14:03:05 +10:00
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 0);
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 30);
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
2015-11-11 14:03:05 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 1);
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_pop_event_frame(dev);
|
2015-11-11 14:03:05 +10:00
|
|
|
|
|
|
|
|
libinput_dispatch(li);
|
2015-12-14 08:05:32 +10:00
|
|
|
|
2015-11-11 14:03:05 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_TIP);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event),
|
2015-11-16 15:47:15 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_TIP_DOWN);
|
2015-11-11 14:03:05 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 10);
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 0);
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
2015-11-11 14:03:05 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 0);
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_pop_event_frame(dev);
|
2015-11-11 14:03:05 +10:00
|
|
|
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_TIP);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event),
|
2015-11-16 15:47:15 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_TIP_UP);
|
2015-11-11 14:03:05 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(tip_down_prox_in)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
2015-11-11 14:03:05 +10:00
|
|
|
struct axis_replacement axes[] = {
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_DISTANCE, 0 },
|
|
|
|
|
{ ABS_PRESSURE, 30 },
|
2015-11-11 14:03:05 +10:00
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
2015-11-11 14:03:05 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 1);
|
|
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_proximity_state(tablet_event),
|
2016-01-05 14:08:01 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
|
2015-11-11 14:03:05 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_TIP);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event),
|
2015-11-16 15:47:15 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_TIP_DOWN);
|
2015-11-11 14:03:05 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(tip_up_prox_out)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
2015-11-11 14:03:05 +10:00
|
|
|
struct axis_replacement axes[] = {
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_DISTANCE, 0 },
|
|
|
|
|
{ ABS_PRESSURE, 30 },
|
2015-11-11 14:03:05 +10:00
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 30);
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 0);
|
2015-11-11 14:03:05 +10:00
|
|
|
litest_push_event_frame(dev);
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
2015-11-11 14:03:05 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 0);
|
|
|
|
|
litest_tablet_proximity_out(dev);
|
|
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_TIP);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event),
|
2015-11-16 15:47:15 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_TIP_UP);
|
2015-11-11 14:03:05 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2018-02-05 11:26:24 +10:00
|
|
|
litest_timeout_tablet_proxout();
|
2015-11-11 14:03:05 +10:00
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_proximity_state(tablet_event),
|
2016-01-05 14:08:01 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
2015-11-11 14:03:05 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(tip_up_btn_change)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
2015-11-11 14:03:05 +10:00
|
|
|
struct axis_replacement axes[] = {
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_DISTANCE, 0 },
|
|
|
|
|
{ ABS_PRESSURE, 30 },
|
2015-11-11 14:03:05 +10:00
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_push_event_frame(dev);
|
2015-11-11 14:03:05 +10:00
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
2015-11-11 14:03:05 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 1);
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_pop_event_frame(dev);
|
2015-11-11 14:03:05 +10:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 30);
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 0);
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 10, 20, axes);
|
2015-11-11 14:03:05 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 1);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 0);
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_pop_event_frame(dev);
|
2015-11-11 14:03:05 +10:00
|
|
|
|
|
|
|
|
libinput_dispatch(li);
|
2015-12-15 08:39:56 +10:00
|
|
|
|
2015-12-14 08:05:32 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-12-15 08:39:56 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_TIP);
|
|
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event),
|
|
|
|
|
LIBINPUT_TABLET_TOOL_TIP_UP);
|
2015-12-14 08:05:32 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2015-11-11 14:03:05 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_BUTTON);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_button(tablet_event),
|
2015-11-11 14:03:05 +10:00
|
|
|
BTN_STYLUS);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_button_state(tablet_event),
|
2015-11-11 14:03:05 +10:00
|
|
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 0);
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 30);
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
2015-11-11 14:03:05 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 1);
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_pop_event_frame(dev);
|
2015-11-11 14:03:05 +10:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* same thing with a release at tip-up */
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 30);
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 0);
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
2015-11-11 14:03:05 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 0);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 0);
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_pop_event_frame(dev);
|
2015-11-11 14:03:05 +10:00
|
|
|
|
|
|
|
|
libinput_dispatch(li);
|
2015-12-15 08:39:56 +10:00
|
|
|
|
2015-12-14 08:05:32 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-12-15 08:39:56 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_TIP);
|
|
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event),
|
|
|
|
|
LIBINPUT_TABLET_TOOL_TIP_UP);
|
2015-12-14 08:05:32 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2015-11-11 14:03:05 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_BUTTON);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_button(tablet_event),
|
2015-11-11 14:03:05 +10:00
|
|
|
BTN_STYLUS);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_button_state(tablet_event),
|
2015-11-11 14:03:05 +10:00
|
|
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(tip_down_btn_change)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
2015-11-11 14:03:05 +10:00
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2015-11-11 14:03:05 +10:00
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 0);
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 30);
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 10, 20, axes);
|
2015-11-11 14:03:05 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 1);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 1);
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_pop_event_frame(dev);
|
2015-11-11 14:03:05 +10:00
|
|
|
|
|
|
|
|
libinput_dispatch(li);
|
2015-12-14 08:05:32 +10:00
|
|
|
|
2015-11-11 14:03:05 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_TIP);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event),
|
2015-11-16 15:47:15 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_TIP_DOWN);
|
2015-11-11 14:03:05 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_BUTTON);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_button(tablet_event),
|
2015-11-11 14:03:05 +10:00
|
|
|
BTN_STYLUS);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_button_state(tablet_event),
|
2015-11-11 14:03:05 +10:00
|
|
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 30);
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 0);
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 10, 20, axes);
|
2015-11-11 14:03:05 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 0);
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_pop_event_frame(dev);
|
2015-11-11 14:03:05 +10:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* same thing with a release at tip-down */
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 0);
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 30);
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 10, 20, axes);
|
2015-11-11 14:03:05 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 1);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 0);
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_pop_event_frame(dev);
|
2015-11-11 14:03:05 +10:00
|
|
|
|
|
|
|
|
libinput_dispatch(li);
|
2015-12-14 08:05:32 +10:00
|
|
|
|
2015-11-11 14:03:05 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_TIP);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event),
|
2015-11-16 15:47:15 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_TIP_DOWN);
|
2015-11-11 14:03:05 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_BUTTON);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_button(tablet_event),
|
2015-11-11 14:03:05 +10:00
|
|
|
BTN_STYLUS);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_button_state(tablet_event),
|
2015-11-11 14:03:05 +10:00
|
|
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(tip_down_motion)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
2015-11-11 14:03:05 +10:00
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2015-11-11 14:03:05 +10:00
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
double x, y, last_x, last_y;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-12-15 08:39:56 +10:00
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
|
|
|
|
last_x = libinput_event_tablet_tool_get_x(tablet_event);
|
|
|
|
|
last_y = libinput_event_tablet_tool_get_y(tablet_event);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
/* move x/y on tip down, make sure x/y changed */
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 0);
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 20);
|
2015-11-11 14:03:05 +10:00
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 70, 70, axes);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_TIP);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event),
|
2015-11-16 15:47:15 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_TIP_DOWN);
|
2015-12-15 08:39:56 +10:00
|
|
|
ck_assert(libinput_event_tablet_tool_x_has_changed(tablet_event));
|
|
|
|
|
ck_assert(libinput_event_tablet_tool_y_has_changed(tablet_event));
|
2015-12-14 09:51:11 +10:00
|
|
|
x = libinput_event_tablet_tool_get_x(tablet_event);
|
|
|
|
|
y = libinput_event_tablet_tool_get_y(tablet_event);
|
2015-12-15 08:39:56 +10:00
|
|
|
ck_assert_double_lt(last_x, x);
|
|
|
|
|
ck_assert_double_lt(last_y, y);
|
2015-11-11 14:03:05 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(tip_up_motion)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
2015-11-11 14:03:05 +10:00
|
|
|
struct axis_replacement axes[] = {
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_DISTANCE, 0 },
|
2015-12-15 08:39:56 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2015-11-11 14:03:05 +10:00
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
double x, y, last_x, last_y;
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-12-15 08:39:56 +10:00
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 20);
|
2015-11-11 14:03:05 +10:00
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 70, 70, axes);
|
2015-12-15 08:39:56 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 1);
|
2015-11-11 14:03:05 +10:00
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-12-15 08:39:56 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_TIP);
|
2015-12-14 09:51:11 +10:00
|
|
|
last_x = libinput_event_tablet_tool_get_x(tablet_event);
|
|
|
|
|
last_y = libinput_event_tablet_tool_get_y(tablet_event);
|
2015-11-11 14:03:05 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2015-12-15 08:39:56 +10:00
|
|
|
/* move x/y on tip up, make sure x/y changed */
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 0);
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 40, 40, axes);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 0);
|
|
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
|
2015-11-11 14:03:05 +10:00
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_TIP);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event),
|
2015-11-16 15:47:15 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_TIP_UP);
|
2015-12-15 08:39:56 +10:00
|
|
|
ck_assert(libinput_event_tablet_tool_x_has_changed(tablet_event));
|
|
|
|
|
ck_assert(libinput_event_tablet_tool_y_has_changed(tablet_event));
|
2015-12-14 09:51:11 +10:00
|
|
|
x = libinput_event_tablet_tool_get_x(tablet_event);
|
|
|
|
|
y = libinput_event_tablet_tool_get_y(tablet_event);
|
2015-12-15 08:39:56 +10:00
|
|
|
ck_assert_double_ne(last_x, x);
|
|
|
|
|
ck_assert_double_ne(last_y, y);
|
2015-11-11 14:03:05 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2018-09-05 15:57:02 +10:00
|
|
|
START_TEST(tip_up_motion_one_axis)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 0 },
|
|
|
|
|
{ ABS_PRESSURE, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
unsigned int axis = _i; /* ranged test */
|
|
|
|
|
double x, y, last_x, last_y;
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* enough events to get the history going */
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 20);
|
|
|
|
|
for (int i = 1; i < 10; i++) {
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 10 + i, 10 + i, axes);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_motion(dev, 20, 20, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
last_x = libinput_event_tablet_tool_get_x(tablet_event);
|
|
|
|
|
last_y = libinput_event_tablet_tool_get_y(tablet_event);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
/* move x on tip up, make sure x/y changed */
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 0);
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
switch (axis) {
|
|
|
|
|
case ABS_X:
|
|
|
|
|
litest_tablet_motion(dev, 40, 20, axes);
|
|
|
|
|
break;
|
|
|
|
|
case ABS_Y:
|
|
|
|
|
litest_tablet_motion(dev, 20, 40, axes);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
abort();
|
|
|
|
|
}
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 0);
|
|
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_TIP);
|
|
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event),
|
|
|
|
|
LIBINPUT_TABLET_TOOL_TIP_UP);
|
|
|
|
|
ck_assert(libinput_event_tablet_tool_x_has_changed(tablet_event));
|
|
|
|
|
ck_assert(libinput_event_tablet_tool_y_has_changed(tablet_event));
|
|
|
|
|
x = libinput_event_tablet_tool_get_x(tablet_event);
|
|
|
|
|
y = libinput_event_tablet_tool_get_y(tablet_event);
|
|
|
|
|
ck_assert_double_ne(last_x, x);
|
|
|
|
|
ck_assert_double_ne(last_y, y);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-11-12 08:01:43 +10:00
|
|
|
START_TEST(tip_state_proximity)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
2015-11-12 08:01:43 +10:00
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2015-11-12 08:01:43 +10:00
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event),
|
2015-11-16 15:47:15 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_TIP_UP);
|
2015-11-12 08:01:43 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 30);
|
|
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 0);
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
2015-11-12 08:01:43 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 1);
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 0);
|
|
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 10);
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
2015-11-12 08:01:43 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 0);
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
|
2015-11-12 08:01:43 +10:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_out(dev);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
2016-12-22 12:11:43 +10:00
|
|
|
litest_timeout_tablet_proxout();
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
2015-11-12 08:01:43 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event),
|
2015-11-16 15:47:15 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_TIP_UP);
|
2015-11-12 08:01:43 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(tip_state_axis)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
2015-11-12 08:01:43 +10:00
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2015-11-12 08:01:43 +10:00
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_motion(dev, 70, 70, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event),
|
2015-11-16 15:47:15 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_TIP_UP);
|
2015-11-12 08:01:43 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 30);
|
|
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 0);
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 40, 40, axes);
|
2015-11-12 08:01:43 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 1);
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_pop_event_frame(dev);
|
2015-11-12 08:01:43 +10:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_motion(dev, 30, 30, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event),
|
2015-11-16 15:47:15 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_TIP_DOWN);
|
2015-11-12 08:01:43 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 0);
|
|
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 10);
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 40, 40, axes);
|
2015-11-12 08:01:43 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 0);
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_pop_event_frame(dev);
|
2015-11-12 08:01:43 +10:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_motion(dev, 40, 80, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event),
|
2015-11-16 15:47:15 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_TIP_UP);
|
2015-11-12 08:01:43 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(tip_state_button)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
2015-11-12 08:01:43 +10:00
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2015-11-12 08:01:43 +10:00
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_BUTTON);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event),
|
2015-11-16 15:47:15 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_TIP_UP);
|
2015-11-12 08:01:43 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 30);
|
|
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 0);
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 40, 40, axes);
|
2015-11-12 08:01:43 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 1);
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_pop_event_frame(dev);
|
2015-11-12 08:01:43 +10:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_BUTTON);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event),
|
2015-11-16 15:47:15 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_TIP_DOWN);
|
2015-11-12 08:01:43 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 0);
|
|
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 10);
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 40, 40, axes);
|
2015-11-12 08:01:43 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 0);
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_pop_event_frame(dev);
|
2015-11-12 08:01:43 +10:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_BUTTON);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event),
|
2015-11-16 15:47:15 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_TIP_UP);
|
2015-11-12 08:01:43 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_BUTTON);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event),
|
2015-11-16 15:47:15 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_TIP_UP);
|
2015-11-12 08:01:43 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2018-02-05 11:27:09 +10:00
|
|
|
START_TEST(tip_up_on_delete)
|
|
|
|
|
{
|
|
|
|
|
struct libinput *li = litest_create_context();
|
|
|
|
|
struct litest_device *dev = litest_add_device(li, LITEST_WACOM_INTUOS);
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
|
|
|
|
{ ABS_PRESSURE, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 0);
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 30);
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 1);
|
|
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
litest_delete_device(dev);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_TIP);
|
|
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_tip_state(tablet_event),
|
|
|
|
|
LIBINPUT_TABLET_TOOL_TIP_UP);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
libinput_unref(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2014-06-07 17:35:41 -04:00
|
|
|
START_TEST(proximity_in_out)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
2014-06-07 17:35:41 -04:00
|
|
|
struct libinput_event *event;
|
|
|
|
|
bool have_tool_update = false,
|
|
|
|
|
have_proximity_out = false;
|
|
|
|
|
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2014-06-07 17:35:41 -04:00
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
2015-11-12 08:32:34 +10:00
|
|
|
litest_drain_events(li);
|
2014-06-07 17:35:41 -04:00
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
while ((event = libinput_get_event(li))) {
|
|
|
|
|
if (libinput_event_get_type(event) ==
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY) {
|
2015-11-16 15:34:19 +10:00
|
|
|
struct libinput_tablet_tool * tool;
|
2014-06-07 17:35:41 -04:00
|
|
|
|
2017-05-04 12:44:25 +10:00
|
|
|
ck_assert(!have_tool_update);
|
|
|
|
|
have_tool_update = true;
|
2015-11-16 16:28:55 +10:00
|
|
|
tablet_event = libinput_event_get_tablet_tool_event(event);
|
|
|
|
|
tool = libinput_event_tablet_tool_get_tool(tablet_event);
|
2015-11-16 16:35:03 +10:00
|
|
|
ck_assert_int_eq(libinput_tablet_tool_get_type(tool),
|
2015-11-16 15:40:43 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_TYPE_PEN);
|
2014-06-07 17:35:41 -04:00
|
|
|
}
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
ck_assert(have_tool_update);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_out(dev);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
2016-12-22 12:11:43 +10:00
|
|
|
litest_timeout_tablet_proxout();
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
2014-06-07 17:35:41 -04:00
|
|
|
while ((event = libinput_get_event(li))) {
|
|
|
|
|
if (libinput_event_get_type(event) ==
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY) {
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *t =
|
|
|
|
|
libinput_event_get_tablet_tool_event(event);
|
2015-02-16 22:48:42 -05:00
|
|
|
|
2015-11-16 16:28:55 +10:00
|
|
|
if (libinput_event_tablet_tool_get_proximity_state(t) ==
|
2016-01-05 14:08:01 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT)
|
2015-02-16 22:48:42 -05:00
|
|
|
have_proximity_out = true;
|
|
|
|
|
}
|
2014-06-07 17:35:41 -04:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
ck_assert(have_proximity_out);
|
|
|
|
|
|
|
|
|
|
/* Proximity out must not emit axis events */
|
2017-01-06 12:46:53 +10:00
|
|
|
litest_assert_empty_queue(li);
|
2014-06-07 17:35:41 -04:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-12-03 11:19:44 +10:00
|
|
|
START_TEST(proximity_in_button_down)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2015-12-03 11:19:44 +10:00
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 1);
|
|
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
litest_assert_tablet_proximity_event(li,
|
2016-01-05 14:08:01 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
|
2015-12-03 11:19:44 +10:00
|
|
|
litest_assert_tablet_button_event(li,
|
|
|
|
|
BTN_STYLUS,
|
|
|
|
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(proximity_out_button_up)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2015-12-03 11:19:44 +10:00
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_proximity_out(dev);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 0);
|
|
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
litest_assert_tablet_button_event(li,
|
|
|
|
|
BTN_STYLUS,
|
|
|
|
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
litest_assert_tablet_proximity_event(li,
|
2016-01-05 14:08:01 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
2015-12-03 11:19:44 +10:00
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2014-06-07 17:35:41 -04:00
|
|
|
START_TEST(proximity_out_clear_buttons)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
2014-06-07 17:35:41 -04:00
|
|
|
struct libinput_event *event;
|
|
|
|
|
uint32_t button;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2014-06-07 17:35:41 -04:00
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
2019-04-08 10:17:23 +10:00
|
|
|
bool have_proximity = false;
|
|
|
|
|
double x = 50, y = 50;
|
2014-06-07 17:35:41 -04:00
|
|
|
|
2015-11-12 08:32:34 +10:00
|
|
|
litest_drain_events(li);
|
2014-06-07 17:35:41 -04:00
|
|
|
|
|
|
|
|
/* Test that proximity out events send button releases for any currently
|
|
|
|
|
* pressed stylus buttons
|
|
|
|
|
*/
|
2019-04-08 10:17:23 +10:00
|
|
|
for (button = BTN_STYLUS; button <= BTN_STYLUS2; button++) {
|
2014-06-07 17:35:41 -04:00
|
|
|
bool button_released = false;
|
2017-07-06 16:45:41 +10:00
|
|
|
uint32_t event_button = 0;
|
2014-06-07 17:35:41 -04:00
|
|
|
enum libinput_button_state state;
|
|
|
|
|
|
2015-06-29 15:24:06 +10:00
|
|
|
if (!libevdev_has_event_code(dev->evdev, EV_KEY, button))
|
|
|
|
|
continue;
|
|
|
|
|
|
2019-04-08 10:17:23 +10:00
|
|
|
litest_tablet_proximity_in(dev, x++, y++, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2014-06-07 17:35:41 -04:00
|
|
|
litest_event(dev, EV_KEY, button, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_tablet_proximity_out(dev);
|
2016-12-22 12:11:43 +10:00
|
|
|
libinput_dispatch(li);
|
2014-06-07 17:35:41 -04:00
|
|
|
|
2016-12-22 12:11:43 +10:00
|
|
|
litest_timeout_tablet_proxout();
|
2014-06-07 17:35:41 -04:00
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
2019-04-08 10:17:23 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
ck_assert_notnull(event);
|
|
|
|
|
do {
|
2015-11-16 16:28:55 +10:00
|
|
|
tablet_event = libinput_event_get_tablet_tool_event(event);
|
2014-06-07 17:35:41 -04:00
|
|
|
|
2019-04-08 10:17:23 +10:00
|
|
|
if (libinput_event_get_type(event) ==
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY) {
|
|
|
|
|
have_proximity = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-07 17:35:41 -04:00
|
|
|
if (libinput_event_get_type(event) ==
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_BUTTON) {
|
2014-06-07 17:35:41 -04:00
|
|
|
|
2015-11-16 16:28:55 +10:00
|
|
|
event_button = libinput_event_tablet_tool_get_button(tablet_event);
|
|
|
|
|
state = libinput_event_tablet_tool_get_button_state(tablet_event);
|
2014-06-07 17:35:41 -04:00
|
|
|
|
|
|
|
|
if (event_button == button &&
|
|
|
|
|
state == LIBINPUT_BUTTON_STATE_RELEASED)
|
|
|
|
|
button_released = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
2019-04-08 10:17:23 +10:00
|
|
|
} while ((event = libinput_get_event(li)));
|
2014-06-07 17:35:41 -04:00
|
|
|
|
|
|
|
|
ck_assert_msg(button_released,
|
2015-06-29 15:24:25 +10:00
|
|
|
"Button %s (%d) was not released.",
|
|
|
|
|
libevdev_event_code_get_name(EV_KEY, button),
|
2014-06-07 17:35:41 -04:00
|
|
|
event_button);
|
2019-04-08 10:17:23 +10:00
|
|
|
litest_assert(have_proximity);
|
|
|
|
|
litest_assert_empty_queue(li);
|
2014-06-07 17:35:41 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-02-18 01:43:21 -05:00
|
|
|
START_TEST(proximity_has_axes)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
2015-02-18 01:43:21 -05:00
|
|
|
struct libinput_event *event;
|
2015-11-16 15:34:19 +10:00
|
|
|
struct libinput_tablet_tool *tool;
|
2015-02-18 01:43:21 -05:00
|
|
|
double x, y,
|
|
|
|
|
distance;
|
2016-01-22 18:04:41 +10:00
|
|
|
double last_x, last_y,
|
|
|
|
|
last_distance = 0.0,
|
|
|
|
|
last_tx = 0.0, last_ty = 0.0;
|
2015-02-18 01:43:21 -05:00
|
|
|
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2015-02-18 01:43:21 -05:00
|
|
|
{ ABS_TILT_X, 10 },
|
|
|
|
|
{ ABS_TILT_Y, 10 },
|
|
|
|
|
{ -1, -1}
|
|
|
|
|
};
|
|
|
|
|
|
2015-11-12 08:32:34 +10:00
|
|
|
litest_drain_events(li);
|
2015-02-18 01:43:21 -05:00
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
2015-12-21 15:42:33 +10:00
|
|
|
libinput_dispatch(li);
|
2015-02-18 01:43:21 -05:00
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
2015-12-21 15:42:33 +10:00
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2015-11-16 16:28:55 +10:00
|
|
|
tool = libinput_event_tablet_tool_get_tool(tablet_event);
|
2015-02-18 01:43:21 -05:00
|
|
|
|
2015-12-14 09:05:37 +10:00
|
|
|
ck_assert(libinput_event_tablet_tool_x_has_changed(tablet_event));
|
|
|
|
|
ck_assert(libinput_event_tablet_tool_y_has_changed(tablet_event));
|
2015-02-18 01:43:21 -05:00
|
|
|
|
2015-12-14 09:51:11 +10:00
|
|
|
x = libinput_event_tablet_tool_get_x(tablet_event);
|
|
|
|
|
y = libinput_event_tablet_tool_get_y(tablet_event);
|
2015-02-18 01:43:21 -05:00
|
|
|
|
|
|
|
|
litest_assert_double_ne(x, 0);
|
|
|
|
|
litest_assert_double_ne(y, 0);
|
|
|
|
|
|
2015-12-14 10:06:56 +10:00
|
|
|
if (libinput_tablet_tool_has_distance(tool)) {
|
2015-12-14 09:05:37 +10:00
|
|
|
ck_assert(libinput_event_tablet_tool_distance_has_changed(
|
|
|
|
|
tablet_event));
|
2015-02-18 01:43:21 -05:00
|
|
|
|
2015-12-14 09:51:11 +10:00
|
|
|
distance = libinput_event_tablet_tool_get_distance(tablet_event);
|
2015-02-18 01:43:21 -05:00
|
|
|
litest_assert_double_ne(distance, 0);
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-14 10:06:56 +10:00
|
|
|
if (libinput_tablet_tool_has_tilt(tool)) {
|
2015-12-14 09:05:37 +10:00
|
|
|
ck_assert(libinput_event_tablet_tool_tilt_x_has_changed(
|
|
|
|
|
tablet_event));
|
|
|
|
|
ck_assert(libinput_event_tablet_tool_tilt_y_has_changed(
|
|
|
|
|
tablet_event));
|
2015-02-18 01:43:21 -05:00
|
|
|
|
2015-12-14 09:51:11 +10:00
|
|
|
x = libinput_event_tablet_tool_get_tilt_x(tablet_event);
|
|
|
|
|
y = libinput_event_tablet_tool_get_tilt_y(tablet_event);
|
2015-02-18 01:43:21 -05:00
|
|
|
|
|
|
|
|
litest_assert_double_ne(x, 0);
|
|
|
|
|
litest_assert_double_ne(y, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2015-12-21 10:53:29 +10:00
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 20);
|
|
|
|
|
litest_axis_set_value(axes, ABS_TILT_X, 15);
|
|
|
|
|
litest_axis_set_value(axes, ABS_TILT_Y, 25);
|
2017-03-07 16:00:45 +10:00
|
|
|
|
|
|
|
|
/* work around axis smoothing */
|
|
|
|
|
litest_tablet_motion(dev, 20, 30, axes);
|
|
|
|
|
litest_tablet_motion(dev, 20, 29, axes);
|
|
|
|
|
litest_tablet_motion(dev, 20, 31, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-11-11 16:05:41 +10:00
|
|
|
litest_tablet_motion(dev, 20, 30, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
2015-12-21 15:42:33 +10:00
|
|
|
tablet_event = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
2015-11-11 16:05:41 +10:00
|
|
|
|
2015-12-14 09:51:11 +10:00
|
|
|
last_x = libinput_event_tablet_tool_get_x(tablet_event);
|
|
|
|
|
last_y = libinput_event_tablet_tool_get_y(tablet_event);
|
2015-12-14 10:06:56 +10:00
|
|
|
if (libinput_tablet_tool_has_distance(tool))
|
2015-12-14 09:51:11 +10:00
|
|
|
last_distance = libinput_event_tablet_tool_get_distance(
|
|
|
|
|
tablet_event);
|
2015-12-14 10:06:56 +10:00
|
|
|
if (libinput_tablet_tool_has_tilt(tool)) {
|
2015-12-14 09:51:11 +10:00
|
|
|
last_tx = libinput_event_tablet_tool_get_tilt_x(tablet_event);
|
|
|
|
|
last_ty = libinput_event_tablet_tool_get_tilt_y(tablet_event);
|
2015-11-11 16:05:41 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2015-02-18 01:43:21 -05:00
|
|
|
/* Make sure that the axes are still present on proximity out */
|
|
|
|
|
litest_tablet_proximity_out(dev);
|
2015-12-21 15:42:33 +10:00
|
|
|
libinput_dispatch(li);
|
2015-02-18 01:43:21 -05:00
|
|
|
|
2016-12-22 12:11:43 +10:00
|
|
|
litest_timeout_tablet_proxout();
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
2015-02-18 01:43:21 -05:00
|
|
|
event = libinput_get_event(li);
|
2015-12-21 15:42:33 +10:00
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2015-11-16 16:28:55 +10:00
|
|
|
tool = libinput_event_tablet_tool_get_tool(tablet_event);
|
2015-02-18 01:43:21 -05:00
|
|
|
|
2015-12-14 09:05:37 +10:00
|
|
|
ck_assert(!libinput_event_tablet_tool_x_has_changed(tablet_event));
|
|
|
|
|
ck_assert(!libinput_event_tablet_tool_y_has_changed(tablet_event));
|
2015-02-18 01:43:21 -05:00
|
|
|
|
2015-12-14 09:51:11 +10:00
|
|
|
x = libinput_event_tablet_tool_get_x(tablet_event);
|
|
|
|
|
y = libinput_event_tablet_tool_get_y(tablet_event);
|
2017-03-07 16:00:45 +10:00
|
|
|
litest_assert_double_ge(x, last_x - 1);
|
|
|
|
|
litest_assert_double_le(x, last_x + 1);
|
|
|
|
|
litest_assert_double_ge(y, last_y - 1);
|
|
|
|
|
litest_assert_double_le(y, last_y + 1);
|
2015-02-18 01:43:21 -05:00
|
|
|
|
2015-12-14 10:06:56 +10:00
|
|
|
if (libinput_tablet_tool_has_distance(tool)) {
|
2015-12-14 09:05:37 +10:00
|
|
|
ck_assert(!libinput_event_tablet_tool_distance_has_changed(
|
|
|
|
|
tablet_event));
|
2015-02-18 01:43:21 -05:00
|
|
|
|
2015-12-14 09:51:11 +10:00
|
|
|
distance = libinput_event_tablet_tool_get_distance(
|
|
|
|
|
tablet_event);
|
2015-11-11 16:05:41 +10:00
|
|
|
litest_assert_double_eq(distance, last_distance);
|
2015-02-18 01:43:21 -05:00
|
|
|
}
|
|
|
|
|
|
2015-12-14 10:06:56 +10:00
|
|
|
if (libinput_tablet_tool_has_tilt(tool)) {
|
2015-12-14 09:05:37 +10:00
|
|
|
ck_assert(!libinput_event_tablet_tool_tilt_x_has_changed(
|
|
|
|
|
tablet_event));
|
|
|
|
|
ck_assert(!libinput_event_tablet_tool_tilt_y_has_changed(
|
|
|
|
|
tablet_event));
|
2015-02-18 01:43:21 -05:00
|
|
|
|
2015-12-14 09:51:11 +10:00
|
|
|
x = libinput_event_tablet_tool_get_tilt_x(tablet_event);
|
|
|
|
|
y = libinput_event_tablet_tool_get_tilt_y(tablet_event);
|
2015-02-18 01:43:21 -05:00
|
|
|
|
2015-11-11 16:05:41 +10:00
|
|
|
litest_assert_double_eq(x, last_tx);
|
|
|
|
|
litest_assert_double_eq(y, last_ty);
|
2015-02-18 01:43:21 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-12-02 17:16:18 +10:00
|
|
|
START_TEST(proximity_range_enter)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 90 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_push_event_frame(dev);
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_filter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1);
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_unfilter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
2015-12-23 09:52:13 +10:00
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 20);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
litest_assert_tablet_proximity_event(li,
|
2016-01-05 14:08:01 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
|
2015-12-23 09:52:13 +10:00
|
|
|
|
|
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 90);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_assert_tablet_proximity_event(li,
|
2016-01-05 14:08:01 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
2015-12-02 17:16:18 +10:00
|
|
|
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_filter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_tablet_proximity_out(dev);
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 0);
|
|
|
|
|
litest_unfilter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
|
|
|
|
litest_pop_event_frame(dev);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(proximity_range_in_out)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 20 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_push_event_frame(dev);
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_filter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1);
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_unfilter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_assert_tablet_proximity_event(li,
|
2016-01-05 14:08:01 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
|
2015-12-02 17:16:18 +10:00
|
|
|
|
2015-12-23 09:52:13 +10:00
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 90);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_assert_tablet_proximity_event(li,
|
2016-01-05 14:08:01 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
2015-12-02 17:16:18 +10:00
|
|
|
|
|
|
|
|
litest_tablet_motion(dev, 30, 30, axes);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
2015-12-23 09:52:13 +10:00
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 20);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_assert_tablet_proximity_event(li,
|
2016-01-05 14:08:01 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
|
2015-12-02 17:16:18 +10:00
|
|
|
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_filter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_tablet_proximity_out(dev);
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 0);
|
|
|
|
|
litest_unfilter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
|
|
|
|
litest_pop_event_frame(dev);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_assert_tablet_proximity_event(li,
|
2016-01-05 14:08:01 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(proximity_range_button_click)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 90 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_push_event_frame(dev);
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_filter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1);
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_unfilter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_filter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_tablet_proximity_out(dev);
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 0);
|
|
|
|
|
litest_unfilter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
|
|
|
|
litest_pop_event_frame(dev);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(proximity_range_button_press)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 20 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
litest_push_event_frame(dev);
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_filter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1);
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_unfilter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
litest_assert_tablet_button_event(li,
|
|
|
|
|
BTN_STYLUS,
|
|
|
|
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
|
2015-12-23 09:52:13 +10:00
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 90);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_tablet_motion(dev, 15, 15, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
/* expect fake button release */
|
|
|
|
|
litest_assert_tablet_button_event(li,
|
|
|
|
|
BTN_STYLUS,
|
|
|
|
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
litest_assert_tablet_proximity_event(li,
|
2016-01-05 14:08:01 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
2015-12-02 17:16:18 +10:00
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_filter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_tablet_proximity_out(dev);
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 0);
|
|
|
|
|
litest_unfilter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
|
|
|
|
litest_pop_event_frame(dev);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(proximity_range_button_release)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 90 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
litest_push_event_frame(dev);
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_filter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1);
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_unfilter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
2015-12-23 09:52:13 +10:00
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 20);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_tablet_motion(dev, 15, 15, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
litest_assert_tablet_proximity_event(li,
|
2016-01-05 14:08:01 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
|
2015-12-02 17:16:18 +10:00
|
|
|
/* expect fake button press */
|
|
|
|
|
litest_assert_tablet_button_event(li,
|
|
|
|
|
BTN_STYLUS,
|
|
|
|
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_assert_tablet_button_event(li,
|
|
|
|
|
BTN_STYLUS,
|
|
|
|
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_filter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_tablet_proximity_out(dev);
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 0);
|
|
|
|
|
litest_unfilter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
|
|
|
|
litest_pop_event_frame(dev);
|
2015-12-02 17:16:18 +10:00
|
|
|
litest_assert_tablet_proximity_event(li,
|
2016-01-05 14:08:01 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
2015-12-02 17:16:18 +10:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2018-02-05 11:27:09 +10:00
|
|
|
START_TEST(proximity_out_on_delete)
|
|
|
|
|
{
|
|
|
|
|
struct libinput *li = litest_create_context();
|
|
|
|
|
struct litest_device *dev = litest_add_device(li, LITEST_WACOM_INTUOS);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, NULL);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_delete_device(dev);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
litest_assert_tablet_proximity_event(li,
|
|
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
|
|
|
|
libinput_unref(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2014-06-12 22:52:28 -04:00
|
|
|
START_TEST(motion)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
2014-06-12 22:52:28 -04:00
|
|
|
struct libinput_event *event;
|
|
|
|
|
int test_x, test_y;
|
2015-02-10 11:15:04 +10:00
|
|
|
double last_reported_x = 0, last_reported_y = 0;
|
2014-06-12 22:52:28 -04:00
|
|
|
enum libinput_event_type type;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2014-06-12 22:52:28 -04:00
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
2019-02-12 11:36:20 +10:00
|
|
|
bool x_changed, y_changed;
|
|
|
|
|
double reported_x, reported_y;
|
2014-06-12 22:52:28 -04:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 5, 100, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
2015-12-21 15:42:33 +10:00
|
|
|
event = libinput_get_event(li);
|
2019-02-12 11:36:20 +10:00
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
|
|
|
|
x_changed = libinput_event_tablet_tool_x_has_changed(tablet_event);
|
|
|
|
|
y_changed = libinput_event_tablet_tool_y_has_changed(tablet_event);
|
|
|
|
|
ck_assert(x_changed);
|
|
|
|
|
ck_assert(y_changed);
|
2015-02-10 11:07:30 +10:00
|
|
|
|
2019-02-12 11:36:20 +10:00
|
|
|
reported_x = libinput_event_tablet_tool_get_x(tablet_event);
|
|
|
|
|
reported_y = libinput_event_tablet_tool_get_y(tablet_event);
|
2014-06-12 22:52:28 -04:00
|
|
|
|
2019-02-12 11:36:20 +10:00
|
|
|
litest_assert_double_lt(reported_x, reported_y);
|
2014-06-12 22:52:28 -04:00
|
|
|
|
2019-02-12 11:36:20 +10:00
|
|
|
last_reported_x = reported_x;
|
|
|
|
|
last_reported_y = reported_y;
|
2014-06-12 22:52:28 -04:00
|
|
|
|
2019-02-12 11:36:20 +10:00
|
|
|
libinput_event_destroy(event);
|
2014-06-12 22:52:28 -04:00
|
|
|
|
|
|
|
|
for (test_x = 10, test_y = 90;
|
|
|
|
|
test_x <= 100;
|
|
|
|
|
test_x += 10, test_y -= 10) {
|
|
|
|
|
bool x_changed, y_changed;
|
|
|
|
|
double reported_x, reported_y;
|
|
|
|
|
|
2015-02-10 11:07:30 +10:00
|
|
|
litest_tablet_motion(dev, test_x, test_y, axes);
|
2014-06-12 22:52:28 -04:00
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
while ((event = libinput_get_event(li))) {
|
2015-11-16 16:28:55 +10:00
|
|
|
tablet_event = libinput_event_get_tablet_tool_event(event);
|
2014-06-12 22:52:28 -04:00
|
|
|
type = libinput_event_get_type(event);
|
|
|
|
|
|
2015-11-16 16:27:46 +10:00
|
|
|
if (type == LIBINPUT_EVENT_TABLET_TOOL_AXIS) {
|
2015-12-14 09:05:37 +10:00
|
|
|
x_changed = libinput_event_tablet_tool_x_has_changed(
|
|
|
|
|
tablet_event);
|
|
|
|
|
y_changed = libinput_event_tablet_tool_y_has_changed(
|
|
|
|
|
tablet_event);
|
2014-06-12 22:52:28 -04:00
|
|
|
|
|
|
|
|
ck_assert(x_changed);
|
|
|
|
|
ck_assert(y_changed);
|
|
|
|
|
|
2015-12-14 09:51:11 +10:00
|
|
|
reported_x = libinput_event_tablet_tool_get_x(
|
|
|
|
|
tablet_event);
|
|
|
|
|
reported_y = libinput_event_tablet_tool_get_y(
|
|
|
|
|
tablet_event);
|
2014-06-12 22:52:28 -04:00
|
|
|
|
|
|
|
|
litest_assert_double_gt(reported_x,
|
|
|
|
|
last_reported_x);
|
|
|
|
|
litest_assert_double_lt(reported_y,
|
|
|
|
|
last_reported_y);
|
|
|
|
|
|
|
|
|
|
last_reported_x = reported_x;
|
|
|
|
|
last_reported_y = reported_y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-02-16 22:48:40 -05:00
|
|
|
START_TEST(left_handed)
|
|
|
|
|
{
|
2015-02-19 12:56:43 +10:00
|
|
|
#if HAVE_LIBWACOM
|
2015-02-16 22:48:40 -05:00
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
2015-02-16 22:48:40 -05:00
|
|
|
double libinput_max_x, libinput_max_y;
|
2015-07-14 13:13:34 +10:00
|
|
|
double last_x = -1.0, last_y = -1.0;
|
2015-12-21 15:42:33 +10:00
|
|
|
double x, y;
|
2015-02-16 22:48:40 -05:00
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2015-02-16 22:48:40 -05:00
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
2015-12-21 15:42:33 +10:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-02-16 22:48:40 -05:00
|
|
|
ck_assert(libinput_device_config_left_handed_is_available(dev->libinput_device));
|
|
|
|
|
|
|
|
|
|
libinput_device_get_size (dev->libinput_device,
|
|
|
|
|
&libinput_max_x,
|
|
|
|
|
&libinput_max_y);
|
|
|
|
|
|
|
|
|
|
/* Test that left-handed mode doesn't go into effect until the tool has
|
|
|
|
|
* left proximity of the tablet. In order to test this, we have to bring
|
|
|
|
|
* the tool into proximity and make sure libinput processes the
|
|
|
|
|
* proximity events so that it updates it's internal tablet state, and
|
|
|
|
|
* then try setting it to left-handed mode. */
|
|
|
|
|
litest_tablet_proximity_in(dev, 0, 100, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
libinput_device_config_left_handed_set(dev->libinput_device, 1);
|
|
|
|
|
|
2015-12-21 15:42:33 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2015-02-16 22:48:40 -05:00
|
|
|
|
2015-12-21 15:42:33 +10:00
|
|
|
last_x = libinput_event_tablet_tool_get_x(tablet_event);
|
|
|
|
|
last_y = libinput_event_tablet_tool_get_y(tablet_event);
|
2015-02-16 22:48:40 -05:00
|
|
|
|
2015-12-21 15:42:33 +10:00
|
|
|
litest_assert_double_eq(last_x, 0);
|
|
|
|
|
litest_assert_double_eq(last_y, libinput_max_y);
|
2015-02-16 22:48:40 -05:00
|
|
|
|
2015-12-21 15:42:33 +10:00
|
|
|
libinput_event_destroy(event);
|
2015-02-16 22:48:40 -05:00
|
|
|
|
2017-03-07 16:00:45 +10:00
|
|
|
/* work around smoothing */
|
|
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 9);
|
|
|
|
|
litest_tablet_motion(dev, 100, 0, axes);
|
|
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 7);
|
|
|
|
|
litest_tablet_motion(dev, 100, 0, axes);
|
|
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 10);
|
|
|
|
|
litest_tablet_motion(dev, 100, 0, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 5);
|
2015-02-16 22:48:40 -05:00
|
|
|
litest_tablet_motion(dev, 100, 0, axes);
|
2015-12-21 15:42:33 +10:00
|
|
|
libinput_dispatch(li);
|
2015-02-16 22:48:40 -05:00
|
|
|
|
2015-12-21 15:42:33 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
2015-02-16 22:48:40 -05:00
|
|
|
|
2015-12-21 15:42:33 +10:00
|
|
|
x = libinput_event_tablet_tool_get_x(tablet_event);
|
|
|
|
|
y = libinput_event_tablet_tool_get_y(tablet_event);
|
2015-02-16 22:48:40 -05:00
|
|
|
|
2015-12-21 15:42:33 +10:00
|
|
|
litest_assert_double_eq(x, libinput_max_x);
|
|
|
|
|
litest_assert_double_eq(y, 0);
|
2015-02-16 22:48:40 -05:00
|
|
|
|
2015-12-21 15:42:33 +10:00
|
|
|
litest_assert_double_gt(x, last_x);
|
|
|
|
|
litest_assert_double_lt(y, last_y);
|
2015-02-16 22:48:40 -05:00
|
|
|
|
2015-12-21 15:42:33 +10:00
|
|
|
libinput_event_destroy(event);
|
2015-02-16 22:48:40 -05:00
|
|
|
|
|
|
|
|
litest_tablet_proximity_out(dev);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* Since we've drained the events and libinput's aware the tool is out
|
|
|
|
|
* of proximity, it should have finally transitioned into left-handed
|
|
|
|
|
* mode, so the axes should be inverted once we bring it back into
|
|
|
|
|
* proximity */
|
|
|
|
|
litest_tablet_proximity_in(dev, 0, 100, axes);
|
2015-12-21 15:42:33 +10:00
|
|
|
libinput_dispatch(li);
|
2015-02-16 22:48:40 -05:00
|
|
|
|
2015-12-21 15:42:33 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2015-02-16 22:48:40 -05:00
|
|
|
|
2015-12-21 15:42:33 +10:00
|
|
|
last_x = libinput_event_tablet_tool_get_x(tablet_event);
|
|
|
|
|
last_y = libinput_event_tablet_tool_get_y(tablet_event);
|
2015-02-16 22:48:40 -05:00
|
|
|
|
2015-12-21 15:42:33 +10:00
|
|
|
litest_assert_double_eq(last_x, libinput_max_x);
|
|
|
|
|
litest_assert_double_eq(last_y, 0);
|
2015-02-16 22:48:40 -05:00
|
|
|
|
2015-12-21 15:42:33 +10:00
|
|
|
libinput_event_destroy(event);
|
2015-02-16 22:48:40 -05:00
|
|
|
|
2017-03-07 16:00:45 +10:00
|
|
|
/* work around smoothing */
|
|
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 9);
|
|
|
|
|
litest_tablet_motion(dev, 100, 0, axes);
|
|
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 7);
|
|
|
|
|
litest_tablet_motion(dev, 100, 0, axes);
|
|
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 10);
|
|
|
|
|
litest_tablet_motion(dev, 100, 0, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 5);
|
2015-02-16 22:48:40 -05:00
|
|
|
litest_tablet_motion(dev, 100, 0, axes);
|
2015-12-21 15:42:33 +10:00
|
|
|
libinput_dispatch(li);
|
2015-02-16 22:48:40 -05:00
|
|
|
|
2015-12-21 15:42:33 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
2015-02-16 22:48:40 -05:00
|
|
|
|
2015-12-21 15:42:33 +10:00
|
|
|
x = libinput_event_tablet_tool_get_x(tablet_event);
|
|
|
|
|
y = libinput_event_tablet_tool_get_y(tablet_event);
|
2015-02-16 22:48:40 -05:00
|
|
|
|
2015-12-21 15:42:33 +10:00
|
|
|
litest_assert_double_eq(x, 0);
|
|
|
|
|
litest_assert_double_eq(y, libinput_max_y);
|
2015-02-16 22:48:40 -05:00
|
|
|
|
2015-12-21 15:42:33 +10:00
|
|
|
litest_assert_double_lt(x, last_x);
|
|
|
|
|
litest_assert_double_gt(y, last_y);
|
|
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
2015-02-19 12:56:43 +10:00
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(no_left_handed)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
|
|
|
|
|
ck_assert(!libinput_device_config_left_handed_is_available(dev->libinput_device));
|
2015-02-16 22:48:40 -05:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-12-15 13:58:01 +10:00
|
|
|
START_TEST(left_handed_tilt)
|
|
|
|
|
{
|
|
|
|
|
#if HAVE_LIBWACOM
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
enum libinput_config_status status;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2015-12-15 13:58:01 +10:00
|
|
|
{ ABS_TILT_X, 90 },
|
|
|
|
|
{ ABS_TILT_Y, 10 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
double tx, ty;
|
|
|
|
|
|
|
|
|
|
status = libinput_device_config_left_handed_set(dev->libinput_device, 1);
|
|
|
|
|
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
|
|
|
|
tx = libinput_event_tablet_tool_get_tilt_x(tev);
|
|
|
|
|
ty = libinput_event_tablet_tool_get_tilt_y(tev);
|
|
|
|
|
|
|
|
|
|
ck_assert_double_lt(tx, 0);
|
|
|
|
|
ck_assert_double_gt(ty, 0);
|
|
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2016-02-01 14:51:14 +10:00
|
|
|
static inline double
|
|
|
|
|
rotate_event(struct litest_device *dev, int angle_degrees)
|
|
|
|
|
{
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
const struct input_absinfo *abs;
|
|
|
|
|
double a = (angle_degrees - 90 - 175)/180.0 * M_PI;
|
|
|
|
|
double val;
|
|
|
|
|
int x, y;
|
|
|
|
|
int tilt_center_x, tilt_center_y;
|
|
|
|
|
|
|
|
|
|
abs = libevdev_get_abs_info(dev->evdev, ABS_TILT_X);
|
|
|
|
|
ck_assert_notnull(abs);
|
|
|
|
|
tilt_center_x = (abs->maximum - abs->minimum + 1) / 2;
|
|
|
|
|
|
|
|
|
|
abs = libevdev_get_abs_info(dev->evdev, ABS_TILT_Y);
|
|
|
|
|
ck_assert_notnull(abs);
|
|
|
|
|
tilt_center_y = (abs->maximum - abs->minimum + 1) / 2;
|
|
|
|
|
|
|
|
|
|
x = cos(a) * 20 + tilt_center_x;
|
|
|
|
|
y = sin(a) * 20 + tilt_center_y;
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_TILT_X, x);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_TILT_Y, y);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
ck_assert(libinput_event_tablet_tool_rotation_has_changed(tev));
|
|
|
|
|
val = libinput_event_tablet_tool_get_rotation(tev);
|
|
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
START_TEST(left_handed_mouse_rotation)
|
|
|
|
|
{
|
|
|
|
|
#if HAVE_LIBWACOM
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
enum libinput_config_status status;
|
|
|
|
|
int angle;
|
|
|
|
|
double val, old_val = 0;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
|
|
|
|
{ ABS_PRESSURE, 0 },
|
|
|
|
|
{ ABS_TILT_X, 0 },
|
|
|
|
|
{ ABS_TILT_Y, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
status = libinput_device_config_left_handed_set(dev->libinput_device, 1);
|
|
|
|
|
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_push_event_frame(dev);
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_filter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
2016-02-01 14:51:14 +10:00
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1);
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_unfilter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
2016-02-01 14:51:14 +10:00
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* cos/sin are 90 degrees offset from the north-is-zero that
|
|
|
|
|
libinput uses. 175 is the CCW offset in the mouse HW */
|
|
|
|
|
for (angle = 185; angle < 540; angle += 5) {
|
|
|
|
|
int expected_angle = angle - 180;
|
|
|
|
|
|
|
|
|
|
val = rotate_event(dev, angle % 360);
|
|
|
|
|
|
|
|
|
|
/* rounding error galore, we can't test for anything more
|
|
|
|
|
precise than these */
|
|
|
|
|
litest_assert_double_lt(val, 360.0);
|
|
|
|
|
litest_assert_double_gt(val, old_val);
|
|
|
|
|
litest_assert_double_lt(val, expected_angle + 5);
|
|
|
|
|
|
|
|
|
|
old_val = val;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2016-02-01 15:05:03 +10:00
|
|
|
START_TEST(left_handed_artpen_rotation)
|
|
|
|
|
{
|
|
|
|
|
#if HAVE_LIBWACOM
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
const struct input_absinfo *abs;
|
|
|
|
|
enum libinput_config_status status;
|
|
|
|
|
double val;
|
|
|
|
|
double scale;
|
|
|
|
|
int angle;
|
|
|
|
|
|
|
|
|
|
if (!libevdev_has_event_code(dev->evdev,
|
|
|
|
|
EV_ABS,
|
|
|
|
|
ABS_Z))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
status = libinput_device_config_left_handed_set(dev->libinput_device, 1);
|
|
|
|
|
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
abs = libevdev_get_abs_info(dev->evdev, ABS_Z);
|
|
|
|
|
ck_assert_notnull(abs);
|
|
|
|
|
scale = (abs->maximum - abs->minimum + 1)/360.0;
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_BRUSH, 1);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_MISC, 0x804); /* Art Pen */
|
|
|
|
|
litest_event(dev, EV_MSC, MSC_SERIAL, 1000);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_Z, abs->minimum);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
for (angle = 188; angle < 540; angle += 8) {
|
|
|
|
|
int a = angle * scale + abs->minimum;
|
|
|
|
|
int expected_angle = angle - 180;
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_Z, a);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
ck_assert(libinput_event_tablet_tool_rotation_has_changed(tev));
|
|
|
|
|
val = libinput_event_tablet_tool_get_rotation(tev);
|
|
|
|
|
|
|
|
|
|
/* artpen has a 90 deg offset cw */
|
|
|
|
|
ck_assert_int_eq(round(val), (expected_angle + 90) % 360);
|
|
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2014-06-26 21:31:53 -04:00
|
|
|
START_TEST(motion_event_state)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
2014-06-26 21:31:53 -04:00
|
|
|
int test_x, test_y;
|
|
|
|
|
double last_x, last_y;
|
|
|
|
|
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2014-06-26 21:31:53 -04:00
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
litest_tablet_proximity_in(dev, 5, 100, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* couple of events that go left/bottom to right/top */
|
|
|
|
|
for (test_x = 0, test_y = 100; test_x < 100; test_x += 10, test_y -= 10)
|
2015-02-16 22:48:45 -05:00
|
|
|
litest_tablet_motion(dev, test_x, test_y, axes);
|
2014-06-26 21:31:53 -04:00
|
|
|
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
2017-01-06 12:46:53 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
2014-06-26 21:31:53 -04:00
|
|
|
|
2015-12-14 09:51:11 +10:00
|
|
|
last_x = libinput_event_tablet_tool_get_x(tablet_event);
|
|
|
|
|
last_y = libinput_event_tablet_tool_get_y(tablet_event);
|
2014-06-26 21:31:53 -04:00
|
|
|
|
|
|
|
|
/* mark with a button event, then go back to bottom/left */
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
|
|
|
|
for (test_x = 100, test_y = 0; test_x > 0; test_x -= 10, test_y += 10)
|
2015-02-16 22:48:45 -05:00
|
|
|
litest_tablet_motion(dev, test_x, test_y, axes);
|
2014-06-26 21:31:53 -04:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
ck_assert_int_eq(libinput_next_event_type(li),
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
2014-06-26 21:31:53 -04:00
|
|
|
|
|
|
|
|
/* we expect all events up to the button event to go from
|
|
|
|
|
bottom/left to top/right */
|
|
|
|
|
while ((event = libinput_get_event(li))) {
|
|
|
|
|
double x, y;
|
|
|
|
|
|
2015-11-16 16:27:46 +10:00
|
|
|
if (libinput_event_get_type(event) != LIBINPUT_EVENT_TABLET_TOOL_AXIS)
|
2014-06-26 21:31:53 -04:00
|
|
|
break;
|
|
|
|
|
|
2015-11-16 16:28:55 +10:00
|
|
|
tablet_event = libinput_event_get_tablet_tool_event(event);
|
2014-06-26 21:31:53 -04:00
|
|
|
ck_assert_notnull(tablet_event);
|
|
|
|
|
|
2015-12-14 09:51:11 +10:00
|
|
|
x = libinput_event_tablet_tool_get_x(tablet_event);
|
|
|
|
|
y = libinput_event_tablet_tool_get_y(tablet_event);
|
2014-06-26 21:31:53 -04:00
|
|
|
|
|
|
|
|
ck_assert(x > last_x);
|
|
|
|
|
ck_assert(y < last_y);
|
|
|
|
|
|
|
|
|
|
last_x = x;
|
|
|
|
|
last_y = y;
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ck_assert_int_eq(libinput_event_get_type(event),
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_BUTTON);
|
2014-06-26 21:31:53 -04:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2016-02-11 14:32:33 +10:00
|
|
|
START_TEST(motion_outside_bounds)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
|
|
|
|
double val;
|
2017-03-07 16:00:45 +10:00
|
|
|
int i;
|
2016-02-11 14:32:33 +10:00
|
|
|
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
|
|
|
|
{ ABS_PRESSURE, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 50, 50, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2017-03-07 16:00:45 +10:00
|
|
|
/* Work around smoothing */
|
|
|
|
|
for (i = 5; i > 0; i--) {
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_X, 0 + 5 * i);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_Y, 1000);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
}
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2016-02-11 14:32:33 +10:00
|
|
|
/* On the 24HD x/y of 0 is outside the limit */
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_X, 0);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_Y, 1000);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
val = libinput_event_tablet_tool_get_x(tablet_event);
|
|
|
|
|
ck_assert_double_lt(val, 0.0);
|
|
|
|
|
val = libinput_event_tablet_tool_get_y(tablet_event);
|
|
|
|
|
ck_assert_double_gt(val, 0.0);
|
|
|
|
|
|
|
|
|
|
val = libinput_event_tablet_tool_get_x_transformed(tablet_event, 100);
|
|
|
|
|
ck_assert_double_lt(val, 0.0);
|
|
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2017-03-07 16:00:45 +10:00
|
|
|
/* Work around smoothing */
|
|
|
|
|
for (i = 5; i > 0; i--) {
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_X, 1000);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_Y, 0 + 5 * i);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
}
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2016-02-11 14:32:33 +10:00
|
|
|
/* On the 24HD x/y of 0 is outside the limit */
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_X, 1000);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_Y, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
val = libinput_event_tablet_tool_get_x(tablet_event);
|
|
|
|
|
ck_assert_double_gt(val, 0.0);
|
|
|
|
|
val = libinput_event_tablet_tool_get_y(tablet_event);
|
|
|
|
|
ck_assert_double_lt(val, 0.0);
|
|
|
|
|
|
|
|
|
|
val = libinput_event_tablet_tool_get_y_transformed(tablet_event, 100);
|
|
|
|
|
ck_assert_double_lt(val, 0.0);
|
|
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2014-06-11 21:25:37 -04:00
|
|
|
START_TEST(bad_distance_events)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
const struct input_absinfo *absinfo;
|
2014-06-26 18:02:48 -04:00
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ -1, -1 },
|
|
|
|
|
};
|
2014-06-11 21:25:37 -04:00
|
|
|
|
2014-06-26 18:02:48 -04:00
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
2014-06-11 21:25:37 -04:00
|
|
|
litest_tablet_proximity_out(dev);
|
2015-11-12 08:32:34 +10:00
|
|
|
litest_drain_events(li);
|
2014-06-11 21:25:37 -04:00
|
|
|
|
|
|
|
|
absinfo = libevdev_get_abs_info(dev->evdev, ABS_DISTANCE);
|
2019-02-15 08:42:15 +10:00
|
|
|
ck_assert_notnull(absinfo);
|
2014-06-11 21:25:37 -04:00
|
|
|
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_DISTANCE, absinfo->maximum);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_DISTANCE, absinfo->minimum);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
2014-06-26 18:02:48 -04:00
|
|
|
litest_assert_empty_queue(li);
|
2014-06-11 21:25:37 -04:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-12-15 12:39:52 +10:00
|
|
|
START_TEST(tool_unique)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_tablet_tool *tool;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1);
|
|
|
|
|
litest_event(dev, EV_MSC, MSC_SERIAL, 1000);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
|
|
|
|
tool = libinput_event_tablet_tool_get_tool(tablet_event);
|
|
|
|
|
ck_assert(libinput_tablet_tool_is_unique(tool));
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2014-06-19 01:18:09 -04:00
|
|
|
START_TEST(tool_serial)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
2014-06-19 01:18:09 -04:00
|
|
|
struct libinput_event *event;
|
2015-11-16 15:34:19 +10:00
|
|
|
struct libinput_tablet_tool *tool;
|
2014-06-19 01:18:09 -04:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1);
|
|
|
|
|
litest_event(dev, EV_MSC, MSC_SERIAL, 1000);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
2015-12-21 15:42:33 +10:00
|
|
|
libinput_dispatch(li);
|
2014-06-19 01:18:09 -04:00
|
|
|
|
2015-02-17 08:17:37 +10:00
|
|
|
event = libinput_get_event(li);
|
2015-12-21 15:42:33 +10:00
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2015-11-16 16:28:55 +10:00
|
|
|
tool = libinput_event_tablet_tool_get_tool(tablet_event);
|
2015-11-16 16:35:03 +10:00
|
|
|
ck_assert_uint_eq(libinput_tablet_tool_get_serial(tool), 1000);
|
2015-02-17 08:17:37 +10:00
|
|
|
libinput_event_destroy(event);
|
2014-06-19 01:18:09 -04:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2017-01-16 10:57:56 +10:00
|
|
|
START_TEST(tool_id)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_tablet_tool *tool;
|
|
|
|
|
uint64_t tool_id;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, NULL);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
|
|
|
|
tool = libinput_event_tablet_tool_get_tool(tablet_event);
|
|
|
|
|
|
|
|
|
|
ck_assert_int_eq(libinput_device_get_id_vendor(dev->libinput_device),
|
|
|
|
|
VENDOR_ID_WACOM);
|
|
|
|
|
|
|
|
|
|
switch (libinput_device_get_id_product(dev->libinput_device)) {
|
|
|
|
|
case 0x27: /* Intuos 5 */
|
|
|
|
|
tool_id = 1050626;
|
|
|
|
|
break;
|
|
|
|
|
case 0xc6: /* Cintiq 12WX */
|
|
|
|
|
case 0xf4: /* Cintiq 24HD */
|
|
|
|
|
case 0x333: /* Cintiq 13HD */
|
2019-01-04 12:35:22 +10:00
|
|
|
case 0x350: /* Cintiq Pro 16 */
|
2017-01-16 10:57:56 +10:00
|
|
|
tool_id = 2083;
|
|
|
|
|
break;
|
2017-02-01 13:11:23 +10:00
|
|
|
default:
|
|
|
|
|
ck_abort();
|
2017-01-16 10:57:56 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ck_assert(tool_id == libinput_tablet_tool_get_tool_id(tool));
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2014-06-19 01:18:09 -04:00
|
|
|
START_TEST(serial_changes_tool)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
2014-06-19 01:18:09 -04:00
|
|
|
struct libinput_event *event;
|
2015-11-16 15:34:19 +10:00
|
|
|
struct libinput_tablet_tool *tool;
|
2014-06-19 01:18:09 -04:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1);
|
|
|
|
|
litest_event(dev, EV_MSC, MSC_SERIAL, 1000);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
2014-06-26 21:31:51 -04:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_PEN, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
2014-06-19 01:18:09 -04:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2014-06-26 21:31:51 -04:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1);
|
2014-06-19 01:18:09 -04:00
|
|
|
litest_event(dev, EV_MSC, MSC_SERIAL, 2000);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
2015-12-21 15:42:33 +10:00
|
|
|
libinput_dispatch(li);
|
2014-06-19 01:18:09 -04:00
|
|
|
|
2015-02-17 08:17:37 +10:00
|
|
|
event = libinput_get_event(li);
|
2015-12-21 15:42:33 +10:00
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2015-11-16 16:28:55 +10:00
|
|
|
tool = libinput_event_tablet_tool_get_tool(tablet_event);
|
2014-06-19 01:18:09 -04:00
|
|
|
|
2015-11-16 16:35:03 +10:00
|
|
|
ck_assert_uint_eq(libinput_tablet_tool_get_serial(tool), 2000);
|
2015-02-17 08:17:37 +10:00
|
|
|
libinput_event_destroy(event);
|
2014-06-19 01:18:09 -04:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(invalid_serials)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
2015-11-16 15:34:19 +10:00
|
|
|
struct libinput_tablet_tool *tool;
|
2014-06-19 01:18:09 -04:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1);
|
|
|
|
|
litest_event(dev, EV_MSC, MSC_SERIAL, 1000);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
2014-06-26 21:31:51 -04:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_PEN, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
2014-06-19 01:18:09 -04:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2014-06-26 21:31:51 -04:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1);
|
2014-06-19 01:18:09 -04:00
|
|
|
litest_event(dev, EV_MSC, MSC_SERIAL, -1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
while ((event = libinput_get_event(li))) {
|
|
|
|
|
if (libinput_event_get_type(event) ==
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY) {
|
2015-11-16 16:28:55 +10:00
|
|
|
tablet_event = libinput_event_get_tablet_tool_event(event);
|
|
|
|
|
tool = libinput_event_tablet_tool_get_tool(tablet_event);
|
2014-06-19 01:18:09 -04:00
|
|
|
|
2015-11-16 16:35:03 +10:00
|
|
|
ck_assert_uint_eq(libinput_tablet_tool_get_serial(tool), 1000);
|
2014-06-26 21:31:51 -04:00
|
|
|
}
|
2014-06-19 01:18:09 -04:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2014-06-27 11:05:30 +10:00
|
|
|
START_TEST(tool_ref)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
2014-06-27 11:05:30 +10:00
|
|
|
struct libinput_event *event;
|
2015-11-16 15:34:19 +10:00
|
|
|
struct libinput_tablet_tool *tool;
|
2014-06-27 11:05:30 +10:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1);
|
|
|
|
|
litest_event(dev, EV_MSC, MSC_SERIAL, 1000);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
2015-12-21 15:42:33 +10:00
|
|
|
libinput_dispatch(li);
|
2014-06-27 11:05:30 +10:00
|
|
|
|
2015-02-17 08:22:24 +10:00
|
|
|
event = libinput_get_event(li);
|
2015-12-21 15:42:33 +10:00
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2015-11-16 16:28:55 +10:00
|
|
|
tool = libinput_event_tablet_tool_get_tool(tablet_event);
|
2014-06-27 11:05:30 +10:00
|
|
|
|
|
|
|
|
ck_assert_notnull(tool);
|
2015-11-16 16:35:03 +10:00
|
|
|
ck_assert(tool == libinput_tablet_tool_ref(tool));
|
|
|
|
|
ck_assert(tool == libinput_tablet_tool_unref(tool));
|
2014-06-27 11:05:30 +10:00
|
|
|
libinput_event_destroy(event);
|
2016-05-24 14:37:54 +10:00
|
|
|
|
|
|
|
|
ck_assert(libinput_tablet_tool_unref(tool) == NULL);
|
2014-06-27 11:05:30 +10:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2017-01-16 09:29:29 +10:00
|
|
|
START_TEST(tool_user_data)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_tablet_tool *tool;
|
|
|
|
|
void *userdata = &dev; /* not dereferenced */
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1);
|
|
|
|
|
litest_event(dev, EV_MSC, MSC_SERIAL, 1000);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
|
|
|
|
tool = libinput_event_tablet_tool_get_tool(tablet_event);
|
|
|
|
|
ck_assert_notnull(tool);
|
|
|
|
|
|
|
|
|
|
ck_assert(libinput_tablet_tool_get_user_data(tool) == NULL);
|
|
|
|
|
libinput_tablet_tool_set_user_data(tool, userdata);
|
|
|
|
|
ck_assert(libinput_tablet_tool_get_user_data(tool) == userdata);
|
|
|
|
|
libinput_tablet_tool_set_user_data(tool, NULL);
|
|
|
|
|
ck_assert(libinput_tablet_tool_get_user_data(tool) == NULL);
|
|
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2014-06-20 14:51:28 +10:00
|
|
|
START_TEST(pad_buttons_ignored)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2014-06-20 14:51:28 +10:00
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
int button;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
for (button = BTN_0; button < BTN_MOUSE; button++) {
|
|
|
|
|
litest_event(dev, EV_KEY, button, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_event(dev, EV_KEY, button, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-06 12:46:53 +10:00
|
|
|
litest_assert_empty_queue(li);
|
2014-06-20 14:51:28 +10:00
|
|
|
|
|
|
|
|
/* same thing while in prox */
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
2017-01-06 12:46:53 +10:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2018-08-27 16:31:12 +10:00
|
|
|
for (button = BTN_0; button < BTN_MOUSE; button++)
|
2014-06-20 14:51:28 +10:00
|
|
|
litest_event(dev, EV_KEY, button, 1);
|
2018-08-27 16:31:12 +10:00
|
|
|
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
for (button = BTN_0; button < BTN_MOUSE; button++)
|
2014-06-20 14:51:28 +10:00
|
|
|
litest_event(dev, EV_KEY, button, 0);
|
2018-08-27 16:31:12 +10:00
|
|
|
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
2014-06-20 14:51:28 +10:00
|
|
|
|
2017-01-06 12:46:53 +10:00
|
|
|
litest_assert_empty_queue(li);
|
2014-06-20 14:51:28 +10:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2014-08-07 19:00:52 -04:00
|
|
|
START_TEST(tools_with_serials)
|
|
|
|
|
{
|
|
|
|
|
struct libinput *li = litest_create_context();
|
|
|
|
|
struct litest_device *dev[2];
|
2015-11-16 15:34:19 +10:00
|
|
|
struct libinput_tablet_tool *tool[2] = {0};
|
2014-08-07 19:00:52 -04:00
|
|
|
struct libinput_event *event;
|
2015-12-15 12:53:00 +10:00
|
|
|
struct libinput_event_tablet_tool *tev;
|
2014-08-07 19:00:52 -04:00
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 2; i++) {
|
2016-07-06 12:34:50 +10:00
|
|
|
dev[i] = litest_add_device(li, LITEST_WACOM_INTUOS);
|
2015-12-15 12:53:00 +10:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2014-09-22 15:48:22 +10:00
|
|
|
/* WARNING: this test fails if UI_GET_SYSNAME isn't
|
|
|
|
|
* available or isn't used by libevdev (1.3, commit 2ff45c73).
|
|
|
|
|
* Put a sleep(1) here and that usually fixes it.
|
|
|
|
|
*/
|
2014-08-07 19:00:52 -04:00
|
|
|
|
2015-12-15 12:50:30 +10:00
|
|
|
litest_push_event_frame(dev[i]);
|
|
|
|
|
litest_tablet_proximity_in(dev[i], 10, 10, NULL);
|
2014-08-07 19:00:52 -04:00
|
|
|
litest_event(dev[i], EV_MSC, MSC_SERIAL, 100);
|
2015-12-15 12:50:30 +10:00
|
|
|
litest_pop_event_frame(dev[i]);
|
2014-08-07 19:00:52 -04:00
|
|
|
|
|
|
|
|
libinput_dispatch(li);
|
2015-12-15 12:53:00 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
|
|
|
|
tool[i] = libinput_event_tablet_tool_get_tool(tev);
|
|
|
|
|
libinput_event_destroy(event);
|
2014-08-07 19:00:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We should get the same object for both devices */
|
|
|
|
|
ck_assert_notnull(tool[0]);
|
|
|
|
|
ck_assert_notnull(tool[1]);
|
|
|
|
|
ck_assert_ptr_eq(tool[0], tool[1]);
|
|
|
|
|
|
|
|
|
|
litest_delete_device(dev[0]);
|
|
|
|
|
litest_delete_device(dev[1]);
|
|
|
|
|
libinput_unref(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(tools_without_serials)
|
|
|
|
|
{
|
|
|
|
|
struct libinput *li = litest_create_context();
|
|
|
|
|
struct litest_device *dev[2];
|
2015-11-16 15:34:19 +10:00
|
|
|
struct libinput_tablet_tool *tool[2] = {0};
|
2014-08-07 19:00:52 -04:00
|
|
|
struct libinput_event *event;
|
2015-12-15 12:53:00 +10:00
|
|
|
struct libinput_event_tablet_tool *tev;
|
2014-08-07 19:00:52 -04:00
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
|
dev[i] = litest_add_device_with_overrides(li,
|
|
|
|
|
LITEST_WACOM_ISDV4,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL);
|
|
|
|
|
|
2015-12-15 12:53:00 +10:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2014-09-22 15:48:22 +10:00
|
|
|
/* WARNING: this test fails if UI_GET_SYSNAME isn't
|
|
|
|
|
* available or isn't used by libevdev (1.3, commit 2ff45c73).
|
|
|
|
|
* Put a sleep(1) here and that usually fixes it.
|
|
|
|
|
*/
|
|
|
|
|
|
2015-12-15 12:50:30 +10:00
|
|
|
litest_tablet_proximity_in(dev[i], 10, 10, NULL);
|
2014-08-07 19:00:52 -04:00
|
|
|
|
|
|
|
|
libinput_dispatch(li);
|
2015-12-15 12:53:00 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
|
|
|
|
tool[i] = libinput_event_tablet_tool_get_tool(tev);
|
|
|
|
|
libinput_event_destroy(event);
|
2014-08-07 19:00:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We should get different tool objects for each device */
|
|
|
|
|
ck_assert_notnull(tool[0]);
|
|
|
|
|
ck_assert_notnull(tool[1]);
|
|
|
|
|
ck_assert_ptr_ne(tool[0], tool[1]);
|
|
|
|
|
|
|
|
|
|
litest_delete_device(dev[0]);
|
|
|
|
|
litest_delete_device(dev[1]);
|
|
|
|
|
libinput_unref(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2016-08-29 15:14:55 +10:00
|
|
|
START_TEST(tool_delayed_serial)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
struct libinput_tablet_tool *tool;
|
|
|
|
|
unsigned int serial;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_X, 4500);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_Y, 2000);
|
|
|
|
|
litest_event(dev, EV_MSC, MSC_SERIAL, 0);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
|
|
|
|
tool = libinput_event_tablet_tool_get_tool(tev);
|
|
|
|
|
serial = libinput_tablet_tool_get_serial(tool);
|
|
|
|
|
ck_assert_int_eq(serial, 0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
for (int x = 4500; x < 8000; x += 1000) {
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_X, x);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_Y, 2000);
|
|
|
|
|
litest_event(dev, EV_MSC, MSC_SERIAL, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
}
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* Now send the serial */
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_X, 4500);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_Y, 2000);
|
|
|
|
|
litest_event(dev, EV_MSC, MSC_SERIAL, 1234566);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
tool = libinput_event_tablet_tool_get_tool(tev);
|
|
|
|
|
serial = libinput_tablet_tool_get_serial(tool);
|
|
|
|
|
ck_assert_int_eq(serial, 0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
for (int x = 4500; x < 8000; x += 500) {
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_X, x);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_Y, 2000);
|
|
|
|
|
litest_event(dev, EV_MSC, MSC_SERIAL, 1234566);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
do {
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
tool = libinput_event_tablet_tool_get_tool(tev);
|
|
|
|
|
serial = libinput_tablet_tool_get_serial(tool);
|
|
|
|
|
ck_assert_int_eq(serial, 0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
} while (event != NULL);
|
|
|
|
|
|
|
|
|
|
/* Quirk: tool out event is a serial of 0 */
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_X, 4500);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_Y, 2000);
|
|
|
|
|
litest_event(dev, EV_MSC, MSC_SERIAL, 0);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_PEN, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
|
|
|
|
tool = libinput_event_tablet_tool_get_tool(tev);
|
|
|
|
|
serial = libinput_tablet_tool_get_serial(tool);
|
|
|
|
|
ck_assert_int_eq(serial, 0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2017-01-13 16:44:15 +10:00
|
|
|
START_TEST(tool_capability)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput_device *device = dev->libinput_device;
|
|
|
|
|
|
|
|
|
|
ck_assert(libinput_device_has_capability(device,
|
|
|
|
|
LIBINPUT_DEVICE_CAP_TABLET_TOOL));
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2014-08-07 22:02:22 -04:00
|
|
|
START_TEST(tool_capabilities)
|
|
|
|
|
{
|
|
|
|
|
struct libinput *li = litest_create_context();
|
|
|
|
|
struct litest_device *intuos;
|
|
|
|
|
struct litest_device *bamboo;
|
|
|
|
|
struct libinput_event *event;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *t;
|
2015-11-16 15:34:19 +10:00
|
|
|
struct libinput_tablet_tool *tool;
|
2014-08-07 22:02:22 -04:00
|
|
|
|
|
|
|
|
/* The axis capabilities of a tool can differ depending on the type of
|
|
|
|
|
* tablet the tool is being used with */
|
2015-02-26 13:41:19 +10:00
|
|
|
bamboo = litest_add_device(li, LITEST_WACOM_BAMBOO);
|
|
|
|
|
intuos = litest_add_device(li, LITEST_WACOM_INTUOS);
|
2015-12-21 15:42:33 +10:00
|
|
|
litest_drain_events(li);
|
2014-08-07 22:02:22 -04:00
|
|
|
|
|
|
|
|
litest_event(bamboo, EV_KEY, BTN_TOOL_PEN, 1);
|
|
|
|
|
litest_event(bamboo, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
2015-02-26 13:41:19 +10:00
|
|
|
event = libinput_get_event(li);
|
2015-12-21 15:42:33 +10:00
|
|
|
t = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2015-11-16 16:28:55 +10:00
|
|
|
tool = libinput_event_tablet_tool_get_tool(t);
|
2015-02-26 13:41:19 +10:00
|
|
|
|
2015-12-14 10:06:56 +10:00
|
|
|
ck_assert(libinput_tablet_tool_has_pressure(tool));
|
|
|
|
|
ck_assert(libinput_tablet_tool_has_distance(tool));
|
|
|
|
|
ck_assert(!libinput_tablet_tool_has_tilt(tool));
|
2015-02-26 13:41:19 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
litest_assert_empty_queue(li);
|
2014-08-07 22:02:22 -04:00
|
|
|
|
|
|
|
|
litest_event(intuos, EV_KEY, BTN_TOOL_PEN, 1);
|
|
|
|
|
litest_event(intuos, EV_SYN, SYN_REPORT, 0);
|
2015-12-21 15:42:33 +10:00
|
|
|
libinput_dispatch(li);
|
2014-08-07 22:02:22 -04:00
|
|
|
|
2015-02-26 13:41:19 +10:00
|
|
|
event = libinput_get_event(li);
|
2015-12-21 15:42:33 +10:00
|
|
|
t = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
|
|
|
|
tool = libinput_event_tablet_tool_get_tool(t);
|
2015-02-26 13:41:19 +10:00
|
|
|
|
2015-12-14 10:06:56 +10:00
|
|
|
ck_assert(libinput_tablet_tool_has_pressure(tool));
|
|
|
|
|
ck_assert(libinput_tablet_tool_has_distance(tool));
|
|
|
|
|
ck_assert(libinput_tablet_tool_has_tilt(tool));
|
2015-02-26 13:41:19 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
litest_assert_empty_queue(li);
|
2014-08-07 22:02:22 -04:00
|
|
|
|
|
|
|
|
litest_delete_device(bamboo);
|
|
|
|
|
litest_delete_device(intuos);
|
|
|
|
|
libinput_unref(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2018-02-05 10:08:47 +10:00
|
|
|
static inline bool
|
|
|
|
|
tablet_has_mouse(struct litest_device *dev)
|
|
|
|
|
{
|
|
|
|
|
return libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_MOUSE) &&
|
|
|
|
|
libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_WACOM;
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-09 11:09:11 +10:00
|
|
|
START_TEST(tool_type)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *t;
|
|
|
|
|
struct libinput_tablet_tool *tool;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
|
|
|
|
{ ABS_PRESSURE, 0 },
|
|
|
|
|
{ ABS_TILT_X, 0 },
|
|
|
|
|
{ ABS_TILT_Y, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
struct tool_type_match {
|
|
|
|
|
int code;
|
|
|
|
|
enum libinput_tablet_tool_type type;
|
|
|
|
|
} types[] = {
|
|
|
|
|
{ BTN_TOOL_PEN, LIBINPUT_TABLET_TOOL_TYPE_PEN },
|
|
|
|
|
{ BTN_TOOL_RUBBER, LIBINPUT_TABLET_TOOL_TYPE_ERASER },
|
|
|
|
|
{ BTN_TOOL_BRUSH, LIBINPUT_TABLET_TOOL_TYPE_BRUSH },
|
|
|
|
|
{ BTN_TOOL_BRUSH, LIBINPUT_TABLET_TOOL_TYPE_BRUSH },
|
|
|
|
|
{ BTN_TOOL_PENCIL, LIBINPUT_TABLET_TOOL_TYPE_PENCIL },
|
|
|
|
|
{ BTN_TOOL_AIRBRUSH, LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH },
|
|
|
|
|
{ BTN_TOOL_MOUSE, LIBINPUT_TABLET_TOOL_TYPE_MOUSE },
|
|
|
|
|
{ BTN_TOOL_LENS, LIBINPUT_TABLET_TOOL_TYPE_LENS },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
struct tool_type_match *tt;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
for (tt = types; tt->code != -1; tt++) {
|
|
|
|
|
if (!libevdev_has_event_code(dev->evdev,
|
|
|
|
|
EV_KEY,
|
|
|
|
|
tt->code))
|
|
|
|
|
continue;
|
|
|
|
|
|
2018-02-05 10:08:47 +10:00
|
|
|
if ((tt->code == BTN_TOOL_MOUSE || tt->code == BTN_TOOL_LENS) &&
|
|
|
|
|
!tablet_has_mouse(dev))
|
|
|
|
|
continue;
|
|
|
|
|
|
2017-02-09 11:09:11 +10:00
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_filter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
|
|
|
|
litest_tablet_proximity_in(dev, 50, 50, axes);
|
|
|
|
|
litest_unfilter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
|
|
|
|
litest_event(dev, EV_KEY, tt->code, 1);
|
|
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
t = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
|
|
|
|
tool = libinput_event_tablet_tool_get_tool(t);
|
|
|
|
|
|
|
|
|
|
ck_assert_int_eq(libinput_tablet_tool_get_type(tool),
|
|
|
|
|
tt->type);
|
|
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_filter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
|
|
|
|
litest_tablet_proximity_out(dev);
|
|
|
|
|
litest_unfilter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
|
|
|
|
litest_event(dev, EV_KEY, tt->code, 0);
|
|
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-02-26 13:55:08 +10:00
|
|
|
START_TEST(tool_in_prox_before_start)
|
|
|
|
|
{
|
|
|
|
|
struct libinput *li;
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput_event *event;
|
2016-02-02 13:23:03 +10:00
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
struct libinput_tablet_tool *tool;
|
2015-02-26 13:55:08 +10:00
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2015-02-26 13:55:08 +10:00
|
|
|
{ ABS_TILT_X, 0 },
|
|
|
|
|
{ ABS_TILT_Y, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
const char *devnode;
|
2016-02-02 13:23:03 +10:00
|
|
|
unsigned int serial;
|
2015-02-26 13:55:08 +10:00
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
|
|
|
|
|
/* for simplicity, we create a new litest context */
|
|
|
|
|
devnode = libevdev_uinput_get_devnode(dev->uinput);
|
|
|
|
|
li = litest_create_context();
|
|
|
|
|
libinput_path_add_device(li, devnode);
|
|
|
|
|
|
2019-02-12 11:59:09 +10:00
|
|
|
litest_drain_events_of_type(li, LIBINPUT_EVENT_DEVICE_ADDED, -1);
|
2015-02-26 13:55:08 +10:00
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_motion(dev, 10, 20, axes);
|
2016-02-02 13:23:03 +10:00
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
|
|
|
|
tool = libinput_event_tablet_tool_get_tool(tev);
|
|
|
|
|
serial = libinput_tablet_tool_get_serial(tool);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2015-02-26 13:55:08 +10:00
|
|
|
litest_tablet_motion(dev, 30, 40, axes);
|
2016-02-02 13:23:03 +10:00
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
tool = libinput_event_tablet_tool_get_tool(tev);
|
|
|
|
|
ck_assert_int_eq(serial,
|
|
|
|
|
libinput_tablet_tool_get_serial(tool));
|
|
|
|
|
libinput_event_destroy(event);
|
2015-02-26 13:55:08 +10:00
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_STYLUS, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
2015-11-16 16:27:46 +10:00
|
|
|
litest_assert_only_typed_events(li, LIBINPUT_EVENT_TABLET_TOOL_BUTTON);
|
2015-02-26 13:55:08 +10:00
|
|
|
litest_tablet_proximity_out(dev);
|
2016-12-22 12:11:43 +10:00
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
litest_timeout_tablet_proxout();
|
|
|
|
|
libinput_dispatch(li);
|
2015-02-26 13:55:08 +10:00
|
|
|
|
|
|
|
|
litest_wait_for_event_of_type(li,
|
2015-11-16 16:27:46 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY,
|
2015-02-26 13:55:08 +10:00
|
|
|
-1);
|
|
|
|
|
libinput_unref(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2019-04-01 15:29:37 +10:00
|
|
|
static void tool_switch_warning(struct libinput *libinput,
|
|
|
|
|
enum libinput_log_priority priority,
|
|
|
|
|
const char *format,
|
|
|
|
|
va_list args)
|
|
|
|
|
{
|
|
|
|
|
int *warning_triggered = (int*)libinput_get_user_data(libinput);
|
|
|
|
|
|
|
|
|
|
if (priority == LIBINPUT_LOG_PRIORITY_ERROR &&
|
|
|
|
|
strstr(format, "Tool directly switched"))
|
|
|
|
|
(*warning_triggered)++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
START_TEST(tool_direct_switch)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
|
|
|
|
{ ABS_PRESSURE, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
int warning_triggered = 0;
|
|
|
|
|
|
|
|
|
|
if (!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_RUBBER))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
libinput_set_user_data(li, &warning_triggered);
|
|
|
|
|
libinput_log_set_handler(li, tool_switch_warning);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_RUBBER, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
ck_assert_int_eq(warning_triggered, 1);
|
|
|
|
|
litest_restore_log_handler(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-02-19 17:18:58 +10:00
|
|
|
START_TEST(mouse_tool)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tev;
|
2015-11-16 15:34:19 +10:00
|
|
|
struct libinput_tablet_tool *tool;
|
2015-02-19 17:18:58 +10:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1);
|
|
|
|
|
litest_event(dev, EV_MSC, MSC_SERIAL, 1000);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
2015-12-21 15:42:33 +10:00
|
|
|
libinput_dispatch(li);
|
2015-02-19 17:18:58 +10:00
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
2015-12-21 15:42:33 +10:00
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2015-11-16 16:28:55 +10:00
|
|
|
tool = libinput_event_tablet_tool_get_tool(tev);
|
2015-02-19 17:18:58 +10:00
|
|
|
ck_assert_notnull(tool);
|
2015-11-16 16:35:03 +10:00
|
|
|
ck_assert_int_eq(libinput_tablet_tool_get_type(tool),
|
2015-11-16 15:40:43 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_TYPE_MOUSE);
|
2015-02-19 17:18:58 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(mouse_buttons)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tev;
|
2015-11-16 15:34:19 +10:00
|
|
|
struct libinput_tablet_tool *tool;
|
2015-02-19 17:18:58 +10:00
|
|
|
int code;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_MISC, 0x806); /* 5-button mouse tool_id */
|
|
|
|
|
litest_event(dev, EV_MSC, MSC_SERIAL, 1000);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
2015-12-21 15:42:33 +10:00
|
|
|
libinput_dispatch(li);
|
2015-02-19 17:18:58 +10:00
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
2015-12-21 15:42:33 +10:00
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2015-11-16 16:28:55 +10:00
|
|
|
tool = libinput_event_tablet_tool_get_tool(tev);
|
2015-02-19 17:18:58 +10:00
|
|
|
ck_assert_notnull(tool);
|
2015-11-16 16:35:03 +10:00
|
|
|
libinput_tablet_tool_ref(tool);
|
2015-02-19 17:18:58 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
for (code = BTN_LEFT; code <= BTN_TASK; code++) {
|
|
|
|
|
bool has_button = libevdev_has_event_code(dev->evdev,
|
|
|
|
|
EV_KEY,
|
|
|
|
|
code);
|
|
|
|
|
ck_assert_int_eq(!!has_button,
|
2015-11-16 16:35:03 +10:00
|
|
|
!!libinput_tablet_tool_has_button(tool, code));
|
2015-02-19 17:18:58 +10:00
|
|
|
|
|
|
|
|
if (!has_button)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, code, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_event(dev, EV_KEY, code, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
litest_assert_tablet_button_event(li,
|
|
|
|
|
code,
|
|
|
|
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_tablet_button_event(li,
|
|
|
|
|
code,
|
|
|
|
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-16 16:35:03 +10:00
|
|
|
libinput_tablet_tool_unref(tool);
|
2015-02-19 17:18:58 +10:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-02-16 15:19:44 +10:00
|
|
|
START_TEST(mouse_rotation)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
int angle;
|
|
|
|
|
double val, old_val = 0;
|
|
|
|
|
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2015-02-16 15:19:44 +10:00
|
|
|
{ ABS_TILT_X, 0 },
|
|
|
|
|
{ ABS_TILT_Y, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_push_event_frame(dev);
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_filter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
2015-02-16 15:19:44 +10:00
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1);
|
2019-04-05 15:49:31 +10:00
|
|
|
litest_unfilter_event(dev, EV_KEY, BTN_TOOL_PEN);
|
2015-02-16 15:19:44 +10:00
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* cos/sin are 90 degrees offset from the north-is-zero that
|
|
|
|
|
libinput uses. 175 is the CCW offset in the mouse HW */
|
|
|
|
|
for (angle = 5; angle < 360; angle += 5) {
|
2016-02-01 14:51:14 +10:00
|
|
|
val = rotate_event(dev, angle);
|
2015-02-16 15:19:44 +10:00
|
|
|
|
|
|
|
|
/* rounding error galore, we can't test for anything more
|
|
|
|
|
precise than these */
|
|
|
|
|
litest_assert_double_lt(val, 360.0);
|
|
|
|
|
litest_assert_double_gt(val, old_val);
|
|
|
|
|
litest_assert_double_lt(val, angle + 5);
|
|
|
|
|
|
|
|
|
|
old_val = val;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-02-26 13:14:25 +10:00
|
|
|
START_TEST(mouse_wheel)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tev;
|
2015-11-16 15:34:19 +10:00
|
|
|
struct libinput_tablet_tool *tool;
|
2015-02-26 13:14:25 +10:00
|
|
|
const struct input_absinfo *abs;
|
|
|
|
|
double val;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (!libevdev_has_event_code(dev->evdev,
|
|
|
|
|
EV_REL,
|
|
|
|
|
REL_WHEEL))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_MOUSE, 1);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_MISC, 0x806); /* 5-button mouse tool_id */
|
|
|
|
|
litest_event(dev, EV_MSC, MSC_SERIAL, 1000);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
2015-12-21 15:42:33 +10:00
|
|
|
libinput_dispatch(li);
|
2015-02-26 13:14:25 +10:00
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
2015-12-21 15:42:33 +10:00
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2015-11-16 16:28:55 +10:00
|
|
|
tool = libinput_event_tablet_tool_get_tool(tev);
|
2015-02-26 13:14:25 +10:00
|
|
|
ck_assert_notnull(tool);
|
2015-11-16 16:35:03 +10:00
|
|
|
libinput_tablet_tool_ref(tool);
|
2015-02-26 13:14:25 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2015-12-14 10:06:56 +10:00
|
|
|
ck_assert(libinput_tablet_tool_has_wheel(tool));
|
2015-02-26 13:14:25 +10:00
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
|
litest_event(dev, EV_REL, REL_WHEEL, -1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
2015-12-21 15:42:33 +10:00
|
|
|
libinput_dispatch(li);
|
2015-02-26 13:14:25 +10:00
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
2015-12-21 15:42:33 +10:00
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
2015-12-14 09:05:37 +10:00
|
|
|
ck_assert(libinput_event_tablet_tool_wheel_has_changed(tev));
|
2015-02-26 13:14:25 +10:00
|
|
|
|
2015-12-14 10:23:56 +10:00
|
|
|
val = libinput_event_tablet_tool_get_wheel_delta(tev);
|
2015-02-26 13:14:25 +10:00
|
|
|
ck_assert_int_eq(val, 15);
|
|
|
|
|
|
2015-12-14 10:23:56 +10:00
|
|
|
val = libinput_event_tablet_tool_get_wheel_delta_discrete(tev);
|
2015-02-26 13:14:25 +10:00
|
|
|
ck_assert_int_eq(val, 1);
|
|
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 2; i < 5; i++) {
|
|
|
|
|
/* send x/y events to make sure we reset the wheel */
|
|
|
|
|
abs = libevdev_get_abs_info(dev->evdev, ABS_X);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_X, (abs->maximum - abs->minimum)/i);
|
|
|
|
|
abs = libevdev_get_abs_info(dev->evdev, ABS_Y);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_Y, (abs->maximum - abs->minimum)/i);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
2015-12-21 15:42:33 +10:00
|
|
|
libinput_dispatch(li);
|
2015-02-26 13:14:25 +10:00
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
2015-12-21 15:42:33 +10:00
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
2015-12-14 09:05:37 +10:00
|
|
|
ck_assert(!libinput_event_tablet_tool_wheel_has_changed(tev));
|
2015-02-26 13:14:25 +10:00
|
|
|
|
2015-12-14 10:23:56 +10:00
|
|
|
val = libinput_event_tablet_tool_get_wheel_delta(tev);
|
2015-02-26 13:14:25 +10:00
|
|
|
ck_assert_int_eq(val, 0);
|
|
|
|
|
|
2015-12-14 10:23:56 +10:00
|
|
|
val = libinput_event_tablet_tool_get_wheel_delta_discrete(tev);
|
2015-02-26 13:14:25 +10:00
|
|
|
ck_assert_int_eq(val, 0);
|
|
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-16 16:35:03 +10:00
|
|
|
libinput_tablet_tool_unref(tool);
|
2015-02-26 13:14:25 +10:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-02-17 13:04:06 +10:00
|
|
|
START_TEST(airbrush_tool)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tev;
|
2015-11-16 15:34:19 +10:00
|
|
|
struct libinput_tablet_tool *tool;
|
2015-02-17 13:04:06 +10:00
|
|
|
|
|
|
|
|
if (!libevdev_has_event_code(dev->evdev,
|
|
|
|
|
EV_KEY,
|
|
|
|
|
BTN_TOOL_AIRBRUSH))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_AIRBRUSH, 1);
|
|
|
|
|
litest_event(dev, EV_MSC, MSC_SERIAL, 1000);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
2015-12-21 15:42:33 +10:00
|
|
|
libinput_dispatch(li);
|
2015-02-17 13:04:06 +10:00
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
2015-12-21 15:42:33 +10:00
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2015-11-16 16:28:55 +10:00
|
|
|
tool = libinput_event_tablet_tool_get_tool(tev);
|
2015-12-21 15:42:33 +10:00
|
|
|
|
2015-02-17 13:04:06 +10:00
|
|
|
ck_assert_notnull(tool);
|
2015-11-16 16:35:03 +10:00
|
|
|
ck_assert_int_eq(libinput_tablet_tool_get_type(tool),
|
2015-11-16 15:40:43 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH);
|
2015-02-17 13:04:06 +10:00
|
|
|
|
2017-02-22 10:00:17 +10:00
|
|
|
ck_assert(libinput_tablet_tool_has_slider(tool));
|
|
|
|
|
|
2015-02-17 13:04:06 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2016-04-11 07:18:07 +10:00
|
|
|
START_TEST(airbrush_slider)
|
2015-02-17 13:04:06 +10:00
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tev;
|
2015-02-17 13:04:06 +10:00
|
|
|
const struct input_absinfo *abs;
|
|
|
|
|
double val;
|
|
|
|
|
double scale;
|
2016-04-11 07:18:07 +10:00
|
|
|
double expected;
|
2015-02-17 13:04:06 +10:00
|
|
|
int v;
|
|
|
|
|
|
|
|
|
|
if (!libevdev_has_event_code(dev->evdev,
|
|
|
|
|
EV_KEY,
|
|
|
|
|
BTN_TOOL_AIRBRUSH))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
abs = libevdev_get_abs_info(dev->evdev, ABS_WHEEL);
|
|
|
|
|
ck_assert_notnull(abs);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_AIRBRUSH, 1);
|
|
|
|
|
litest_event(dev, EV_MSC, MSC_SERIAL, 1000);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
|
|
|
|
/* start with non-zero */
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_WHEEL, 10);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
scale = abs->maximum - abs->minimum;
|
|
|
|
|
for (v = abs->minimum; v < abs->maximum; v += 8) {
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_WHEEL, v);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
2015-12-21 15:42:33 +10:00
|
|
|
libinput_dispatch(li);
|
2015-02-17 13:04:06 +10:00
|
|
|
event = libinput_get_event(li);
|
2015-12-21 15:42:33 +10:00
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
2015-12-14 09:05:37 +10:00
|
|
|
ck_assert(libinput_event_tablet_tool_slider_has_changed(tev));
|
2015-12-14 09:51:11 +10:00
|
|
|
val = libinput_event_tablet_tool_get_slider_position(tev);
|
2015-02-17 13:04:06 +10:00
|
|
|
|
2016-04-11 07:18:07 +10:00
|
|
|
expected = ((v - abs->minimum)/scale) * 2 - 1;
|
|
|
|
|
ck_assert_double_eq(val, expected);
|
|
|
|
|
ck_assert_double_ge(val, -1.0);
|
|
|
|
|
ck_assert_double_le(val, 1.0);
|
2015-02-17 13:04:06 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-02-18 11:40:55 +10:00
|
|
|
START_TEST(artpen_tool)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tev;
|
2015-11-16 15:34:19 +10:00
|
|
|
struct libinput_tablet_tool *tool;
|
2015-02-18 11:40:55 +10:00
|
|
|
|
|
|
|
|
if (!libevdev_has_event_code(dev->evdev,
|
|
|
|
|
EV_ABS,
|
|
|
|
|
ABS_Z))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_MISC, 0x804); /* Art Pen */
|
|
|
|
|
litest_event(dev, EV_MSC, MSC_SERIAL, 1000);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
2015-12-21 15:42:33 +10:00
|
|
|
libinput_dispatch(li);
|
2015-02-18 11:40:55 +10:00
|
|
|
event = libinput_get_event(li);
|
2015-12-21 15:42:33 +10:00
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2015-11-16 16:28:55 +10:00
|
|
|
tool = libinput_event_tablet_tool_get_tool(tev);
|
2015-02-18 11:40:55 +10:00
|
|
|
ck_assert_notnull(tool);
|
2015-11-16 16:35:03 +10:00
|
|
|
ck_assert_int_eq(libinput_tablet_tool_get_type(tool),
|
2015-11-16 15:40:43 +10:00
|
|
|
LIBINPUT_TABLET_TOOL_TYPE_PEN);
|
2015-12-14 10:06:56 +10:00
|
|
|
ck_assert(libinput_tablet_tool_has_rotation(tool));
|
2015-02-18 11:40:55 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(artpen_rotation)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tev;
|
2015-02-18 11:40:55 +10:00
|
|
|
const struct input_absinfo *abs;
|
|
|
|
|
double val;
|
|
|
|
|
double scale;
|
|
|
|
|
int angle;
|
|
|
|
|
|
|
|
|
|
if (!libevdev_has_event_code(dev->evdev,
|
|
|
|
|
EV_ABS,
|
|
|
|
|
ABS_Z))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
abs = libevdev_get_abs_info(dev->evdev, ABS_Z);
|
|
|
|
|
ck_assert_notnull(abs);
|
2015-02-20 12:03:52 +10:00
|
|
|
scale = (abs->maximum - abs->minimum + 1)/360.0;
|
2015-02-18 11:40:55 +10:00
|
|
|
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_BRUSH, 1);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_MISC, 0x804); /* Art Pen */
|
|
|
|
|
litest_event(dev, EV_MSC, MSC_SERIAL, 1000);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
2015-02-20 12:03:52 +10:00
|
|
|
litest_event(dev, EV_ABS, ABS_Z, abs->minimum);
|
2015-02-18 11:40:55 +10:00
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-02-20 12:03:52 +10:00
|
|
|
for (angle = 8; angle < 360; angle += 8) {
|
2015-02-18 11:40:55 +10:00
|
|
|
int a = angle * scale + abs->minimum;
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_Z, a);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
2015-12-21 15:42:33 +10:00
|
|
|
libinput_dispatch(li);
|
2015-02-18 11:40:55 +10:00
|
|
|
event = libinput_get_event(li);
|
2015-12-21 15:42:33 +10:00
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
2015-12-14 09:05:37 +10:00
|
|
|
ck_assert(libinput_event_tablet_tool_rotation_has_changed(tev));
|
2015-12-14 09:51:11 +10:00
|
|
|
val = libinput_event_tablet_tool_get_rotation(tev);
|
2015-02-18 11:40:55 +10:00
|
|
|
|
|
|
|
|
/* artpen has a 90 deg offset cw */
|
|
|
|
|
ck_assert_int_eq(round(val), (angle + 90) % 360);
|
2015-02-20 12:03:52 +10:00
|
|
|
|
2015-02-18 11:40:55 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
litest_assert_empty_queue(li);
|
2015-02-20 12:03:52 +10:00
|
|
|
|
2015-02-18 11:40:55 +10:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-08-12 15:50:38 +10:00
|
|
|
START_TEST(tablet_time_usec)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
2015-11-16 16:28:55 +10:00
|
|
|
struct libinput_event_tablet_tool *tev;
|
2015-08-12 15:50:38 +10:00
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2015-08-12 15:50:38 +10:00
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
2016-04-08 15:51:26 +08:00
|
|
|
uint64_t time_usec;
|
2015-08-12 15:50:38 +10:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 5, 100, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
2015-12-21 15:42:33 +10:00
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2016-04-08 15:51:26 +08:00
|
|
|
time_usec = libinput_event_tablet_tool_get_time_usec(tev);
|
2015-11-16 16:28:55 +10:00
|
|
|
ck_assert_int_eq(libinput_event_tablet_tool_get_time(tev),
|
2016-04-08 15:51:26 +08:00
|
|
|
(uint32_t) (time_usec / 1000));
|
2015-08-12 15:50:38 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-11-30 14:14:03 +10:00
|
|
|
START_TEST(tablet_pressure_distance_exclusive)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-11 17:40:36 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2015-11-30 14:14:03 +10:00
|
|
|
{ -1, -1 },
|
|
|
|
|
};
|
|
|
|
|
double pressure, distance;
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 5, 100, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-12-11 17:40:36 +10:00
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 2);
|
2015-11-30 14:14:03 +10:00
|
|
|
litest_tablet_motion(dev, 70, 70, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
2015-12-21 15:42:33 +10:00
|
|
|
tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
2015-11-30 14:14:03 +10:00
|
|
|
|
2015-12-14 09:51:11 +10:00
|
|
|
pressure = libinput_event_tablet_tool_get_pressure(tev);
|
|
|
|
|
distance = libinput_event_tablet_tool_get_distance(tev);
|
2015-11-30 14:14:03 +10:00
|
|
|
|
|
|
|
|
ck_assert_double_ne(pressure, 0.0);
|
2015-12-11 17:40:36 +10:00
|
|
|
ck_assert_double_eq(distance, 0.0);
|
2015-11-30 14:14:03 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-12-01 14:05:16 +10:00
|
|
|
START_TEST(tablet_calibration_has_matrix)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput_device *d = dev->libinput_device;
|
|
|
|
|
enum libinput_config_status status;
|
|
|
|
|
int rc;
|
|
|
|
|
float calibration[6] = {1, 0, 0, 0, 1, 0};
|
|
|
|
|
int has_calibration;
|
|
|
|
|
|
|
|
|
|
has_calibration = libevdev_has_property(dev->evdev, INPUT_PROP_DIRECT);
|
|
|
|
|
|
|
|
|
|
rc = libinput_device_config_calibration_has_matrix(d);
|
|
|
|
|
ck_assert_int_eq(rc, has_calibration);
|
|
|
|
|
rc = libinput_device_config_calibration_get_matrix(d, calibration);
|
|
|
|
|
ck_assert_int_eq(rc, 0);
|
|
|
|
|
rc = libinput_device_config_calibration_get_default_matrix(d,
|
|
|
|
|
calibration);
|
|
|
|
|
ck_assert_int_eq(rc, 0);
|
|
|
|
|
|
|
|
|
|
status = libinput_device_config_calibration_set_matrix(d,
|
|
|
|
|
calibration);
|
|
|
|
|
if (has_calibration)
|
|
|
|
|
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
|
|
|
|
else
|
|
|
|
|
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(tablet_calibration_set_matrix_delta)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_device *d = dev->libinput_device;
|
|
|
|
|
enum libinput_config_status status;
|
|
|
|
|
float calibration[6] = {0.5, 0, 0, 0, 0.5, 0};
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
|
|
|
|
struct axis_replacement axes[] = {
|
2016-08-23 08:00:15 +10:00
|
|
|
{ ABS_DISTANCE, 0 },
|
|
|
|
|
{ ABS_PRESSURE, 10 },
|
2015-12-01 14:05:16 +10:00
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
int has_calibration;
|
2015-12-14 10:28:05 +10:00
|
|
|
double x, y, dx, dy, mdx, mdy;
|
2015-12-01 14:05:16 +10:00
|
|
|
|
|
|
|
|
has_calibration = libevdev_has_property(dev->evdev, INPUT_PROP_DIRECT);
|
|
|
|
|
if (!has_calibration)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-12-14 10:28:05 +10:00
|
|
|
litest_tablet_proximity_in(dev, 100, 100, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2015-12-14 09:51:11 +10:00
|
|
|
x = libinput_event_tablet_tool_get_x(tablet_event);
|
|
|
|
|
y = libinput_event_tablet_tool_get_y(tablet_event);
|
2015-12-14 10:28:05 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2016-08-23 08:00:15 +10:00
|
|
|
event = libinput_get_event(li);
|
2017-07-06 16:45:41 +10:00
|
|
|
litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_TIP);
|
2016-08-23 08:00:15 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2015-12-01 14:05:16 +10:00
|
|
|
litest_tablet_motion(dev, 80, 80, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
|
2015-12-14 09:51:11 +10:00
|
|
|
dx = libinput_event_tablet_tool_get_x(tablet_event) - x;
|
|
|
|
|
dy = libinput_event_tablet_tool_get_y(tablet_event) - y;
|
2015-12-01 14:05:16 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
litest_tablet_proximity_out(dev);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
status = libinput_device_config_calibration_set_matrix(d,
|
|
|
|
|
calibration);
|
|
|
|
|
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 100, 100, axes);
|
2015-12-14 10:28:05 +10:00
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2015-12-14 09:51:11 +10:00
|
|
|
x = libinput_event_tablet_tool_get_x(tablet_event);
|
|
|
|
|
y = libinput_event_tablet_tool_get_y(tablet_event);
|
2015-12-14 10:28:05 +10:00
|
|
|
libinput_event_destroy(event);
|
2015-12-01 14:05:16 +10:00
|
|
|
|
2016-08-23 08:00:15 +10:00
|
|
|
event = libinput_get_event(li);
|
2017-07-06 16:45:41 +10:00
|
|
|
litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_TIP);
|
2016-08-23 08:00:15 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2015-12-01 14:05:16 +10:00
|
|
|
litest_tablet_motion(dev, 80, 80, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
|
2015-12-14 09:51:11 +10:00
|
|
|
mdx = libinput_event_tablet_tool_get_x(tablet_event) - x;
|
|
|
|
|
mdy = libinput_event_tablet_tool_get_y(tablet_event) - y;
|
2015-12-01 14:05:16 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
ck_assert_double_gt(dx, mdx * 2 - 1);
|
|
|
|
|
ck_assert_double_lt(dx, mdx * 2 + 1);
|
|
|
|
|
ck_assert_double_gt(dy, mdy * 2 - 1);
|
|
|
|
|
ck_assert_double_lt(dy, mdy * 2 + 1);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(tablet_calibration_set_matrix)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_device *d = dev->libinput_device;
|
|
|
|
|
enum libinput_config_status status;
|
|
|
|
|
float calibration[6] = {0.5, 0, 0, 0, 1, 0};
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tablet_event;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2015-12-01 14:05:16 +10:00
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
int has_calibration;
|
|
|
|
|
double x, y;
|
|
|
|
|
|
|
|
|
|
has_calibration = libevdev_has_property(dev->evdev, INPUT_PROP_DIRECT);
|
|
|
|
|
if (!has_calibration)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
status = libinput_device_config_calibration_set_matrix(d,
|
|
|
|
|
calibration);
|
|
|
|
|
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 100, 100, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
|
|
|
|
x = libinput_event_tablet_tool_get_x_transformed(tablet_event, 100);
|
|
|
|
|
y = libinput_event_tablet_tool_get_y_transformed(tablet_event, 100);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
ck_assert_double_gt(x, 49.0);
|
|
|
|
|
ck_assert_double_lt(x, 51.0);
|
|
|
|
|
ck_assert_double_gt(y, 99.0);
|
|
|
|
|
ck_assert_double_lt(y, 100.0);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_out(dev);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_tablet_proximity_in(dev, 50, 50, axes);
|
|
|
|
|
litest_tablet_proximity_out(dev);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
calibration[0] = 1;
|
|
|
|
|
calibration[4] = 0.5;
|
|
|
|
|
status = libinput_device_config_calibration_set_matrix(d,
|
|
|
|
|
calibration);
|
|
|
|
|
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 100, 100, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tablet_event = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
|
|
|
|
x = libinput_event_tablet_tool_get_x_transformed(tablet_event, 100);
|
|
|
|
|
y = libinput_event_tablet_tool_get_y_transformed(tablet_event, 100);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2016-02-11 13:52:55 +10:00
|
|
|
ck_assert(x > 99.0);
|
|
|
|
|
ck_assert(x < 100.0);
|
|
|
|
|
ck_assert(y > 49.0);
|
|
|
|
|
ck_assert(y < 51.0);
|
2015-12-01 14:05:16 +10:00
|
|
|
|
|
|
|
|
litest_tablet_proximity_out(dev);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-12-01 11:07:57 +10:00
|
|
|
START_TEST(tablet_pressure_offset)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 70 },
|
|
|
|
|
{ ABS_PRESSURE, 20 },
|
|
|
|
|
{ -1, -1 },
|
|
|
|
|
};
|
|
|
|
|
double pressure;
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 5, 100, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-12-14 08:05:32 +10:00
|
|
|
/* Put the pen down, with a pressure high enough to meet the
|
|
|
|
|
* threshold */
|
2015-12-21 10:53:29 +10:00
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 0);
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 25);
|
|
|
|
|
|
2015-12-01 11:07:57 +10:00
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 70, 70, axes);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 1);
|
|
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-12-14 08:05:32 +10:00
|
|
|
/* Reduce pressure to just a tick over the offset, otherwise we get
|
|
|
|
|
* the tip up event again */
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 20.1);
|
2015-12-01 11:07:57 +10:00
|
|
|
litest_tablet_motion(dev, 70, 70, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
2015-12-14 09:51:11 +10:00
|
|
|
pressure = libinput_event_tablet_tool_get_pressure(tev);
|
2015-12-14 08:05:32 +10:00
|
|
|
|
|
|
|
|
/* we can't actually get a real 0.0 because that would trigger a tip
|
|
|
|
|
* up. but it's close enough to zero that ck_assert_double_eq won't
|
|
|
|
|
* notice */
|
2015-12-01 11:07:57 +10:00
|
|
|
ck_assert_double_eq(pressure, 0.0);
|
|
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-12-21 10:53:29 +10:00
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 21);
|
2015-12-01 11:07:57 +10:00
|
|
|
litest_tablet_motion(dev, 70, 70, axes);
|
|
|
|
|
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
|
2015-12-14 09:51:11 +10:00
|
|
|
pressure = libinput_event_tablet_tool_get_pressure(tev);
|
2015-12-01 11:07:57 +10:00
|
|
|
|
|
|
|
|
/* can't use the double_eq here, the pressure value is too tiny */
|
|
|
|
|
ck_assert(pressure > 0.0);
|
|
|
|
|
ck_assert(pressure < 1.0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(tablet_pressure_offset_decrease)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 70 },
|
|
|
|
|
{ ABS_PRESSURE, 20 },
|
|
|
|
|
{ -1, -1 },
|
|
|
|
|
};
|
|
|
|
|
double pressure;
|
|
|
|
|
|
|
|
|
|
/* offset 20 on prox in */
|
|
|
|
|
litest_tablet_proximity_in(dev, 5, 100, axes);
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_tablet_proximity_out(dev);
|
2015-12-01 11:07:57 +10:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* a reduced pressure value must reduce the offset */
|
2015-12-21 10:53:29 +10:00
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 10);
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_tablet_proximity_in(dev, 5, 100, axes);
|
|
|
|
|
litest_tablet_proximity_out(dev);
|
|
|
|
|
litest_drain_events(li);
|
2015-12-01 11:07:57 +10:00
|
|
|
|
2015-12-14 08:05:32 +10:00
|
|
|
/* a reduced pressure value must reduce the offset */
|
|
|
|
|
litest_tablet_proximity_in(dev, 5, 100, axes);
|
|
|
|
|
libinput_dispatch(li);
|
2015-12-01 11:07:57 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
2015-12-14 08:05:32 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2015-12-14 09:51:11 +10:00
|
|
|
pressure = libinput_event_tablet_tool_get_pressure(tev);
|
2015-12-01 11:07:57 +10:00
|
|
|
ck_assert_double_eq(pressure, 0.0);
|
|
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-12-14 08:05:32 +10:00
|
|
|
/* trigger the pressure threshold */
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 15);
|
|
|
|
|
litest_push_event_frame(dev);
|
2015-12-01 11:07:57 +10:00
|
|
|
litest_tablet_motion(dev, 70, 70, axes);
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 1);
|
|
|
|
|
litest_pop_event_frame(dev);
|
2015-12-01 11:07:57 +10:00
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
2015-12-15 08:39:56 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_TIP);
|
2015-12-01 11:07:57 +10:00
|
|
|
|
2015-12-14 09:51:11 +10:00
|
|
|
pressure = libinput_event_tablet_tool_get_pressure(tev);
|
2015-12-01 11:07:57 +10:00
|
|
|
|
|
|
|
|
/* can't use the double_eq here, the pressure value is too tiny */
|
|
|
|
|
ck_assert(pressure > 0.0);
|
|
|
|
|
ck_assert(pressure < 1.0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(tablet_pressure_offset_increase)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 70 },
|
|
|
|
|
{ ABS_PRESSURE, 20 },
|
|
|
|
|
{ -1, -1 },
|
|
|
|
|
};
|
|
|
|
|
double pressure;
|
|
|
|
|
|
|
|
|
|
/* offset 20 on first prox in */
|
|
|
|
|
litest_tablet_proximity_in(dev, 5, 100, axes);
|
|
|
|
|
litest_tablet_proximity_out(dev);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* offset 30 on second prox in - must not change the offset */
|
2015-12-21 10:53:29 +10:00
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 30);
|
2015-12-01 11:07:57 +10:00
|
|
|
litest_tablet_proximity_in(dev, 5, 100, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-12-21 10:53:29 +10:00
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 0);
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 31);
|
2015-12-01 11:07:57 +10:00
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 70, 70, axes);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 1);
|
|
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-12-21 10:53:29 +10:00
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 30);
|
2015-12-01 11:07:57 +10:00
|
|
|
litest_tablet_motion(dev, 70, 70, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
2015-12-14 09:51:11 +10:00
|
|
|
pressure = libinput_event_tablet_tool_get_pressure(tev);
|
2015-12-01 11:07:57 +10:00
|
|
|
/* can't use the double_eq here, the pressure value is too tiny */
|
|
|
|
|
ck_assert(pressure > 0.0);
|
|
|
|
|
ck_assert(pressure < 1.0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-12-21 10:53:29 +10:00
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 20);
|
2015-12-01 11:07:57 +10:00
|
|
|
litest_tablet_motion(dev, 70, 70, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
2015-12-15 08:39:56 +10:00
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_TIP);
|
2015-12-01 11:07:57 +10:00
|
|
|
|
2015-12-14 09:51:11 +10:00
|
|
|
pressure = libinput_event_tablet_tool_get_pressure(tev);
|
2015-12-01 11:07:57 +10:00
|
|
|
|
|
|
|
|
ck_assert_double_eq(pressure, 0.0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-12-11 17:40:36 +10:00
|
|
|
static void pressure_threshold_warning(struct libinput *libinput,
|
|
|
|
|
enum libinput_log_priority priority,
|
|
|
|
|
const char *format,
|
|
|
|
|
va_list args)
|
|
|
|
|
{
|
|
|
|
|
int *warning_triggered = (int*)libinput_get_user_data(libinput);
|
|
|
|
|
|
|
|
|
|
if (priority == LIBINPUT_LOG_PRIORITY_ERROR &&
|
|
|
|
|
strstr(format, "pressure offset greater"))
|
|
|
|
|
(*warning_triggered)++;
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-06 13:13:00 +10:00
|
|
|
START_TEST(tablet_pressure_min_max)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 0 },
|
|
|
|
|
{ ABS_PRESSURE, 2 },
|
|
|
|
|
{ -1, -1 },
|
|
|
|
|
};
|
|
|
|
|
double p;
|
|
|
|
|
|
2019-02-12 14:02:13 +10:00
|
|
|
if (!libevdev_has_event_code(dev->evdev, EV_ABS, ABS_PRESSURE))
|
|
|
|
|
return;
|
|
|
|
|
|
2017-01-06 13:13:00 +10:00
|
|
|
litest_tablet_proximity_in(dev, 5, 100, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 0);
|
|
|
|
|
litest_tablet_motion(dev, 5, 100, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
2017-01-16 14:23:49 +10:00
|
|
|
ck_assert(libinput_event_tablet_tool_pressure_has_changed(tev));
|
2017-01-06 13:13:00 +10:00
|
|
|
p = libinput_event_tablet_tool_get_pressure(tev);
|
|
|
|
|
ck_assert_double_ge(p, 0.0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
/* skip over pressure-based tip down */
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 90);
|
|
|
|
|
litest_tablet_motion(dev, 5, 100, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2017-03-07 16:00:45 +10:00
|
|
|
/* need to fill the motion history */
|
2017-01-06 13:13:00 +10:00
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 100);
|
2017-03-07 16:00:45 +10:00
|
|
|
litest_tablet_motion(dev, 5, 100, axes);
|
|
|
|
|
litest_tablet_motion(dev, 6, 100, axes);
|
|
|
|
|
litest_tablet_motion(dev, 7, 100, axes);
|
|
|
|
|
litest_tablet_motion(dev, 8, 100, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2017-01-06 13:13:00 +10:00
|
|
|
litest_tablet_motion(dev, 5, 100, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
p = libinput_event_tablet_tool_get_pressure(tev);
|
|
|
|
|
ck_assert_double_ge(p, 1.0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2016-04-26 10:55:37 +10:00
|
|
|
START_TEST(tablet_pressure_range)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 0 },
|
|
|
|
|
{ ABS_PRESSURE, 10 },
|
|
|
|
|
{ -1, -1 },
|
|
|
|
|
};
|
|
|
|
|
int pressure;
|
|
|
|
|
double p;
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 5, 100, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
2017-12-08 12:35:11 +10:00
|
|
|
for (pressure = 10; pressure <= 100; pressure += 10) {
|
2016-04-26 10:55:37 +10:00
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, pressure);
|
|
|
|
|
litest_tablet_motion(dev, 70, 70, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
p = libinput_event_tablet_tool_get_pressure(tev);
|
|
|
|
|
ck_assert_double_ge(p, 0.0);
|
|
|
|
|
ck_assert_double_le(p, 1.0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-12-01 11:07:57 +10:00
|
|
|
START_TEST(tablet_pressure_offset_exceed_threshold)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 70 },
|
|
|
|
|
{ ABS_PRESSURE, 30 },
|
|
|
|
|
{ -1, -1 },
|
|
|
|
|
};
|
|
|
|
|
double pressure;
|
2015-12-11 17:40:36 +10:00
|
|
|
int warning_triggered = 0;
|
2015-12-01 11:07:57 +10:00
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-12-11 17:40:36 +10:00
|
|
|
libinput_set_user_data(li, &warning_triggered);
|
|
|
|
|
|
|
|
|
|
libinput_log_set_handler(li, pressure_threshold_warning);
|
2015-12-01 11:07:57 +10:00
|
|
|
litest_tablet_proximity_in(dev, 5, 100, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2015-12-14 09:51:11 +10:00
|
|
|
pressure = libinput_event_tablet_tool_get_pressure(tev);
|
2015-12-01 11:07:57 +10:00
|
|
|
ck_assert_double_gt(pressure, 0.0);
|
|
|
|
|
libinput_event_destroy(event);
|
2015-12-11 17:40:36 +10:00
|
|
|
|
|
|
|
|
ck_assert_int_eq(warning_triggered, 1);
|
|
|
|
|
litest_restore_log_handler(li);
|
2015-12-01 11:07:57 +10:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(tablet_pressure_offset_none_for_zero_distance)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 0 },
|
|
|
|
|
{ ABS_PRESSURE, 20 },
|
|
|
|
|
{ -1, -1 },
|
|
|
|
|
};
|
|
|
|
|
double pressure;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* we're going straight to touch on proximity, make sure we don't
|
|
|
|
|
* offset the pressure here */
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_proximity_in(dev, 5, 100, axes);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 1);
|
|
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
2015-12-14 09:51:11 +10:00
|
|
|
pressure = libinput_event_tablet_tool_get_pressure(tev);
|
2015-12-01 11:07:57 +10:00
|
|
|
ck_assert_double_gt(pressure, 0.0);
|
|
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(tablet_pressure_offset_none_for_small_distance)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 20 },
|
|
|
|
|
{ ABS_PRESSURE, 20 },
|
|
|
|
|
{ -1, -1 },
|
|
|
|
|
};
|
|
|
|
|
double pressure;
|
|
|
|
|
|
|
|
|
|
/* stylus too close to the tablet on the proximity in, ignore any
|
|
|
|
|
* pressure offset */
|
|
|
|
|
litest_tablet_proximity_in(dev, 5, 100, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
2015-12-21 10:53:29 +10:00
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 0);
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 21);
|
2015-12-01 11:07:57 +10:00
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 70, 70, axes);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 1);
|
|
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2015-12-21 10:53:29 +10:00
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 20);
|
2015-12-01 11:07:57 +10:00
|
|
|
litest_tablet_motion(dev, 70, 70, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
2015-12-21 15:42:33 +10:00
|
|
|
tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
2015-12-14 09:51:11 +10:00
|
|
|
pressure = libinput_event_tablet_tool_get_pressure(tev);
|
2015-12-01 11:07:57 +10:00
|
|
|
ck_assert_double_gt(pressure, 0.0);
|
|
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2016-04-26 10:55:37 +10:00
|
|
|
START_TEST(tablet_distance_range)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 20 },
|
|
|
|
|
{ ABS_PRESSURE, 0 },
|
|
|
|
|
{ -1, -1 },
|
|
|
|
|
};
|
|
|
|
|
int distance;
|
|
|
|
|
double dist;
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 5, 100, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
for (distance = 0; distance <= 100; distance += 10) {
|
|
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, distance);
|
|
|
|
|
litest_tablet_motion(dev, 70, 70, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
dist = libinput_event_tablet_tool_get_distance(tev);
|
|
|
|
|
ck_assert_double_ge(dist, 0.0);
|
|
|
|
|
ck_assert_double_le(dist, 1.0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-12-21 09:01:57 +10:00
|
|
|
START_TEST(tilt_available)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
struct libinput_tablet_tool *tool;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2015-12-21 09:01:57 +10:00
|
|
|
{ ABS_TILT_X, 80 },
|
|
|
|
|
{ ABS_TILT_Y, 20 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
|
|
|
|
|
|
|
|
|
tool = libinput_event_tablet_tool_get_tool(tev);
|
|
|
|
|
ck_assert(libinput_tablet_tool_has_tilt(tool));
|
|
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(tilt_not_available)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
struct libinput_tablet_tool *tool;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2015-12-21 09:01:57 +10:00
|
|
|
{ ABS_TILT_X, 80 },
|
|
|
|
|
{ ABS_TILT_Y, 20 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
|
|
|
|
|
|
|
|
|
tool = libinput_event_tablet_tool_get_tool(tev);
|
|
|
|
|
ck_assert(!libinput_tablet_tool_has_tilt(tool));
|
|
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(tilt_x)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2016-02-02 16:15:40 +10:00
|
|
|
{ ABS_TILT_X, 10 },
|
2015-12-21 09:01:57 +10:00
|
|
|
{ ABS_TILT_Y, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
double tx, ty;
|
|
|
|
|
int tilt;
|
|
|
|
|
double expected_tx;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
|
|
|
|
|
2016-02-02 16:15:40 +10:00
|
|
|
/* 90% of the actual axis but mapped into a [-64, 64] tilt range, so
|
|
|
|
|
* we expect 51 degrees ± rounding errors */
|
2015-12-21 09:01:57 +10:00
|
|
|
tx = libinput_event_tablet_tool_get_tilt_x(tev);
|
2016-02-02 16:15:40 +10:00
|
|
|
ck_assert_double_le(tx, -50);
|
|
|
|
|
ck_assert_double_ge(tx, -52);
|
2015-12-21 09:01:57 +10:00
|
|
|
|
|
|
|
|
ty = libinput_event_tablet_tool_get_tilt_y(tev);
|
2016-02-18 09:42:27 +10:00
|
|
|
ck_assert_double_ge(ty, -65);
|
|
|
|
|
ck_assert_double_lt(ty, -63);
|
2015-12-21 09:01:57 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2016-02-02 16:15:40 +10:00
|
|
|
expected_tx = -64.0;
|
2015-12-21 09:01:57 +10:00
|
|
|
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 0);
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 1);
|
|
|
|
|
|
2015-12-21 09:01:57 +10:00
|
|
|
for (tilt = 0; tilt <= 100; tilt += 5) {
|
2015-12-21 10:53:29 +10:00
|
|
|
litest_axis_set_value(axes, ABS_TILT_X, tilt);
|
2017-03-07 16:00:45 +10:00
|
|
|
/* work around smoothing */
|
|
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
|
|
|
|
litest_tablet_motion(dev, 10, 11, axes);
|
2015-12-21 09:01:57 +10:00
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
2017-03-07 16:00:45 +10:00
|
|
|
litest_drain_events(li);
|
|
|
|
|
litest_tablet_motion(dev, 10, 11, axes);
|
2015-12-21 09:01:57 +10:00
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
|
|
|
|
|
tx = libinput_event_tablet_tool_get_tilt_x(tev);
|
2016-02-02 16:15:40 +10:00
|
|
|
ck_assert_double_ge(tx, expected_tx - 2);
|
|
|
|
|
ck_assert_double_le(tx, expected_tx + 2);
|
2015-12-21 09:01:57 +10:00
|
|
|
|
|
|
|
|
ty = libinput_event_tablet_tool_get_tilt_y(tev);
|
2016-02-18 09:42:27 +10:00
|
|
|
ck_assert_double_ge(ty, -65);
|
|
|
|
|
ck_assert_double_lt(ty, -63);
|
2015-12-21 09:01:57 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2016-02-02 16:15:40 +10:00
|
|
|
expected_tx = tx + 6.04;
|
2015-12-21 09:01:57 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* the last event must reach the max */
|
2016-02-02 16:15:40 +10:00
|
|
|
ck_assert_double_ge(tx, 63.0);
|
|
|
|
|
ck_assert_double_le(tx, 64.0);
|
2015-12-21 09:01:57 +10:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(tilt_y)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
2015-12-14 08:05:32 +10:00
|
|
|
{ ABS_PRESSURE, 0 },
|
2015-12-21 09:01:57 +10:00
|
|
|
{ ABS_TILT_X, 0 },
|
2016-02-02 16:15:40 +10:00
|
|
|
{ ABS_TILT_Y, 10 },
|
2015-12-21 09:01:57 +10:00
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
double tx, ty;
|
|
|
|
|
int tilt;
|
|
|
|
|
double expected_ty;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
|
|
|
|
|
2016-02-02 16:15:40 +10:00
|
|
|
/* 90% of the actual axis but mapped into a [-64, 64] tilt range, so
|
|
|
|
|
* we expect 50 degrees ± rounding errors */
|
2015-12-21 09:01:57 +10:00
|
|
|
ty = libinput_event_tablet_tool_get_tilt_y(tev);
|
2016-02-02 16:15:40 +10:00
|
|
|
ck_assert_double_le(ty, -50);
|
|
|
|
|
ck_assert_double_ge(ty, -52);
|
2015-12-21 09:01:57 +10:00
|
|
|
|
|
|
|
|
tx = libinput_event_tablet_tool_get_tilt_x(tev);
|
2016-02-18 09:42:27 +10:00
|
|
|
ck_assert_double_ge(tx, -65);
|
|
|
|
|
ck_assert_double_lt(tx, -63);
|
2015-12-21 09:01:57 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2016-02-02 16:15:40 +10:00
|
|
|
expected_ty = -64;
|
2015-12-21 09:01:57 +10:00
|
|
|
|
2015-12-14 08:05:32 +10:00
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 0);
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 1);
|
|
|
|
|
|
2015-12-21 09:01:57 +10:00
|
|
|
for (tilt = 0; tilt <= 100; tilt += 5) {
|
2015-12-21 10:53:29 +10:00
|
|
|
litest_axis_set_value(axes, ABS_TILT_Y, tilt);
|
2017-03-07 16:00:45 +10:00
|
|
|
/* work around smoothing */
|
|
|
|
|
litest_tablet_motion(dev, 10, 11, axes);
|
|
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
|
|
|
|
litest_tablet_motion(dev, 10, 11, axes);
|
|
|
|
|
litest_drain_events(li);
|
2015-12-21 09:01:57 +10:00
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
|
|
|
|
|
ty = libinput_event_tablet_tool_get_tilt_y(tev);
|
2016-02-02 16:15:40 +10:00
|
|
|
ck_assert_double_ge(ty, expected_ty - 2);
|
|
|
|
|
ck_assert_double_le(ty, expected_ty + 2);
|
2015-12-21 09:01:57 +10:00
|
|
|
|
|
|
|
|
tx = libinput_event_tablet_tool_get_tilt_x(tev);
|
2016-02-18 09:42:27 +10:00
|
|
|
ck_assert_double_ge(tx, -65);
|
|
|
|
|
ck_assert_double_lt(tx, -63);
|
2015-12-21 09:01:57 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2016-02-02 16:15:40 +10:00
|
|
|
expected_ty = ty + 6;
|
2015-12-21 09:01:57 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* the last event must reach the max */
|
2016-02-02 16:15:40 +10:00
|
|
|
ck_assert_double_ge(ty, 63.0);
|
|
|
|
|
ck_assert_double_le(tx, 64.0);
|
2015-12-21 09:01:57 +10:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2016-01-06 15:26:49 +10:00
|
|
|
START_TEST(relative_no_profile)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput_device *device = dev->libinput_device;
|
|
|
|
|
enum libinput_config_accel_profile profile;
|
|
|
|
|
enum libinput_config_status status;
|
|
|
|
|
uint32_t profiles;
|
|
|
|
|
|
|
|
|
|
ck_assert(libinput_device_config_accel_is_available(device));
|
|
|
|
|
|
|
|
|
|
profile = libinput_device_config_accel_get_default_profile(device);
|
|
|
|
|
ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_NONE);
|
|
|
|
|
|
|
|
|
|
profile = libinput_device_config_accel_get_profile(device);
|
|
|
|
|
ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_NONE);
|
|
|
|
|
|
|
|
|
|
profiles = libinput_device_config_accel_get_profiles(device);
|
|
|
|
|
ck_assert_int_eq(profiles & LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE, 0);
|
|
|
|
|
ck_assert_int_eq(profiles & LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT, 0);
|
|
|
|
|
|
|
|
|
|
status = libinput_device_config_accel_set_profile(device,
|
|
|
|
|
LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT);
|
|
|
|
|
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
|
|
|
|
|
profile = libinput_device_config_accel_get_profile(device);
|
|
|
|
|
ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_NONE);
|
|
|
|
|
|
|
|
|
|
status = libinput_device_config_accel_set_profile(device,
|
|
|
|
|
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE);
|
|
|
|
|
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
|
|
|
|
|
profile = libinput_device_config_accel_get_profile(device);
|
|
|
|
|
ck_assert_int_eq(profile, LIBINPUT_CONFIG_ACCEL_PROFILE_NONE);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(relative_no_delta_prox_in)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
|
|
|
|
{ ABS_PRESSURE, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
double dx, dy;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
|
|
|
|
dx = libinput_event_tablet_tool_get_dx(tev);
|
|
|
|
|
dy = libinput_event_tablet_tool_get_dy(tev);
|
|
|
|
|
ck_assert(dx == 0.0);
|
|
|
|
|
ck_assert(dy == 0.0);
|
|
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(relative_delta)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
|
|
|
|
{ ABS_PRESSURE, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
double dx, dy;
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2019-02-12 14:02:48 +10:00
|
|
|
/* flush the motion history */
|
|
|
|
|
for (int i = 0; i < 5; i ++)
|
|
|
|
|
litest_tablet_motion(dev, 10 + i, 10, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2016-01-06 15:26:49 +10:00
|
|
|
litest_tablet_motion(dev, 20, 10, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
dx = libinput_event_tablet_tool_get_dx(tev);
|
|
|
|
|
dy = libinput_event_tablet_tool_get_dy(tev);
|
|
|
|
|
ck_assert(dx > 0.0);
|
|
|
|
|
ck_assert(dy == 0.0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2019-02-12 14:02:48 +10:00
|
|
|
/* flush the motion history */
|
|
|
|
|
for (int i = 0; i < 5; i ++)
|
|
|
|
|
litest_tablet_motion(dev, 20 - i, 10, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2017-03-07 16:00:45 +10:00
|
|
|
litest_tablet_motion(dev, 5, 10, axes);
|
2016-01-06 15:26:49 +10:00
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
dx = libinput_event_tablet_tool_get_dx(tev);
|
|
|
|
|
dy = libinput_event_tablet_tool_get_dy(tev);
|
|
|
|
|
ck_assert(dx < 0.0);
|
|
|
|
|
ck_assert(dy == 0.0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2019-02-12 14:02:48 +10:00
|
|
|
/* flush the motion history */
|
|
|
|
|
for (int i = 0; i < 5; i ++)
|
|
|
|
|
litest_tablet_motion(dev, 5, 10 + i, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_motion(dev, 5, 20, axes);
|
2016-01-06 15:26:49 +10:00
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
dx = libinput_event_tablet_tool_get_dx(tev);
|
|
|
|
|
dy = libinput_event_tablet_tool_get_dy(tev);
|
|
|
|
|
ck_assert(dx == 0.0);
|
|
|
|
|
ck_assert(dy > 0.0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2019-02-12 14:02:48 +10:00
|
|
|
|
|
|
|
|
/* flush the motion history */
|
|
|
|
|
for (int i = 0; i < 5; i ++)
|
|
|
|
|
litest_tablet_motion(dev, 5, 20 - i, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_motion(dev, 5, 10, axes);
|
2016-01-06 15:26:49 +10:00
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
dx = libinput_event_tablet_tool_get_dx(tev);
|
|
|
|
|
dy = libinput_event_tablet_tool_get_dy(tev);
|
|
|
|
|
ck_assert(dx == 0.0);
|
|
|
|
|
ck_assert(dy < 0.0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2018-09-06 14:11:23 +10:00
|
|
|
START_TEST(relative_no_delta_on_tip)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
|
|
|
|
{ ABS_PRESSURE, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
double dx, dy;
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_motion(dev, 20, 10, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* tip down */
|
|
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 0);
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 30);
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 30, 20, axes);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 1);
|
|
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_TIP);
|
|
|
|
|
ck_assert(libinput_event_tablet_tool_x_has_changed(tev));
|
|
|
|
|
ck_assert(libinput_event_tablet_tool_y_has_changed(tev));
|
|
|
|
|
dx = libinput_event_tablet_tool_get_dx(tev);
|
|
|
|
|
dy = libinput_event_tablet_tool_get_dy(tev);
|
|
|
|
|
ck_assert(dx == 0.0);
|
|
|
|
|
ck_assert(dy == 0.0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
/* normal motion */
|
|
|
|
|
litest_tablet_motion(dev, 40, 30, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
dx = libinput_event_tablet_tool_get_dx(tev);
|
|
|
|
|
dy = libinput_event_tablet_tool_get_dy(tev);
|
|
|
|
|
ck_assert(dx > 0.0);
|
|
|
|
|
ck_assert(dy > 0.0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
/* tip up */
|
|
|
|
|
litest_axis_set_value(axes, ABS_DISTANCE, 10);
|
|
|
|
|
litest_axis_set_value(axes, ABS_PRESSURE, 0);
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_motion(dev, 50, 40, axes);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOUCH, 0);
|
|
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_TIP);
|
|
|
|
|
ck_assert(libinput_event_tablet_tool_x_has_changed(tev));
|
|
|
|
|
ck_assert(libinput_event_tablet_tool_y_has_changed(tev));
|
|
|
|
|
dx = libinput_event_tablet_tool_get_dx(tev);
|
|
|
|
|
dy = libinput_event_tablet_tool_get_dy(tev);
|
|
|
|
|
ck_assert(dx == 0.0);
|
|
|
|
|
ck_assert(dy == 0.0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2016-01-06 15:26:49 +10:00
|
|
|
START_TEST(relative_calibration)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_tablet_tool *tev;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
|
|
|
|
{ ABS_PRESSURE, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
double dx, dy;
|
|
|
|
|
float calibration[] = { -1, 0, 1, 0, -1, 1 };
|
|
|
|
|
enum libinput_config_status status;
|
|
|
|
|
|
|
|
|
|
if (!libinput_device_config_calibration_has_matrix(dev->libinput_device))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
status = libinput_device_config_calibration_set_matrix(
|
|
|
|
|
dev->libinput_device,
|
|
|
|
|
calibration);
|
|
|
|
|
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_motion(dev, 20, 10, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
dx = libinput_event_tablet_tool_get_dx(tev);
|
|
|
|
|
dy = libinput_event_tablet_tool_get_dy(tev);
|
|
|
|
|
ck_assert(dx < 0.0);
|
|
|
|
|
ck_assert(dy == 0.0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2017-03-07 16:00:45 +10:00
|
|
|
litest_tablet_motion(dev, 5, 10, axes);
|
2016-01-06 15:26:49 +10:00
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
dx = libinput_event_tablet_tool_get_dx(tev);
|
|
|
|
|
dy = libinput_event_tablet_tool_get_dy(tev);
|
|
|
|
|
ck_assert(dx > 0.0);
|
|
|
|
|
ck_assert(dy == 0.0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
litest_tablet_motion(dev, 10, 20, axes);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
dx = libinput_event_tablet_tool_get_dx(tev);
|
|
|
|
|
dy = libinput_event_tablet_tool_get_dy(tev);
|
|
|
|
|
ck_assert(dx == 0.0);
|
|
|
|
|
ck_assert(dy < 0.0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
2017-03-07 16:00:45 +10:00
|
|
|
litest_tablet_motion(dev, 10, 5, axes);
|
2016-01-06 15:26:49 +10:00
|
|
|
libinput_dispatch(li);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
tev = litest_is_tablet_event(event,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
dx = libinput_event_tablet_tool_get_dx(tev);
|
|
|
|
|
dy = libinput_event_tablet_tool_get_dy(tev);
|
|
|
|
|
ck_assert(dx == 0.0);
|
|
|
|
|
ck_assert(dy > 0.0);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2019-01-04 14:58:52 +10:00
|
|
|
static enum litest_device_type
|
|
|
|
|
paired_device(struct litest_device *dev)
|
2016-06-28 11:28:34 +10:00
|
|
|
{
|
2019-01-04 14:58:52 +10:00
|
|
|
switch(dev->which) {
|
|
|
|
|
case LITEST_WACOM_INTUOS:
|
|
|
|
|
return LITEST_WACOM_FINGER;
|
|
|
|
|
case LITEST_WACOM_FINGER:
|
|
|
|
|
return LITEST_WACOM_INTUOS;
|
|
|
|
|
case LITEST_WACOM_CINTIQ_13HDT_PEN:
|
|
|
|
|
return LITEST_WACOM_CINTIQ_13HDT_FINGER;
|
|
|
|
|
case LITEST_WACOM_CINTIQ_13HDT_FINGER:
|
|
|
|
|
return LITEST_WACOM_CINTIQ_13HDT_PEN;
|
|
|
|
|
default:
|
|
|
|
|
return LITEST_NO_DEVICE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
START_TEST(touch_arbitration)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
enum litest_device_type other;
|
2016-06-28 11:28:34 +10:00
|
|
|
struct litest_device *finger;
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct axis_replacement axes[] = {
|
2018-09-28 11:47:32 +10:00
|
|
|
{ ABS_TILT_X, 80 },
|
|
|
|
|
{ ABS_TILT_Y, 80 },
|
2016-06-28 11:28:34 +10:00
|
|
|
{ ABS_DISTANCE, 10 },
|
|
|
|
|
{ ABS_PRESSURE, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
2019-01-04 14:21:38 +10:00
|
|
|
bool is_touchpad;
|
2016-06-28 11:28:34 +10:00
|
|
|
|
2019-01-04 14:58:52 +10:00
|
|
|
other = paired_device(dev);
|
|
|
|
|
if (other == LITEST_NO_DEVICE)
|
|
|
|
|
return;
|
|
|
|
|
|
2016-06-28 11:28:34 +10:00
|
|
|
finger = litest_add_device(li, other);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2019-01-04 14:21:38 +10:00
|
|
|
is_touchpad = !libevdev_has_property(finger->evdev, INPUT_PROP_DIRECT);
|
|
|
|
|
|
2016-06-28 11:28:34 +10:00
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
|
|
|
|
litest_tablet_motion(dev, 20, 40, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2018-09-28 11:47:32 +10:00
|
|
|
litest_touch_down(finger, 0, 21, 41);
|
|
|
|
|
litest_touch_move_to(finger, 0, 21, 41, 80, 80, 10);
|
2016-06-28 11:28:34 +10:00
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
|
|
|
|
litest_tablet_motion(dev, 20, 40, axes);
|
|
|
|
|
litest_assert_only_typed_events(li,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
litest_tablet_proximity_out(dev);
|
|
|
|
|
litest_assert_only_typed_events(li,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
|
|
|
|
|
|
2018-02-19 14:00:42 +10:00
|
|
|
litest_timeout_touch_arbitration();
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
2016-06-28 11:28:34 +10:00
|
|
|
/* finger still down */
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(finger, 0, 80, 80, 30, 30, 10);
|
2016-06-28 11:28:34 +10:00
|
|
|
litest_touch_up(finger, 0);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
2019-01-07 08:27:22 +10:00
|
|
|
litest_timeout_touch_arbitration();
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
2016-06-28 11:28:34 +10:00
|
|
|
/* lift finger, expect expect events */
|
|
|
|
|
litest_touch_down(finger, 0, 30, 30);
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(finger, 0, 30, 30, 80, 80, 10);
|
2016-06-28 11:28:34 +10:00
|
|
|
litest_touch_up(finger, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
if (is_touchpad)
|
|
|
|
|
litest_assert_only_typed_events(li,
|
|
|
|
|
LIBINPUT_EVENT_POINTER_MOTION);
|
|
|
|
|
else
|
|
|
|
|
litest_assert_touch_sequence(li);
|
|
|
|
|
|
|
|
|
|
litest_delete_device(finger);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2018-09-28 11:47:32 +10:00
|
|
|
START_TEST(touch_arbitration_outside_rect)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
enum litest_device_type other;
|
|
|
|
|
struct litest_device *finger;
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_TILT_X, 80 },
|
|
|
|
|
{ ABS_TILT_Y, 80 },
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
|
|
|
|
{ ABS_PRESSURE, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
double x, y;
|
|
|
|
|
bool is_touchpad;
|
|
|
|
|
|
|
|
|
|
other = paired_device(dev);
|
|
|
|
|
if (other == LITEST_NO_DEVICE)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
finger = litest_add_device(li, other);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
is_touchpad = !libevdev_has_property(finger->evdev, INPUT_PROP_DIRECT);
|
|
|
|
|
if (is_touchpad)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
x = 20;
|
|
|
|
|
y = 45;
|
|
|
|
|
|
2019-04-04 14:49:47 +10:00
|
|
|
/* disable prox-out timer quirk */
|
|
|
|
|
litest_tablet_proximity_in(dev, x, y - 1, axes);
|
|
|
|
|
litest_tablet_proximity_out(dev);
|
|
|
|
|
|
2018-09-28 11:47:32 +10:00
|
|
|
litest_tablet_proximity_in(dev, x, y - 1, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* these are in percent, but the pen/finger have different
|
|
|
|
|
* resolution and the rect works in mm, so the numbers below are
|
|
|
|
|
* hand-picked for the test device */
|
|
|
|
|
litest_tablet_motion(dev, x, y, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* left of rect */
|
2019-04-04 14:49:47 +10:00
|
|
|
litest_touch_sequence(finger, 0, x - 10, y + 2, x - 10, y + 20, 3);
|
2018-09-28 11:47:32 +10:00
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_assert_touch_sequence(li);
|
|
|
|
|
|
|
|
|
|
/* above rect */
|
2019-04-04 14:49:47 +10:00
|
|
|
litest_touch_sequence(finger, 0, x + 2, y - 35, x + 20, y - 10, 3);
|
2018-09-28 11:47:32 +10:00
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_assert_touch_sequence(li);
|
|
|
|
|
|
|
|
|
|
/* right of rect */
|
2019-04-04 14:49:47 +10:00
|
|
|
litest_touch_sequence(finger, 0, x + 80, y + 2, x + 20, y + 10, 3);
|
2018-09-28 11:47:32 +10:00
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_assert_touch_sequence(li);
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
/* This *should* work but the Cintiq test devices is <200mm
|
|
|
|
|
high, so we can't test for anything below the tip */
|
|
|
|
|
x = 20;
|
|
|
|
|
y = 10;
|
|
|
|
|
litest_tablet_proximity_out(dev);
|
|
|
|
|
litest_tablet_motion(dev, x, y, axes);
|
|
|
|
|
litest_tablet_proximity_in(dev, x, y - 1, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* below rect */
|
|
|
|
|
litest_touch_sequence(finger, 0, x + 2, y + 80, x + 20, y + 20, 30);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_assert_touch_sequence(li);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
litest_delete_device(finger);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2019-02-07 12:02:50 +10:00
|
|
|
START_TEST(touch_arbitration_remove_after)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
enum litest_device_type other;
|
|
|
|
|
struct litest_device *finger;
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_TILT_X, 80 },
|
|
|
|
|
{ ABS_TILT_Y, 80 },
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
|
|
|
|
{ ABS_PRESSURE, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
bool is_touchpad;
|
|
|
|
|
|
|
|
|
|
other = paired_device(dev);
|
|
|
|
|
if (other == LITEST_NO_DEVICE)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
finger = litest_add_device(li, other);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
is_touchpad = !libevdev_has_property(finger->evdev, INPUT_PROP_DIRECT);
|
|
|
|
|
if (is_touchpad)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 50, 50, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(finger, 0, 70, 70);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
litest_tablet_proximity_out(dev);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
/* Delete the device immediately after the tablet goes out of prox.
|
|
|
|
|
* This merely tests that the arbitration timer gets cleaned up */
|
|
|
|
|
litest_delete_device(finger);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2019-01-04 14:58:52 +10:00
|
|
|
START_TEST(touch_arbitration_stop_touch)
|
2016-06-28 11:28:34 +10:00
|
|
|
{
|
2019-01-04 14:58:52 +10:00
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
enum litest_device_type other;
|
2016-06-28 11:28:34 +10:00
|
|
|
struct litest_device *finger;
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
|
|
|
|
{ ABS_PRESSURE, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
2019-01-04 14:21:38 +10:00
|
|
|
bool is_touchpad;
|
2016-06-28 11:28:34 +10:00
|
|
|
|
2019-01-04 14:58:52 +10:00
|
|
|
other = paired_device(dev);
|
|
|
|
|
if (other == LITEST_NO_DEVICE)
|
|
|
|
|
return;
|
|
|
|
|
|
2016-06-28 11:28:34 +10:00
|
|
|
finger = litest_add_device(li, other);
|
2019-01-04 14:21:38 +10:00
|
|
|
|
|
|
|
|
is_touchpad = !libevdev_has_property(finger->evdev, INPUT_PROP_DIRECT);
|
|
|
|
|
|
2019-04-04 14:49:47 +10:00
|
|
|
/* disable prox-out timer quirk */
|
|
|
|
|
litest_tablet_proximity_in(dev, 30, 30, axes);
|
|
|
|
|
litest_tablet_proximity_out(dev);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2016-06-28 11:28:34 +10:00
|
|
|
litest_touch_down(finger, 0, 30, 30);
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(finger, 0, 30, 30, 80, 80, 10);
|
2016-06-28 11:28:34 +10:00
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
|
|
|
|
litest_tablet_motion(dev, 20, 40, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(finger, 0, 80, 80, 30, 30, 10);
|
2019-04-04 14:49:47 +10:00
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
/* tablet event so we don't time out for proximity */
|
|
|
|
|
litest_tablet_motion(dev, 30, 40, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2016-06-28 11:28:34 +10:00
|
|
|
/* start another finger to make sure that one doesn't send events
|
|
|
|
|
either */
|
|
|
|
|
litest_touch_down(finger, 1, 30, 30);
|
2019-04-08 08:50:41 +10:00
|
|
|
litest_touch_move_to(finger, 1, 30, 30, 80, 80, 3);
|
2016-06-28 11:28:34 +10:00
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
|
|
|
|
litest_tablet_motion(dev, 20, 40, axes);
|
|
|
|
|
litest_assert_only_typed_events(li,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
litest_tablet_proximity_out(dev);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2019-04-04 14:49:47 +10:00
|
|
|
litest_timeout_tablet_proxout();
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2016-06-28 11:28:34 +10:00
|
|
|
/* Finger needs to be lifted for events to happen*/
|
2019-04-08 08:50:41 +10:00
|
|
|
litest_touch_move_to(finger, 0, 30, 30, 80, 80, 3);
|
2016-06-28 11:28:34 +10:00
|
|
|
litest_assert_empty_queue(li);
|
2019-04-08 08:50:41 +10:00
|
|
|
litest_touch_move_to(finger, 1, 80, 80, 30, 30, 3);
|
2016-06-28 11:28:34 +10:00
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
litest_touch_up(finger, 0);
|
2019-04-08 08:50:41 +10:00
|
|
|
litest_touch_move_to(finger, 1, 30, 30, 80, 80, 3);
|
2016-06-28 11:28:34 +10:00
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
litest_touch_up(finger, 1);
|
2018-02-19 14:00:42 +10:00
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
2016-06-28 11:28:34 +10:00
|
|
|
litest_touch_down(finger, 0, 30, 30);
|
2019-04-04 14:49:47 +10:00
|
|
|
litest_touch_move_to(finger, 0, 30, 30, 80, 80, 3);
|
2016-06-28 11:28:34 +10:00
|
|
|
litest_touch_up(finger, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
if (is_touchpad)
|
|
|
|
|
litest_assert_only_typed_events(li,
|
|
|
|
|
LIBINPUT_EVENT_POINTER_MOTION);
|
|
|
|
|
else
|
|
|
|
|
litest_assert_touch_sequence(li);
|
|
|
|
|
|
|
|
|
|
litest_delete_device(finger);
|
|
|
|
|
litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_REMOVED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2019-01-04 14:58:52 +10:00
|
|
|
START_TEST(touch_arbitration_suspend_touch_device)
|
2016-06-28 11:28:34 +10:00
|
|
|
{
|
2019-01-04 14:58:52 +10:00
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
enum litest_device_type other;
|
2016-06-28 11:28:34 +10:00
|
|
|
struct litest_device *tablet;
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
enum libinput_config_status status;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
|
|
|
|
{ ABS_PRESSURE, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
2019-01-04 14:21:38 +10:00
|
|
|
bool is_touchpad;
|
2016-06-28 11:28:34 +10:00
|
|
|
|
2019-01-04 14:58:52 +10:00
|
|
|
other = paired_device(dev);
|
|
|
|
|
if (other == LITEST_NO_DEVICE)
|
|
|
|
|
return;
|
|
|
|
|
|
2016-06-28 11:28:34 +10:00
|
|
|
tablet = litest_add_device(li, other);
|
|
|
|
|
|
2019-01-04 14:21:38 +10:00
|
|
|
is_touchpad = !libevdev_has_property(dev->evdev, INPUT_PROP_DIRECT);
|
|
|
|
|
|
2016-06-28 11:28:34 +10:00
|
|
|
/* we can't force a device suspend, but we can at least make sure
|
|
|
|
|
the device doesn't send events */
|
|
|
|
|
status = libinput_device_config_send_events_set_mode(
|
|
|
|
|
dev->libinput_device,
|
|
|
|
|
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
|
|
|
|
|
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(tablet, 10, 10, axes);
|
|
|
|
|
litest_tablet_motion(tablet, 10, 10, axes);
|
|
|
|
|
litest_tablet_motion(tablet, 20, 40, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 30, 30);
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(dev, 0, 30, 30, 80, 80, 10);
|
2016-06-28 11:28:34 +10:00
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
/* Remove tablet device to unpair, still disabled though */
|
|
|
|
|
litest_delete_device(tablet);
|
2018-02-05 11:27:09 +10:00
|
|
|
litest_assert_tablet_proximity_event(li,
|
|
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
2016-06-28 11:28:34 +10:00
|
|
|
litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_REMOVED);
|
|
|
|
|
|
2018-02-19 14:00:42 +10:00
|
|
|
litest_timeout_touch_arbitration();
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
2016-06-28 11:28:34 +10:00
|
|
|
litest_touch_down(dev, 0, 30, 30);
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(dev, 0, 30, 30, 80, 80, 10);
|
2016-06-28 11:28:34 +10:00
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
/* Touch device is still disabled */
|
|
|
|
|
litest_touch_down(dev, 0, 30, 30);
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(dev, 0, 30, 30, 80, 80, 10);
|
2016-06-28 11:28:34 +10:00
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
status = libinput_device_config_send_events_set_mode(
|
|
|
|
|
dev->libinput_device,
|
|
|
|
|
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED);
|
|
|
|
|
ck_assert_int_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 30, 30);
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(dev, 0, 30, 30, 80, 80, 10);
|
2016-06-28 11:28:34 +10:00
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
if (is_touchpad)
|
|
|
|
|
litest_assert_only_typed_events(li,
|
|
|
|
|
LIBINPUT_EVENT_POINTER_MOTION);
|
|
|
|
|
else
|
|
|
|
|
litest_assert_touch_sequence(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2019-01-04 14:58:52 +10:00
|
|
|
START_TEST(touch_arbitration_remove_touch)
|
2016-06-28 11:28:34 +10:00
|
|
|
{
|
2019-01-04 14:58:52 +10:00
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
enum litest_device_type other;
|
2016-06-28 11:28:34 +10:00
|
|
|
struct litest_device *finger;
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
|
|
|
|
{ ABS_PRESSURE, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
2019-01-04 14:58:52 +10:00
|
|
|
other = paired_device(dev);
|
|
|
|
|
if (other == LITEST_NO_DEVICE)
|
|
|
|
|
return;
|
|
|
|
|
|
2016-06-28 11:28:34 +10:00
|
|
|
finger = litest_add_device(li, other);
|
|
|
|
|
litest_touch_down(finger, 0, 30, 30);
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(finger, 0, 30, 30, 80, 80, 10);
|
2016-06-28 11:28:34 +10:00
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 10, 10, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_delete_device(finger);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_REMOVED);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_motion(dev, 10, 10, axes);
|
|
|
|
|
litest_tablet_motion(dev, 20, 40, axes);
|
|
|
|
|
litest_assert_only_typed_events(li,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2019-01-04 14:58:52 +10:00
|
|
|
START_TEST(touch_arbitration_remove_tablet)
|
2016-06-28 11:28:34 +10:00
|
|
|
{
|
2019-01-04 14:58:52 +10:00
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
enum litest_device_type other;
|
2016-06-28 11:28:34 +10:00
|
|
|
struct litest_device *tablet;
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
|
|
|
|
{ ABS_PRESSURE, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
2019-01-04 14:21:38 +10:00
|
|
|
bool is_touchpad;
|
2016-06-28 11:28:34 +10:00
|
|
|
|
2019-01-04 14:58:52 +10:00
|
|
|
other = paired_device(dev);
|
|
|
|
|
if (other == LITEST_NO_DEVICE)
|
|
|
|
|
return;
|
|
|
|
|
|
2016-06-28 11:28:34 +10:00
|
|
|
tablet = litest_add_device(li, other);
|
2019-01-04 14:21:38 +10:00
|
|
|
|
|
|
|
|
is_touchpad = !libevdev_has_property(dev->evdev, INPUT_PROP_DIRECT);
|
|
|
|
|
|
2016-06-28 11:28:34 +10:00
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_tablet_proximity_in(tablet, 10, 10, axes);
|
|
|
|
|
litest_tablet_motion(tablet, 10, 10, axes);
|
|
|
|
|
litest_tablet_motion(tablet, 20, 40, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 30, 30);
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(dev, 0, 30, 30, 80, 80, 10);
|
2016-06-28 11:28:34 +10:00
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_delete_device(tablet);
|
2018-02-05 11:27:09 +10:00
|
|
|
litest_assert_tablet_proximity_event(li,
|
|
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
2016-06-28 11:28:34 +10:00
|
|
|
litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_REMOVED);
|
|
|
|
|
|
2018-02-19 14:00:42 +10:00
|
|
|
litest_timeout_touch_arbitration();
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
2016-06-28 11:28:34 +10:00
|
|
|
/* Touch is still down, don't enable */
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(dev, 0, 80, 80, 30, 30, 10);
|
2016-06-28 11:28:34 +10:00
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 30, 30);
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(dev, 0, 30, 30, 80, 80, 10);
|
2016-06-28 11:28:34 +10:00
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
if (is_touchpad)
|
|
|
|
|
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
|
|
|
|
|
else
|
|
|
|
|
litest_assert_touch_sequence(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2019-01-04 15:09:37 +10:00
|
|
|
START_TEST(touch_arbitration_keep_ignoring)
|
2018-02-19 14:00:42 +10:00
|
|
|
{
|
|
|
|
|
struct litest_device *tablet = litest_current_device();
|
2019-01-04 15:09:37 +10:00
|
|
|
enum litest_device_type other;
|
2018-02-19 14:00:42 +10:00
|
|
|
struct litest_device *finger;
|
|
|
|
|
struct libinput *li = tablet->libinput;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
|
|
|
|
{ ABS_PRESSURE, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
|
|
|
|
|
2019-01-04 15:09:37 +10:00
|
|
|
other = paired_device(tablet);
|
|
|
|
|
if (other == LITEST_NO_DEVICE)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
finger = litest_add_device(li, other);
|
2018-02-19 14:00:42 +10:00
|
|
|
litest_tablet_proximity_in(tablet, 10, 10, axes);
|
|
|
|
|
litest_tablet_motion(tablet, 10, 10, axes);
|
|
|
|
|
litest_tablet_motion(tablet, 20, 40, axes);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(finger, 0, 30, 30);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_out(tablet);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* a touch during pen interaction stays a palm after the pen lifts.
|
|
|
|
|
*/
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(finger, 0, 30, 30, 80, 80, 10);
|
2018-02-19 14:00:42 +10:00
|
|
|
litest_touch_up(finger, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_delete_device(finger);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2019-01-07 08:27:22 +10:00
|
|
|
START_TEST(touch_arbitration_late_touch_lift)
|
2018-02-19 14:00:42 +10:00
|
|
|
{
|
|
|
|
|
struct litest_device *tablet = litest_current_device();
|
2019-01-07 08:27:22 +10:00
|
|
|
enum litest_device_type other;
|
2018-02-19 14:00:42 +10:00
|
|
|
struct litest_device *finger;
|
|
|
|
|
struct libinput *li = tablet->libinput;
|
|
|
|
|
struct axis_replacement axes[] = {
|
|
|
|
|
{ ABS_DISTANCE, 10 },
|
|
|
|
|
{ ABS_PRESSURE, 0 },
|
|
|
|
|
{ -1, -1 }
|
|
|
|
|
};
|
2019-01-07 08:27:22 +10:00
|
|
|
bool is_touchpad;
|
2018-02-19 14:00:42 +10:00
|
|
|
|
2019-01-07 08:27:22 +10:00
|
|
|
other = paired_device(tablet);
|
|
|
|
|
if (other == LITEST_NO_DEVICE)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
finger = litest_add_device(li, other);
|
|
|
|
|
is_touchpad = !libevdev_has_property(finger->evdev, INPUT_PROP_DIRECT);
|
|
|
|
|
if (is_touchpad)
|
|
|
|
|
litest_enable_tap(finger->libinput_device);
|
2018-02-19 14:00:42 +10:00
|
|
|
litest_tablet_proximity_in(tablet, 10, 10, axes);
|
|
|
|
|
litest_tablet_motion(tablet, 10, 10, axes);
|
|
|
|
|
litest_tablet_motion(tablet, 20, 40, axes);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_out(tablet);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* with kernel arbitration, a finger + stylus in prox only generates
|
2019-01-04 15:27:02 +10:00
|
|
|
* stylus events. When a user lifts the hand with the stylus, the
|
|
|
|
|
* stylus usually goes out of prox while the hand is still touching
|
|
|
|
|
* the surface. This causes a touch down event now that the stylus
|
|
|
|
|
* is out of proximity. A few ms later, the hand really lifts off
|
|
|
|
|
* the surface, causing a touch down and thus a fake tap event.
|
2018-02-19 14:00:42 +10:00
|
|
|
*/
|
|
|
|
|
litest_touch_down(finger, 0, 30, 30);
|
|
|
|
|
litest_touch_up(finger, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_timeout_tap();
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
litest_delete_device(finger);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2016-12-22 12:11:43 +10:00
|
|
|
START_TEST(huion_static_btn_tool_pen)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_X, 20000);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_Y, 20000);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_PRESSURE, 100);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 10; i++) {
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_X, 20000 + 10 * i);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_Y, 20000 - 10 * i);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
}
|
|
|
|
|
litest_assert_only_typed_events(li,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
|
|
|
|
|
/* Wait past the timeout to expect a proximity out */
|
|
|
|
|
litest_timeout_tablet_proxout();
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_assert_tablet_proximity_event(li,
|
|
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
/* New events should fake a proximity in again */
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_X, 20000);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_Y, 20000);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_assert_tablet_proximity_event(li,
|
|
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 10; i++) {
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_X, 20000 + 10 * i);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_Y, 20000 - 10 * i);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
}
|
|
|
|
|
litest_assert_only_typed_events(li,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
litest_timeout_tablet_proxout();
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_assert_tablet_proximity_event(li,
|
|
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
/* New events, just to ensure cleanup paths are correct */
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_X, 20000);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_Y, 20000);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(huion_static_btn_tool_pen_no_timeout_during_usage)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_X, 20000);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_Y, 20000);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_PRESSURE, 100);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* take longer than the no-activity timeout */
|
|
|
|
|
for (i = 0; i < 50; i++) {
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_X, 20000 + 10 * i);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_Y, 20000 - 10 * i);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
msleep(5);
|
|
|
|
|
}
|
|
|
|
|
litest_assert_only_typed_events(li,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
litest_timeout_tablet_proxout();
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_assert_tablet_proximity_event(li,
|
|
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2017-09-20 10:50:19 +10:00
|
|
|
START_TEST(huion_static_btn_tool_pen_disable_quirk_on_prox_out)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
bool with_timeout = _i; /* ranged test */
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
/* test is run twice, once where the real BTN_TOOL_PEN is triggered
|
|
|
|
|
* during proximity out, one where the real BTN_TOOL_PEN is
|
|
|
|
|
* triggered after we already triggered the quirk timeout
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_X, 20000);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_Y, 20000);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_PRESSURE, 100);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_PEN, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 10; i++) {
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_X, 20000 + 10 * i);
|
|
|
|
|
litest_event(dev, EV_ABS, ABS_Y, 20000 - 10 * i);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
}
|
|
|
|
|
litest_assert_only_typed_events(li,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
|
|
|
|
|
/* Wait past the timeout to expect a proximity out */
|
|
|
|
|
if (with_timeout) {
|
|
|
|
|
litest_timeout_tablet_proxout();
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_assert_tablet_proximity_event(li,
|
|
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Send a real prox out, expect quirk to be disabled */
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_PEN, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
if (with_timeout) {
|
|
|
|
|
/* we got the proximity event above already */
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
} else {
|
|
|
|
|
litest_assert_tablet_proximity_event(li,
|
|
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_proximity_out(dev);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_PEN, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
|
|
|
|
|
litest_tablet_proximity_in(dev, 50, 50, NULL);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
litest_assert_tablet_proximity_event(li,
|
|
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 10; i++) {
|
|
|
|
|
litest_tablet_motion(dev, 50 + i, 50 + i, NULL);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
litest_assert_only_typed_events(li,
|
|
|
|
|
LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
|
|
|
|
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
litest_tablet_proximity_out(dev);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_PEN, 0);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
litest_pop_event_frame(dev);
|
|
|
|
|
libinput_dispatch(li);
|
|
|
|
|
|
|
|
|
|
litest_assert_tablet_proximity_event(li,
|
|
|
|
|
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2018-03-21 12:54:10 +10:00
|
|
|
TEST_COLLECTION(tablet)
|
2014-06-07 17:35:41 -04:00
|
|
|
{
|
2017-09-20 10:50:19 +10:00
|
|
|
struct range with_timeout = { 0, 2 };
|
2018-09-05 15:57:02 +10:00
|
|
|
struct range xyaxes = { ABS_X, ABS_Y + 1 };
|
2017-09-20 10:50:19 +10:00
|
|
|
|
2014-06-27 11:05:30 +10:00
|
|
|
litest_add("tablet:tool", tool_ref, LITEST_TABLET | LITEST_TOOL_SERIAL, LITEST_ANY);
|
2017-01-16 09:29:29 +10:00
|
|
|
litest_add("tablet:tool", tool_user_data, LITEST_TABLET | LITEST_TOOL_SERIAL, LITEST_ANY);
|
2017-01-13 16:44:15 +10:00
|
|
|
litest_add("tablet:tool", tool_capability, LITEST_TABLET, LITEST_ANY);
|
2014-08-07 22:02:22 -04:00
|
|
|
litest_add_no_device("tablet:tool", tool_capabilities);
|
2017-02-09 11:09:11 +10:00
|
|
|
litest_add("tablet:tool", tool_type, LITEST_TABLET, LITEST_ANY);
|
2015-02-26 13:55:08 +10:00
|
|
|
litest_add("tablet:tool", tool_in_prox_before_start, LITEST_TABLET, LITEST_ANY);
|
2019-04-01 15:29:37 +10:00
|
|
|
litest_add("tablet:tool", tool_direct_switch, LITEST_TABLET, LITEST_ANY);
|
2015-12-15 12:39:52 +10:00
|
|
|
litest_add("tablet:tool_serial", tool_unique, LITEST_TABLET | LITEST_TOOL_SERIAL, LITEST_ANY);
|
2014-06-19 01:18:09 -04:00
|
|
|
litest_add("tablet:tool_serial", tool_serial, LITEST_TABLET | LITEST_TOOL_SERIAL, LITEST_ANY);
|
2017-01-16 10:57:56 +10:00
|
|
|
litest_add("tablet:tool_serial", tool_id, LITEST_TABLET | LITEST_TOOL_SERIAL, LITEST_ANY);
|
2014-06-19 01:18:09 -04:00
|
|
|
litest_add("tablet:tool_serial", serial_changes_tool, LITEST_TABLET | LITEST_TOOL_SERIAL, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:tool_serial", invalid_serials, LITEST_TABLET | LITEST_TOOL_SERIAL, LITEST_ANY);
|
2014-08-07 19:00:52 -04:00
|
|
|
litest_add_no_device("tablet:tool_serial", tools_with_serials);
|
|
|
|
|
litest_add_no_device("tablet:tool_serial", tools_without_serials);
|
2016-08-29 15:14:55 +10:00
|
|
|
litest_add_for_device("tablet:tool_serial", tool_delayed_serial, LITEST_WACOM_HID4800_PEN);
|
2014-06-07 17:35:41 -04:00
|
|
|
litest_add("tablet:proximity", proximity_out_clear_buttons, LITEST_TABLET, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:proximity", proximity_in_out, LITEST_TABLET, LITEST_ANY);
|
2015-12-03 11:19:44 +10:00
|
|
|
litest_add("tablet:proximity", proximity_in_button_down, LITEST_TABLET, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:proximity", proximity_out_button_up, LITEST_TABLET, LITEST_ANY);
|
2015-02-18 01:43:21 -05:00
|
|
|
litest_add("tablet:proximity", proximity_has_axes, LITEST_TABLET, LITEST_ANY);
|
2014-06-11 21:25:37 -04:00
|
|
|
litest_add("tablet:proximity", bad_distance_events, LITEST_TABLET | LITEST_DISTANCE, LITEST_ANY);
|
2018-02-06 15:26:53 +10:00
|
|
|
litest_add("tablet:proximity", proximity_range_enter, LITEST_TABLET | LITEST_DISTANCE | LITEST_TOOL_MOUSE, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:proximity", proximity_range_in_out, LITEST_TABLET | LITEST_DISTANCE | LITEST_TOOL_MOUSE, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:proximity", proximity_range_button_click, LITEST_TABLET | LITEST_DISTANCE | LITEST_TOOL_MOUSE, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:proximity", proximity_range_button_press, LITEST_TABLET | LITEST_DISTANCE | LITEST_TOOL_MOUSE, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:proximity", proximity_range_button_release, LITEST_TABLET | LITEST_DISTANCE | LITEST_TOOL_MOUSE, LITEST_ANY);
|
2018-02-05 11:27:09 +10:00
|
|
|
litest_add_no_device("tablet:proximity", proximity_out_on_delete);
|
2017-01-16 14:50:07 +10:00
|
|
|
litest_add("tablet:button", button_down_up, LITEST_TABLET, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:button", button_seat_count, LITEST_TABLET, LITEST_ANY);
|
2018-02-05 11:27:09 +10:00
|
|
|
litest_add_no_device("tablet:button", button_up_on_delete);
|
2019-02-12 14:04:49 +10:00
|
|
|
litest_add("tablet:tip", tip_down_up, LITEST_TABLET|LITEST_HOVER, LITEST_ANY);
|
2015-11-11 14:03:05 +10:00
|
|
|
litest_add("tablet:tip", tip_down_prox_in, LITEST_TABLET, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:tip", tip_up_prox_out, LITEST_TABLET, LITEST_ANY);
|
2019-02-12 14:04:49 +10:00
|
|
|
litest_add("tablet:tip", tip_down_btn_change, LITEST_TABLET|LITEST_HOVER, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:tip", tip_up_btn_change, LITEST_TABLET|LITEST_HOVER, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:tip", tip_down_motion, LITEST_TABLET|LITEST_HOVER, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:tip", tip_up_motion, LITEST_TABLET|LITEST_HOVER, LITEST_ANY);
|
|
|
|
|
litest_add_ranged("tablet:tip", tip_up_motion_one_axis, LITEST_TABLET|LITEST_HOVER, LITEST_ANY, &xyaxes);
|
|
|
|
|
litest_add("tablet:tip", tip_state_proximity, LITEST_TABLET|LITEST_HOVER, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:tip", tip_state_axis, LITEST_TABLET|LITEST_HOVER, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:tip", tip_state_button, LITEST_TABLET|LITEST_HOVER, LITEST_ANY);
|
2018-02-05 11:27:09 +10:00
|
|
|
litest_add_no_device("tablet:tip", tip_up_on_delete);
|
2014-06-12 22:52:28 -04:00
|
|
|
litest_add("tablet:motion", motion, LITEST_TABLET, LITEST_ANY);
|
2014-06-26 21:31:53 -04:00
|
|
|
litest_add("tablet:motion", motion_event_state, LITEST_TABLET, LITEST_ANY);
|
2016-02-11 14:32:33 +10:00
|
|
|
litest_add_for_device("tablet:motion", motion_outside_bounds, LITEST_WACOM_CINTIQ_24HD);
|
2015-12-21 09:01:57 +10:00
|
|
|
litest_add("tablet:tilt", tilt_available, LITEST_TABLET|LITEST_TILT, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:tilt", tilt_not_available, LITEST_TABLET, LITEST_TILT);
|
|
|
|
|
litest_add("tablet:tilt", tilt_x, LITEST_TABLET|LITEST_TILT, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:tilt", tilt_y, LITEST_TABLET|LITEST_TILT, LITEST_ANY);
|
2015-02-19 12:56:43 +10:00
|
|
|
litest_add_for_device("tablet:left_handed", left_handed, LITEST_WACOM_INTUOS);
|
2015-12-15 13:58:01 +10:00
|
|
|
litest_add_for_device("tablet:left_handed", left_handed_tilt, LITEST_WACOM_INTUOS);
|
2016-02-01 14:51:14 +10:00
|
|
|
litest_add_for_device("tablet:left_handed", left_handed_mouse_rotation, LITEST_WACOM_INTUOS);
|
2016-02-01 15:05:03 +10:00
|
|
|
litest_add_for_device("tablet:left_handed", left_handed_artpen_rotation, LITEST_WACOM_INTUOS);
|
2015-02-19 12:56:43 +10:00
|
|
|
litest_add_for_device("tablet:left_handed", no_left_handed, LITEST_WACOM_CINTIQ);
|
2014-06-20 14:51:28 +10:00
|
|
|
litest_add("tablet:pad", pad_buttons_ignored, LITEST_TABLET, LITEST_ANY);
|
2018-02-06 15:26:53 +10:00
|
|
|
litest_add("tablet:mouse", mouse_tool, LITEST_TABLET | LITEST_TOOL_MOUSE, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:mouse", mouse_buttons, LITEST_TABLET | LITEST_TOOL_MOUSE, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:mouse", mouse_rotation, LITEST_TABLET | LITEST_TOOL_MOUSE, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:mouse", mouse_wheel, LITEST_TABLET | LITEST_TOOL_MOUSE, LITEST_WHEEL);
|
2015-02-17 13:04:06 +10:00
|
|
|
litest_add("tablet:airbrush", airbrush_tool, LITEST_TABLET, LITEST_ANY);
|
2016-04-11 07:18:07 +10:00
|
|
|
litest_add("tablet:airbrush", airbrush_slider, LITEST_TABLET, LITEST_ANY);
|
2015-02-18 11:40:55 +10:00
|
|
|
litest_add("tablet:artpen", artpen_tool, LITEST_TABLET, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:artpen", artpen_rotation, LITEST_TABLET, LITEST_ANY);
|
2015-08-12 15:50:38 +10:00
|
|
|
|
|
|
|
|
litest_add("tablet:time", tablet_time_usec, LITEST_TABLET, LITEST_ANY);
|
2015-11-30 14:14:03 +10:00
|
|
|
litest_add("tablet:pressure", tablet_pressure_distance_exclusive, LITEST_TABLET | LITEST_DISTANCE, LITEST_ANY);
|
2015-12-01 14:05:16 +10:00
|
|
|
|
|
|
|
|
litest_add("tablet:calibration", tablet_calibration_has_matrix, LITEST_TABLET, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:calibration", tablet_calibration_set_matrix, LITEST_TABLET, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:calibration", tablet_calibration_set_matrix_delta, LITEST_TABLET, LITEST_ANY);
|
2015-12-01 11:07:57 +10:00
|
|
|
|
2017-01-06 13:13:00 +10:00
|
|
|
litest_add("tablet:pressure", tablet_pressure_min_max, LITEST_TABLET, LITEST_ANY);
|
2016-04-26 10:55:37 +10:00
|
|
|
litest_add_for_device("tablet:pressure", tablet_pressure_range, LITEST_WACOM_INTUOS);
|
2015-12-01 11:07:57 +10:00
|
|
|
litest_add_for_device("tablet:pressure", tablet_pressure_offset, LITEST_WACOM_INTUOS);
|
|
|
|
|
litest_add_for_device("tablet:pressure", tablet_pressure_offset_decrease, LITEST_WACOM_INTUOS);
|
|
|
|
|
litest_add_for_device("tablet:pressure", tablet_pressure_offset_increase, LITEST_WACOM_INTUOS);
|
|
|
|
|
litest_add_for_device("tablet:pressure", tablet_pressure_offset_exceed_threshold, LITEST_WACOM_INTUOS);
|
|
|
|
|
litest_add_for_device("tablet:pressure", tablet_pressure_offset_none_for_zero_distance, LITEST_WACOM_INTUOS);
|
|
|
|
|
litest_add_for_device("tablet:pressure", tablet_pressure_offset_none_for_small_distance, LITEST_WACOM_INTUOS);
|
2016-04-26 10:55:37 +10:00
|
|
|
litest_add_for_device("tablet:distance", tablet_distance_range, LITEST_WACOM_INTUOS);
|
2016-01-06 15:26:49 +10:00
|
|
|
|
|
|
|
|
litest_add("tablet:relative", relative_no_profile, LITEST_TABLET, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:relative", relative_no_delta_prox_in, LITEST_TABLET, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:relative", relative_delta, LITEST_TABLET, LITEST_ANY);
|
2019-02-12 14:04:49 +10:00
|
|
|
litest_add("tablet:relative", relative_no_delta_on_tip, LITEST_TABLET|LITEST_HOVER, LITEST_ANY);
|
2016-01-06 15:26:49 +10:00
|
|
|
litest_add("tablet:relative", relative_calibration, LITEST_TABLET, LITEST_ANY);
|
2016-06-28 11:28:34 +10:00
|
|
|
|
2019-01-04 14:58:52 +10:00
|
|
|
litest_add("tablet:touch-arbitration", touch_arbitration, LITEST_TABLET, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:touch-arbitration", touch_arbitration_stop_touch, LITEST_TABLET, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:touch-arbitration", touch_arbitration_suspend_touch_device, LITEST_TOUCH, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:touch-arbitration", touch_arbitration_remove_touch, LITEST_TABLET, LITEST_ANY);
|
|
|
|
|
litest_add("tablet:touch-arbitration", touch_arbitration_remove_tablet, LITEST_TOUCH, LITEST_ANY);
|
2019-01-04 15:09:37 +10:00
|
|
|
litest_add("tablet:touch-arbitration", touch_arbitration_keep_ignoring, LITEST_TABLET, LITEST_ANY);
|
2019-01-07 08:27:22 +10:00
|
|
|
litest_add("tablet:touch-arbitration", touch_arbitration_late_touch_lift, LITEST_TABLET, LITEST_ANY);
|
2018-09-28 11:47:32 +10:00
|
|
|
litest_add("tablet:touch-arbitration", touch_arbitration_outside_rect, LITEST_TABLET | LITEST_DIRECT, LITEST_ANY);
|
2019-02-07 12:02:50 +10:00
|
|
|
litest_add("tablet:touch-arbitration", touch_arbitration_remove_after, LITEST_TABLET | LITEST_DIRECT, LITEST_ANY);
|
2016-06-28 11:28:34 +10:00
|
|
|
|
2016-12-22 12:11:43 +10:00
|
|
|
litest_add_for_device("tablet:quirks", huion_static_btn_tool_pen, LITEST_HUION_TABLET);
|
|
|
|
|
litest_add_for_device("tablet:quirks", huion_static_btn_tool_pen_no_timeout_during_usage, LITEST_HUION_TABLET);
|
2017-09-20 10:50:19 +10:00
|
|
|
litest_add_ranged_for_device("tablet:quirks", huion_static_btn_tool_pen_disable_quirk_on_prox_out, LITEST_HUION_TABLET, &with_timeout);
|
2014-06-07 17:35:41 -04:00
|
|
|
}
|