mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-10 08:00:29 +01:00
test: improve debugging for one of the tablet tests
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1185>
This commit is contained in:
parent
b2c42b60da
commit
479a3d024c
3 changed files with 41 additions and 23 deletions
|
|
@ -4229,12 +4229,33 @@ litest_event_pointer_get_axis_source(struct libinput_event_pointer *ptrev)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
_litest_assert_tablet_axis_event(struct libinput *li,
|
||||
const char *func,
|
||||
int lineno)
|
||||
{
|
||||
_litest_checkpoint(func,
|
||||
lineno,
|
||||
ANSI_CYAN,
|
||||
"asserting axis event");
|
||||
|
||||
litest_wait_for_event(li);
|
||||
_destroy_(libinput_event) *event = libinput_get_event(li);
|
||||
litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
||||
}
|
||||
|
||||
void
|
||||
_litest_assert_tablet_proximity_event(struct libinput *li,
|
||||
enum libinput_tablet_tool_proximity_state state,
|
||||
const char *func,
|
||||
int lineno)
|
||||
{
|
||||
_litest_checkpoint(func,
|
||||
lineno,
|
||||
ANSI_CYAN,
|
||||
"asserting proximity %s event",
|
||||
state ? "in" : "out");
|
||||
|
||||
litest_wait_for_event(li);
|
||||
_destroy_(libinput_event) *event = libinput_get_event(li);
|
||||
litest_is_proximity_event(event, state);
|
||||
|
|
|
|||
|
|
@ -1207,6 +1207,14 @@ _litest_assert_tablet_button_event(struct libinput *li,
|
|||
const char *func,
|
||||
int lineno);
|
||||
|
||||
#define litest_assert_tablet_axis_event(li_) \
|
||||
_litest_assert_tablet_axis_event(li_, __func__, __LINE__)
|
||||
|
||||
void
|
||||
_litest_assert_tablet_axis_event(struct libinput *li,
|
||||
const char *func,
|
||||
int lineno);
|
||||
|
||||
#define litest_assert_tablet_proximity_event(li_, state_) \
|
||||
_litest_assert_tablet_proximity_event(li_, state_, __func__, __LINE__)
|
||||
|
||||
|
|
|
|||
|
|
@ -3062,7 +3062,6 @@ START_TEST(tool_direct_switch_with_forced_proxout)
|
|||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
struct libinput_event *event;
|
||||
struct axis_replacement axes[] = {
|
||||
{ ABS_DISTANCE, 10 },
|
||||
{ ABS_PRESSURE, 0 },
|
||||
|
|
@ -3084,52 +3083,42 @@ START_TEST(tool_direct_switch_with_forced_proxout)
|
|||
/* pen prox in */
|
||||
litest_tablet_proximity_in(dev, 10, 10, axes);
|
||||
litest_dispatch(li);
|
||||
event = libinput_get_event(li);
|
||||
litest_is_proximity_event(event,
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
|
||||
libinput_event_destroy(event);
|
||||
litest_assert_tablet_proximity_event(li,
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
|
||||
|
||||
/* pen motion */
|
||||
litest_tablet_motion(dev, 20, 30, axes);
|
||||
litest_dispatch(li);
|
||||
|
||||
event = libinput_get_event(li);
|
||||
litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
||||
libinput_event_destroy(event);
|
||||
litest_assert_tablet_axis_event(li);
|
||||
|
||||
litest_checkpoint("Forcing a timeout prox-out");
|
||||
/* pen forced prox out */
|
||||
litest_timeout_tablet_proxout(li);
|
||||
|
||||
litest_checkpoint("Actual prox-out");
|
||||
/* actual prox out for tablets that don't do forced prox out */
|
||||
litest_tablet_proximity_out(dev);
|
||||
litest_timeout_tablet_proxout(li);
|
||||
|
||||
event = libinput_get_event(li);
|
||||
litest_is_proximity_event(event,
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
||||
libinput_event_destroy(event);
|
||||
litest_assert_tablet_proximity_event(li,
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_OUT);
|
||||
litest_assert_empty_queue(li);
|
||||
|
||||
/* eraser prox in without axes */
|
||||
litest_event(dev, EV_KEY, BTN_TOOL_RUBBER, 1);
|
||||
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
||||
litest_dispatch(li);
|
||||
event = libinput_get_event(li);
|
||||
litest_is_proximity_event(event,
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
|
||||
libinput_event_destroy(event);
|
||||
litest_assert_tablet_proximity_event(li,
|
||||
LIBINPUT_TABLET_TOOL_PROXIMITY_STATE_IN);
|
||||
|
||||
/* eraser motion */
|
||||
litest_tablet_motion(dev, 30, 40, axes);
|
||||
litest_tablet_motion(dev, 40, 50, axes);
|
||||
litest_dispatch(li);
|
||||
|
||||
event = libinput_get_event(li);
|
||||
litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
||||
libinput_event_destroy(event);
|
||||
|
||||
event = libinput_get_event(li);
|
||||
litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
||||
libinput_event_destroy(event);
|
||||
litest_assert_tablet_axis_event(li);
|
||||
litest_assert_tablet_axis_event(li);
|
||||
|
||||
litest_assert_empty_queue(li);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue