mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-06-18 22:28:24 +02:00
util: rename the pressure range parser to a more generic range_parser
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
f13abd202a
commit
e08a76674a
4 changed files with 9 additions and 9 deletions
|
|
@ -2614,7 +2614,7 @@ tp_init_pressure(struct tp_dispatch *tp,
|
|||
prop = udev_device_get_property_value(device->udev_device,
|
||||
"LIBINPUT_ATTR_PRESSURE_RANGE");
|
||||
if (prop) {
|
||||
if (!parse_pressure_range_property(prop, &hi, &lo)) {
|
||||
if (!parse_range_property(prop, &hi, &lo)) {
|
||||
evdev_log_bug_client(device,
|
||||
"discarding invalid pressure range '%s'\n",
|
||||
prop);
|
||||
|
|
|
|||
|
|
@ -379,7 +379,7 @@ parse_tpkbcombo_layout_poperty(const char *prop,
|
|||
* @return true on success, false otherwise
|
||||
*/
|
||||
bool
|
||||
parse_pressure_range_property(const char *prop, int *hi, int *lo)
|
||||
parse_range_property(const char *prop, int *hi, int *lo)
|
||||
{
|
||||
int first, second;
|
||||
|
||||
|
|
|
|||
|
|
@ -388,7 +388,7 @@ int parse_mouse_wheel_click_count_property(const char *prop);
|
|||
double parse_trackpoint_accel_property(const char *prop);
|
||||
bool parse_dimension_property(const char *prop, size_t *width, size_t *height);
|
||||
bool parse_calibration_property(const char *prop, float calibration[6]);
|
||||
bool parse_pressure_range_property(const char *prop, int *hi, int *lo);
|
||||
bool parse_range_property(const char *prop, int *hi, int *lo);
|
||||
int parse_palm_pressure_property(const char *prop);
|
||||
|
||||
enum tpkbcombo_layout {
|
||||
|
|
|
|||
|
|
@ -1002,15 +1002,15 @@ START_TEST(calibration_prop_parser)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
struct parser_test_pressure_range {
|
||||
struct parser_test_range {
|
||||
char *tag;
|
||||
bool success;
|
||||
int hi, lo;
|
||||
};
|
||||
|
||||
START_TEST(pressure_range_prop_parser)
|
||||
START_TEST(range_prop_parser)
|
||||
{
|
||||
struct parser_test_pressure_range tests[] = {
|
||||
struct parser_test_range tests[] = {
|
||||
{ "10:8", true, 10, 8 },
|
||||
{ "100:-1", true, 100, -1 },
|
||||
{ "-203813:-502023", true, -203813, -502023 },
|
||||
|
|
@ -1028,7 +1028,7 @@ START_TEST(pressure_range_prop_parser)
|
|||
|
||||
for (i = 0; tests[i].tag != NULL; i++) {
|
||||
hi = lo = 0xad;
|
||||
success = parse_pressure_range_property(tests[i].tag, &hi, &lo);
|
||||
success = parse_range_property(tests[i].tag, &hi, &lo);
|
||||
ck_assert(success == tests[i].success);
|
||||
if (success) {
|
||||
ck_assert_int_eq(hi, tests[i].hi);
|
||||
|
|
@ -1039,7 +1039,7 @@ START_TEST(pressure_range_prop_parser)
|
|||
}
|
||||
}
|
||||
|
||||
success = parse_pressure_range_property(NULL, NULL, NULL);
|
||||
success = parse_range_property(NULL, NULL, NULL);
|
||||
ck_assert(success == false);
|
||||
}
|
||||
END_TEST
|
||||
|
|
@ -1373,7 +1373,7 @@ litest_setup_tests_misc(void)
|
|||
litest_add_no_device("misc:parser", dimension_prop_parser);
|
||||
litest_add_no_device("misc:parser", reliability_prop_parser);
|
||||
litest_add_no_device("misc:parser", calibration_prop_parser);
|
||||
litest_add_no_device("misc:parser", pressure_range_prop_parser);
|
||||
litest_add_no_device("misc:parser", range_prop_parser);
|
||||
litest_add_no_device("misc:parser", palm_pressure_parser);
|
||||
litest_add_no_device("misc:parser", safe_atoi_test);
|
||||
litest_add_no_device("misc:parser", safe_atod_test);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue