mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-20 04:30:06 +01:00
test: fix failing tablet tests for pressure-less tablets
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1263>
This commit is contained in:
parent
25614f005a
commit
0cbe4976ed
1 changed files with 24 additions and 5 deletions
|
|
@ -4535,13 +4535,13 @@ START_TEST(tablet_pressure_config)
|
|||
{
|
||||
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 },
|
||||
};
|
||||
bool has_pressure = libevdev_has_event_code(dev->evdev, EV_ABS, ABS_PRESSURE);
|
||||
|
||||
litest_tablet_proximity_in(dev, 5, 100, axes);
|
||||
litest_drain_events(li);
|
||||
|
|
@ -4550,11 +4550,13 @@ START_TEST(tablet_pressure_config)
|
|||
litest_tablet_motion(dev, 70, 70, axes);
|
||||
litest_dispatch(li);
|
||||
|
||||
event = libinput_get_event(li);
|
||||
_destroy_(libinput_event) *event = libinput_get_event(li);
|
||||
tev = litest_is_tablet_event(event, LIBINPUT_EVENT_TABLET_TOOL_AXIS);
|
||||
struct libinput_tablet_tool *tool = libinput_event_tablet_tool_get_tool(tev);
|
||||
|
||||
litest_assert(libinput_tablet_tool_config_pressure_range_is_available(tool));
|
||||
litest_assert_int_eq(
|
||||
has_pressure,
|
||||
libinput_tablet_tool_config_pressure_range_is_available(tool));
|
||||
litest_assert_double_eq(
|
||||
libinput_tablet_tool_config_pressure_range_get_minimum(tool),
|
||||
0.0);
|
||||
|
|
@ -4568,6 +4570,13 @@ START_TEST(tablet_pressure_config)
|
|||
libinput_tablet_tool_config_pressure_range_get_default_maximum(tool),
|
||||
1.0);
|
||||
|
||||
if (!has_pressure) {
|
||||
litest_assert_enum_eq(
|
||||
libinput_tablet_tool_config_pressure_range_set(tool, 0.0, 1.0),
|
||||
LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
|
||||
return LITEST_PASS;
|
||||
}
|
||||
|
||||
litest_assert_enum_eq(
|
||||
libinput_tablet_tool_config_pressure_range_set(tool, 0.0, 1.0),
|
||||
LIBINPUT_CONFIG_STATUS_SUCCESS);
|
||||
|
|
@ -4600,8 +4609,6 @@ START_TEST(tablet_pressure_config)
|
|||
litest_assert_double_eq(
|
||||
libinput_tablet_tool_config_pressure_range_get_default_maximum(tool),
|
||||
1.0);
|
||||
|
||||
libinput_event_destroy(event);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
|
@ -4619,6 +4626,9 @@ START_TEST(tablet_pressure_config_set_minimum)
|
|||
};
|
||||
double p, old_pressure;
|
||||
|
||||
if (!libevdev_has_event_code(dev->evdev, EV_ABS, ABS_PRESSURE))
|
||||
return LITEST_NOT_APPLICABLE;
|
||||
|
||||
litest_tablet_proximity_in(dev, 5, 100, axes);
|
||||
litest_drain_events(li);
|
||||
litest_dispatch(li);
|
||||
|
|
@ -4708,6 +4718,9 @@ START_TEST(tablet_pressure_config_set_maximum)
|
|||
};
|
||||
double p, old_pressure;
|
||||
|
||||
if (!libevdev_has_event_code(dev->evdev, EV_ABS, ABS_PRESSURE))
|
||||
return LITEST_NOT_APPLICABLE;
|
||||
|
||||
litest_tablet_proximity_in(dev, 5, 100, axes);
|
||||
litest_drain_events(li);
|
||||
litest_dispatch(li);
|
||||
|
|
@ -4806,6 +4819,9 @@ START_TEST(tablet_pressure_config_set_range)
|
|||
};
|
||||
double p, old_pressure;
|
||||
|
||||
if (!libevdev_has_event_code(dev->evdev, EV_ABS, ABS_PRESSURE))
|
||||
return LITEST_NOT_APPLICABLE;
|
||||
|
||||
litest_tablet_proximity_in(dev, 5, 100, axes);
|
||||
litest_drain_events(li);
|
||||
litest_dispatch(li);
|
||||
|
|
@ -7120,6 +7136,9 @@ START_TEST(tablet_eraser_button_disabled)
|
|||
bool with_motion_events =
|
||||
litest_test_param_get_bool(test_env->params, "with-motion-events");
|
||||
|
||||
if (!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_RUBBER))
|
||||
return LITEST_NOT_APPLICABLE;
|
||||
|
||||
/* Device forces BTN_TOOL_PEN on tip */
|
||||
if (with_tip_down && dev->which == LITEST_WACOM_ISDV4_524C_PEN)
|
||||
return LITEST_NOT_APPLICABLE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue