| 1 |
/* |
| 2 |
* Copyright © 2014 Red Hat, Inc. |
| 3 |
* |
| 4 |
* Permission is hereby granted, free of charge, to any person obtaining a |
| 5 |
* copy of this software and associated documentation files (the "Software"), |
| 6 |
* to deal in the Software without restriction, including without limitation |
| 7 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 |
* and/or sell copies of the Software, and to permit persons to whom the |
| 9 |
* Software is furnished to do so, subject to the following conditions: |
| 10 |
* |
| 11 |
* The above copyright notice and this permission notice (including the next |
| 12 |
* paragraph) shall be included in all copies or substantial portions of the |
| 13 |
* Software. |
| 14 |
* |
| 15 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 20 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 21 |
* DEALINGS IN THE SOFTWARE. |
| 22 |
*/ |
| 23 |
|
| 24 |
#include <config.h> |
| 25 |
|
| 26 |
#include <errno.h> |
| 27 |
#include <fcntl.h> |
| 28 |
#include <libinput.h> |
| 29 |
#include <unistd.h> |
| 30 |
|
| 31 |
#include "libinput-util.h" |
| 32 |
#include "litest.h" |
| 33 |
|
| 34 |
static inline bool |
| 35 |
has_disable_while_typing(struct litest_device *device) |
| 36 |
{ |
| 37 |
return libinput_device_config_dwt_is_available(device->libinput_device); |
| 38 |
} |
| 39 |
|
| 40 |
static inline struct litest_device * |
| 41 |
dwt_init_paired_keyboard(struct libinput *li, struct litest_device *touchpad) |
| 42 |
{ |
| 43 |
enum litest_device_type which = LITEST_KEYBOARD; |
| 44 |
|
| 45 |
if (libevdev_get_id_vendor(touchpad->evdev) == VENDOR_ID_APPLE) |
| 46 |
which = LITEST_APPLE_KEYBOARD; |
| 47 |
|
| 48 |
if (libevdev_get_id_vendor(touchpad->evdev) == VENDOR_ID_CHICONY) |
| 49 |
which = LITEST_ACER_HAWAII_KEYBOARD; |
| 50 |
|
| 51 |
if (libevdev_get_id_vendor(touchpad->evdev) == VENDOR_ID_GENERIC) |
| 52 |
which = LITEST_GENERIC_USBCOMBO_KEYBOARD; |
| 53 |
|
| 54 |
return litest_add_device(li, which); |
| 55 |
} |
| 56 |
|
| 57 |
START_TEST(touchpad_1fg_motion) |
| 58 |
{ |
| 59 |
struct litest_device *dev = litest_current_device(); |
| 60 |
struct libinput *li = dev->libinput; |
| 61 |
struct libinput_event *event; |
| 62 |
|
| 63 |
litest_disable_tap(dev->libinput_device); |
| 64 |
litest_disable_hold_gestures(dev->libinput_device); |
| 65 |
litest_drain_events(li); |
| 66 |
|
| 67 |
litest_touch_down(dev, 0, 50, 50); |
| 68 |
litest_touch_move_to(dev, 0, 50, 50, 80, 50, 20); |
| 69 |
litest_touch_up(dev, 0); |
| 70 |
|
| 71 |
litest_dispatch(li); |
| 72 |
|
| 73 |
event = libinput_get_event(li); |
| 74 |
litest_assert_notnull(event); |
| 75 |
|
| 76 |
while (event) { |
| 77 |
struct libinput_event_pointer *ptrev; |
| 78 |
|
| 79 |
ptrev = litest_is_motion_event(event); |
| 80 |
litest_assert_double_ge(libinput_event_pointer_get_dx(ptrev), 0); |
| 81 |
litest_assert_double_eq(libinput_event_pointer_get_dy(ptrev), 0); |
| 82 |
libinput_event_destroy(event); |
| 83 |
event = libinput_get_event(li); |
| 84 |
} |
| 85 |
} |
| 86 |
END_TEST |
| 87 |
|
| 88 |
START_TEST(touchpad_2fg_no_motion) |
| 89 |
{ |
| 90 |
struct litest_device *dev = litest_current_device(); |
| 91 |
struct libinput *li = dev->libinput; |
| 92 |
struct libinput_event *event; |
| 93 |
|
| 94 |
libinput_device_config_tap_set_enabled(dev->libinput_device, |
| 95 |
LIBINPUT_CONFIG_TAP_DISABLED); |
| 96 |
|
| 97 |
litest_drain_events(li); |
| 98 |
|
| 99 |
litest_touch_down(dev, 0, 20, 20); |
| 100 |
litest_touch_down(dev, 1, 70, 20); |
| 101 |
litest_touch_move_two_touches(dev, 20, 20, 70, 20, 20, 30, 20); |
| 102 |
litest_touch_up(dev, 1); |
| 103 |
litest_touch_up(dev, 0); |
| 104 |
|
| 105 |
litest_dispatch(li); |
| 106 |
|
| 107 |
event = libinput_get_event(li); |
| 108 |
while (event) { |
| 109 |
litest_assert_enum_ne(libinput_event_get_type(event), |
| 110 |
LIBINPUT_EVENT_POINTER_MOTION); |
| 111 |
libinput_event_destroy(event); |
| 112 |
event = libinput_get_event(li); |
| 113 |
} |
| 114 |
} |
| 115 |
END_TEST |
| 116 |
|
| 117 |
static void |
| 118 |
test_2fg_scroll(struct litest_device *dev, double dx, double dy, bool want_sleep) |
| 119 |
{ |
| 120 |
struct libinput *li = dev->libinput; |
| 121 |
|
| 122 |
litest_touch_down(dev, 0, 49, 50); |
| 123 |
litest_touch_down(dev, 1, 51, 50); |
| 124 |
|
| 125 |
litest_touch_move_two_touches(dev, 49, 50, 51, 50, dx, dy, 10); |
| 126 |
|
| 127 |
/* Avoid a small scroll being seen as a tap */ |
| 128 |
if (want_sleep) { |
| 129 |
litest_timeout_tap(li); |
| 130 |
} |
| 131 |
|
| 132 |
litest_touch_up(dev, 1); |
| 133 |
litest_touch_up(dev, 0); |
| 134 |
|
| 135 |
litest_dispatch(li); |
| 136 |
} |
| 137 |
|
| 138 |
START_TEST(touchpad_2fg_scroll) |
| 139 |
{ |
| 140 |
struct litest_device *dev = litest_current_device(); |
| 141 |
struct libinput *li = dev->libinput; |
| 142 |
|
| 143 |
if (!litest_has_2fg_scroll(dev)) |
| 144 |
return LITEST_NOT_APPLICABLE; |
| 145 |
|
| 146 |
litest_enable_2fg_scroll(dev); |
| 147 |
litest_disable_hold_gestures(dev->libinput_device); |
| 148 |
litest_drain_events(li); |
| 149 |
|
| 150 |
test_2fg_scroll(dev, 0.1, 40, false); |
| 151 |
litest_assert_scroll(li, |
| 152 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 153 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, |
| 154 |
9); |
| 155 |
test_2fg_scroll(dev, 0.1, -40, false); |
| 156 |
litest_assert_scroll(li, |
| 157 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 158 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, |
| 159 |
-9); |
| 160 |
test_2fg_scroll(dev, 40, 0.1, false); |
| 161 |
litest_assert_scroll(li, |
| 162 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 163 |
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, |
| 164 |
9); |
| 165 |
test_2fg_scroll(dev, -40, 0.1, false); |
| 166 |
litest_assert_scroll(li, |
| 167 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 168 |
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, |
| 169 |
-9); |
| 170 |
|
| 171 |
/* 2fg scroll smaller than the threshold should not generate events */ |
| 172 |
test_2fg_scroll(dev, 0.1, 0.1, true); |
| 173 |
litest_assert_empty_queue(li); |
| 174 |
} |
| 175 |
END_TEST |
| 176 |
|
| 177 |
START_TEST(touchpad_2fg_scroll_initially_diagonal) |
| 178 |
{ |
| 179 |
struct litest_device *dev = litest_current_device(); |
| 180 |
struct libinput *li = dev->libinput; |
| 181 |
struct libinput_event *event; |
| 182 |
int i; |
| 183 |
int expected_nevents; |
| 184 |
double w, h; |
| 185 |
double ratio; |
| 186 |
double ydelta; |
| 187 |
|
| 188 |
if (!litest_has_2fg_scroll(dev)) |
| 189 |
return LITEST_NOT_APPLICABLE; |
| 190 |
|
| 191 |
litest_assert_int_eq(libinput_device_get_size(dev->libinput_device, &w, &h), 0); |
| 192 |
ratio = w / h; |
| 193 |
litest_enable_2fg_scroll(dev); |
| 194 |
litest_drain_events(li); |
| 195 |
|
| 196 |
litest_touch_down(dev, 0, 45, 30); |
| 197 |
litest_touch_down(dev, 1, 55, 30); |
| 198 |
|
| 199 |
/* start diagonally */ |
| 200 |
ydelta = 15 * ratio; |
| 201 |
litest_touch_move_two_touches(dev, 45, 30, 55, 30, 15, ydelta, 10); |
| 202 |
litest_dispatch(li); |
| 203 |
litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS); |
| 204 |
litest_drain_events(li); |
| 205 |
|
| 206 |
/* get rid of any touch history still adding x deltas sideways */ |
| 207 |
for (i = 0; i < 5; i++) |
| 208 |
litest_touch_move(dev, 0, 60, 30 + ydelta + (i * ratio)); |
| 209 |
litest_drain_events(li); |
| 210 |
|
| 211 |
/* scroll vertical only and make sure the horiz axis is never set */ |
| 212 |
expected_nevents = 0; |
| 213 |
for (i = 6; i < 15; i++) { |
| 214 |
litest_touch_move(dev, 0, 60, 30 + ydelta + i * ratio); |
| 215 |
expected_nevents++; |
| 216 |
} |
| 217 |
|
| 218 |
/* both high-resolution and low-resolution events are generated */ |
| 219 |
expected_nevents *= 2; |
| 220 |
|
| 221 |
litest_dispatch(li); |
| 222 |
event = libinput_get_event(li); |
| 223 |
|
| 224 |
do { |
| 225 |
struct libinput_event_pointer *ptrev; |
| 226 |
|
| 227 |
ptrev = litest_is_axis_event(event, |
| 228 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 229 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, |
| 230 |
LIBINPUT_POINTER_AXIS_SOURCE_FINGER); |
| 231 |
litest_assert(!libinput_event_pointer_has_axis( |
| 232 |
ptrev, |
| 233 |
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL)); |
| 234 |
libinput_event_destroy(event); |
| 235 |
event = libinput_get_event(li); |
| 236 |
expected_nevents--; |
| 237 |
} while (event); |
| 238 |
|
| 239 |
litest_assert_int_eq(expected_nevents, 0); |
| 240 |
|
| 241 |
litest_touch_up(dev, 1); |
| 242 |
litest_touch_up(dev, 0); |
| 243 |
litest_dispatch(li); |
| 244 |
} |
| 245 |
END_TEST |
| 246 |
|
| 247 |
static bool |
| 248 |
is_single_axis_2fg_scroll(struct litest_device *dev, enum libinput_pointer_axis axis) |
| 249 |
{ |
| 250 |
struct libinput *li = dev->libinput; |
| 251 |
struct libinput_event *event; |
| 252 |
struct libinput_event_pointer *ptrev; |
| 253 |
enum libinput_pointer_axis on_axis = axis; |
| 254 |
enum libinput_pointer_axis off_axis = |
| 255 |
(axis == LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL) |
| 256 |
? LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL |
| 257 |
: LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL; |
| 258 |
bool has_on_axis, has_off_axis; |
| 259 |
bool val = true; |
| 260 |
|
| 261 |
event = libinput_get_event(li); |
| 262 |
while (event) { |
| 263 |
ptrev = litest_is_axis_event(event, |
| 264 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 265 |
on_axis, |
| 266 |
LIBINPUT_POINTER_AXIS_SOURCE_FINGER); |
| 267 |
|
| 268 |
has_on_axis = libinput_event_pointer_has_axis(ptrev, on_axis); |
| 269 |
has_off_axis = libinput_event_pointer_has_axis(ptrev, off_axis); |
| 270 |
|
| 271 |
if (has_on_axis && has_off_axis) { |
| 272 |
val = (litest_event_pointer_get_value(ptrev, off_axis) == 0.0); |
| 273 |
|
| 274 |
/* There must be an extra low/high-resolution event with |
| 275 |
* the same axis value (0.0). */ |
| 276 |
libinput_event_destroy(event); |
| 277 |
event = libinput_get_event(li); |
| 278 |
litest_assert_notnull(event); |
| 279 |
ptrev = litest_is_axis_event( |
| 280 |
event, |
| 281 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 282 |
on_axis, |
| 283 |
LIBINPUT_POINTER_AXIS_SOURCE_FINGER); |
| 284 |
litest_assert(val == (litest_event_pointer_get_value( |
| 285 |
ptrev, |
| 286 |
off_axis) == 0.0)); |
| 287 |
break; |
| 288 |
} |
| 289 |
|
| 290 |
litest_assert(has_on_axis); |
| 291 |
litest_assert(!has_off_axis); |
| 292 |
|
| 293 |
libinput_event_destroy(event); |
| 294 |
event = libinput_get_event(li); |
| 295 |
} |
| 296 |
|
| 297 |
libinput_event_destroy(event); |
| 298 |
return val; |
| 299 |
} |
| 300 |
|
| 301 |
START_TEST(touchpad_2fg_scroll_axis_lock) |
| 302 |
{ |
| 303 |
struct litest_device *dev = litest_current_device(); |
| 304 |
struct libinput *li = dev->libinput; |
| 305 |
enum libinput_pointer_axis axis; |
| 306 |
double delta[4][2] = { |
| 307 |
{ 7, 40 }, |
| 308 |
{ 7, -40 }, |
| 309 |
{ -7, 40 }, |
| 310 |
{ -7, -40 }, |
| 311 |
}; |
| 312 |
/* 10 degrees off from horiz/vert should count as straight */ |
| 313 |
|
| 314 |
if (!litest_has_2fg_scroll(dev)) |
| 315 |
return LITEST_NOT_APPLICABLE; |
| 316 |
|
| 317 |
litest_enable_2fg_scroll(dev); |
| 318 |
litest_drain_events(li); |
| 319 |
|
| 320 |
axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL; |
| 321 |
for (int i = 0; i < 4; i++) { |
| 322 |
test_2fg_scroll(dev, delta[i][0], delta[i][1], false); |
| 323 |
litest_assert(is_single_axis_2fg_scroll(dev, axis)); |
| 324 |
litest_assert_empty_queue(li); |
| 325 |
} |
| 326 |
|
| 327 |
axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL; |
| 328 |
for (int i = 0; i < 4; i++) { |
| 329 |
test_2fg_scroll(dev, delta[i][1], delta[i][0], false); |
| 330 |
litest_assert(is_single_axis_2fg_scroll(dev, axis)); |
| 331 |
litest_assert_empty_queue(li); |
| 332 |
} |
| 333 |
} |
| 334 |
END_TEST |
| 335 |
|
| 336 |
START_TEST(touchpad_2fg_scroll_axis_lock_switch) |
| 337 |
{ |
| 338 |
struct litest_device *dev = litest_current_device(); |
| 339 |
struct libinput *li = dev->libinput; |
| 340 |
enum libinput_pointer_axis axis; |
| 341 |
|
| 342 |
if (!litest_has_2fg_scroll(dev)) |
| 343 |
return LITEST_NOT_APPLICABLE; |
| 344 |
|
| 345 |
litest_enable_2fg_scroll(dev); |
| 346 |
litest_drain_events(li); |
| 347 |
|
| 348 |
litest_touch_down(dev, 0, 20, 20); |
| 349 |
litest_touch_down(dev, 1, 25, 20); |
| 350 |
|
| 351 |
/* Move roughly straight horizontally for >100ms to set axis lock */ |
| 352 |
litest_touch_move_two_touches(dev, 20, 20, 25, 20, 55, 10, 15); |
| 353 |
litest_dispatch(li); |
| 354 |
litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS); |
| 355 |
|
| 356 |
axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL; |
| 357 |
litest_assert(is_single_axis_2fg_scroll(dev, axis)); |
| 358 |
litest_drain_events(li); |
| 359 |
|
| 360 |
msleep(200); |
| 361 |
litest_dispatch(li); |
| 362 |
|
| 363 |
/* Move roughly vertically for >100ms to switch axis lock. This will |
| 364 |
* contain some horizontal movement while the lock changes; don't |
| 365 |
* check for single-axis yet |
| 366 |
*/ |
| 367 |
litest_touch_move_two_touches(dev, 75, 30, 80, 30, 2, 20, 15); |
| 368 |
litest_dispatch(li); |
| 369 |
litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS); |
| 370 |
litest_drain_events(li); |
| 371 |
|
| 372 |
/* Move some more, roughly vertically, and check new axis lock */ |
| 373 |
litest_touch_move_two_touches(dev, 77, 50, 82, 50, 1, 40, 15); |
| 374 |
litest_dispatch(li); |
| 375 |
litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS); |
| 376 |
|
| 377 |
axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL; |
| 378 |
litest_assert(is_single_axis_2fg_scroll(dev, axis)); |
| 379 |
litest_drain_events(li); |
| 380 |
|
| 381 |
/* Move in a clear diagonal direction to ensure the lock releases */ |
| 382 |
litest_touch_move_two_touches(dev, 78, 90, 83, 90, -60, -60, 20); |
| 383 |
litest_dispatch(li); |
| 384 |
litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS); |
| 385 |
|
| 386 |
axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL; |
| 387 |
litest_assert(!is_single_axis_2fg_scroll(dev, axis)); |
| 388 |
|
| 389 |
litest_touch_up(dev, 1); |
| 390 |
litest_touch_up(dev, 0); |
| 391 |
litest_dispatch(li); |
| 392 |
litest_drain_events(li); |
| 393 |
} |
| 394 |
END_TEST |
| 395 |
|
| 396 |
START_TEST(touchpad_2fg_scroll_slow_distance) |
| 397 |
{ |
| 398 |
struct litest_device *dev = litest_current_device(); |
| 399 |
struct libinput *li = dev->libinput; |
| 400 |
struct libinput_event *event; |
| 401 |
double width, height; |
| 402 |
double y_move = 100; |
| 403 |
bool last_hi_res_event_found, last_low_res_event_found; |
| 404 |
|
| 405 |
if (!litest_has_2fg_scroll(dev)) |
| 406 |
return LITEST_NOT_APPLICABLE; |
| 407 |
|
| 408 |
last_hi_res_event_found = false; |
| 409 |
last_low_res_event_found = false; |
| 410 |
|
| 411 |
/* We want to move > 5 mm. */ |
| 412 |
litest_assert_int_eq( |
| 413 |
libinput_device_get_size(dev->libinput_device, &width, &height), |
| 414 |
0); |
| 415 |
y_move = 100.0 / height * 7; |
| 416 |
|
| 417 |
litest_enable_2fg_scroll(dev); |
| 418 |
litest_disable_hold_gestures(dev->libinput_device); |
| 419 |
litest_drain_events(li); |
| 420 |
|
| 421 |
litest_touch_down(dev, 0, 49, 50); |
| 422 |
litest_touch_down(dev, 1, 51, 50); |
| 423 |
litest_touch_move_two_touches(dev, 49, 50, 51, 50, 0, y_move, 100); |
| 424 |
litest_touch_up(dev, 1); |
| 425 |
litest_touch_up(dev, 0); |
| 426 |
litest_dispatch(li); |
| 427 |
|
| 428 |
event = libinput_get_event(li); |
| 429 |
litest_assert_notnull(event); |
| 430 |
|
| 431 |
while (event) { |
| 432 |
struct libinput_event_pointer *ptrev; |
| 433 |
double axisval; |
| 434 |
|
| 435 |
ptrev = litest_is_axis_event(event, |
| 436 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 437 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, |
| 438 |
0); |
| 439 |
axisval = litest_event_pointer_get_value( |
| 440 |
ptrev, |
| 441 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); |
| 442 |
|
| 443 |
if (litest_is_high_res_axis_event(event)) { |
| 444 |
litest_assert(!last_hi_res_event_found); |
| 445 |
if (axisval == 0) |
| 446 |
last_hi_res_event_found = true; |
| 447 |
} else { |
| 448 |
litest_assert(!last_low_res_event_found); |
| 449 |
if (axisval == 0) |
| 450 |
last_low_res_event_found = true; |
| 451 |
} |
| 452 |
|
| 453 |
litest_assert(axisval >= 0.0); |
| 454 |
|
| 455 |
/* this is to verify we test the right thing, if the value |
| 456 |
is greater than scroll.threshold we triggered the wrong |
| 457 |
condition */ |
| 458 |
litest_assert(axisval < 5.0); |
| 459 |
|
| 460 |
libinput_event_destroy(event); |
| 461 |
event = libinput_get_event(li); |
| 462 |
} |
| 463 |
|
| 464 |
litest_assert(last_low_res_event_found); |
| 465 |
litest_assert(last_hi_res_event_found); |
| 466 |
litest_assert_empty_queue(li); |
| 467 |
libinput_event_destroy(event); |
| 468 |
} |
| 469 |
END_TEST |
| 470 |
|
| 471 |
START_TEST(touchpad_2fg_scroll_source) |
| 472 |
{ |
| 473 |
struct litest_device *dev = litest_current_device(); |
| 474 |
struct libinput *li = dev->libinput; |
| 475 |
struct libinput_event *event; |
| 476 |
|
| 477 |
if (!litest_has_2fg_scroll(dev)) |
| 478 |
return LITEST_NOT_APPLICABLE; |
| 479 |
|
| 480 |
litest_enable_2fg_scroll(dev); |
| 481 |
litest_drain_events(li); |
| 482 |
|
| 483 |
test_2fg_scroll(dev, 0, 30, false); |
| 484 |
litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS); |
| 485 |
|
| 486 |
while ((event = libinput_get_event(li))) { |
| 487 |
litest_is_axis_event(event, |
| 488 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 489 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, |
| 490 |
LIBINPUT_POINTER_AXIS_SOURCE_FINGER); |
| 491 |
libinput_event_destroy(event); |
| 492 |
} |
| 493 |
} |
| 494 |
END_TEST |
| 495 |
|
| 496 |
START_TEST(touchpad_2fg_scroll_semi_mt) |
| 497 |
{ |
| 498 |
struct litest_device *dev = litest_current_device(); |
| 499 |
struct libinput *li = dev->libinput; |
| 500 |
|
| 501 |
if (!litest_has_2fg_scroll(dev)) |
| 502 |
return LITEST_NOT_APPLICABLE; |
| 503 |
|
| 504 |
litest_enable_2fg_scroll(dev); |
| 505 |
litest_drain_events(li); |
| 506 |
|
| 507 |
litest_touch_down(dev, 0, 20, 20); |
| 508 |
litest_touch_down(dev, 1, 30, 20); |
| 509 |
litest_dispatch(li); |
| 510 |
litest_touch_move_two_touches(dev, 20, 20, 30, 20, 30, 40, 10); |
| 511 |
|
| 512 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 513 |
} |
| 514 |
END_TEST |
| 515 |
|
| 516 |
START_TEST(touchpad_2fg_scroll_return_to_motion) |
| 517 |
{ |
| 518 |
struct litest_device *dev = litest_current_device(); |
| 519 |
struct libinput *li = dev->libinput; |
| 520 |
|
| 521 |
if (!litest_has_2fg_scroll(dev)) |
| 522 |
return LITEST_NOT_APPLICABLE; |
| 523 |
|
| 524 |
litest_enable_2fg_scroll(dev); |
| 525 |
litest_drain_events(li); |
| 526 |
|
| 527 |
/* start with motion */ |
| 528 |
litest_touch_down(dev, 0, 70, 70); |
| 529 |
litest_touch_move_to(dev, 0, 70, 70, 49, 50, 10); |
| 530 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 531 |
|
| 532 |
/* 2fg scroll */ |
| 533 |
litest_touch_down(dev, 1, 51, 50); |
| 534 |
litest_touch_move_two_touches(dev, 49, 50, 51, 50, 0, 20, 5); |
| 535 |
litest_touch_up(dev, 1); |
| 536 |
litest_dispatch(li); |
| 537 |
litest_timeout_finger_switch(li); |
| 538 |
litest_dispatch(li); |
| 539 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 540 |
|
| 541 |
litest_touch_move_to(dev, 0, 49, 70, 49, 50, 10); |
| 542 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 543 |
|
| 544 |
/* back to 2fg scroll, lifting the other finger */ |
| 545 |
litest_touch_down(dev, 1, 51, 50); |
| 546 |
litest_touch_move_two_touches(dev, 49, 50, 51, 50, 0, 20, 5); |
| 547 |
litest_touch_up(dev, 0); |
| 548 |
litest_dispatch(li); |
| 549 |
litest_timeout_finger_switch(li); |
| 550 |
litest_dispatch(li); |
| 551 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 552 |
|
| 553 |
/* move with second finger */ |
| 554 |
litest_touch_move_to(dev, 1, 51, 70, 51, 50, 10); |
| 555 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 556 |
|
| 557 |
litest_touch_up(dev, 1); |
| 558 |
litest_assert_empty_queue(li); |
| 559 |
} |
| 560 |
END_TEST |
| 561 |
|
| 562 |
START_TEST(touchpad_2fg_scroll_from_btnareas) |
| 563 |
{ |
| 564 |
struct litest_device *dev = litest_current_device(); |
| 565 |
struct libinput *li = dev->libinput; |
| 566 |
|
| 567 |
if (!litest_has_2fg_scroll(dev) || !litest_has_btnareas(dev)) |
| 568 |
return LITEST_NOT_APPLICABLE; |
| 569 |
|
| 570 |
litest_enable_2fg_scroll(dev); |
| 571 |
litest_enable_buttonareas(dev); |
| 572 |
litest_drain_events(li); |
| 573 |
|
| 574 |
litest_touch_down(dev, 0, 30, 95); |
| 575 |
litest_touch_down(dev, 1, 50, 95); |
| 576 |
litest_dispatch(li); |
| 577 |
|
| 578 |
/* First finger moves out of the area first but it's a scroll |
| 579 |
* motion, should not trigger POINTER_MOTION */ |
| 580 |
for (int i = 0; i < 5; i++) { |
| 581 |
litest_touch_move(dev, 0, 30, 95 - i); |
| 582 |
} |
| 583 |
litest_dispatch(li); |
| 584 |
|
| 585 |
for (int i = 0; i < 20; i++) { |
| 586 |
litest_touch_move(dev, 0, 30, 90 - i); |
| 587 |
litest_touch_move(dev, 1, 50, 95 - i); |
| 588 |
} |
| 589 |
litest_dispatch(li); |
| 590 |
|
| 591 |
litest_touch_up(dev, 0); |
| 592 |
litest_touch_up(dev, 1); |
| 593 |
|
| 594 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 595 |
} |
| 596 |
END_TEST |
| 597 |
|
| 598 |
START_TEST(touchpad_scroll_natural_defaults) |
| 599 |
{ |
| 600 |
struct litest_device *dev = litest_current_device(); |
| 601 |
|
| 602 |
int enabled = libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_APPLE; |
| 603 |
|
| 604 |
litest_assert_int_ge( |
| 605 |
libinput_device_config_scroll_has_natural_scroll(dev->libinput_device), |
| 606 |
1); |
| 607 |
litest_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled( |
| 608 |
dev->libinput_device), |
| 609 |
enabled); |
| 610 |
litest_assert_int_eq( |
| 611 |
libinput_device_config_scroll_get_default_natural_scroll_enabled( |
| 612 |
dev->libinput_device), |
| 613 |
enabled); |
| 614 |
} |
| 615 |
END_TEST |
| 616 |
|
| 617 |
START_TEST(touchpad_scroll_natural_enable_config) |
| 618 |
{ |
| 619 |
struct litest_device *dev = litest_current_device(); |
| 620 |
enum libinput_config_status status; |
| 621 |
|
| 622 |
status = libinput_device_config_scroll_set_natural_scroll_enabled( |
| 623 |
dev->libinput_device, |
| 624 |
1); |
| 625 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 626 |
litest_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled( |
| 627 |
dev->libinput_device), |
| 628 |
1); |
| 629 |
|
| 630 |
status = libinput_device_config_scroll_set_natural_scroll_enabled( |
| 631 |
dev->libinput_device, |
| 632 |
0); |
| 633 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 634 |
litest_assert_int_eq(libinput_device_config_scroll_get_natural_scroll_enabled( |
| 635 |
dev->libinput_device), |
| 636 |
0); |
| 637 |
} |
| 638 |
END_TEST |
| 639 |
|
| 640 |
START_TEST(touchpad_scroll_natural_2fg) |
| 641 |
{ |
| 642 |
struct litest_device *dev = litest_current_device(); |
| 643 |
struct libinput *li = dev->libinput; |
| 644 |
|
| 645 |
if (!litest_has_2fg_scroll(dev)) |
| 646 |
return LITEST_NOT_APPLICABLE; |
| 647 |
|
| 648 |
litest_enable_2fg_scroll(dev); |
| 649 |
litest_drain_events(li); |
| 650 |
|
| 651 |
libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, |
| 652 |
1); |
| 653 |
|
| 654 |
test_2fg_scroll(dev, 0.1, 40, false); |
| 655 |
litest_assert_scroll(li, |
| 656 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 657 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, |
| 658 |
-9); |
| 659 |
test_2fg_scroll(dev, 0.1, -40, false); |
| 660 |
litest_assert_scroll(li, |
| 661 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 662 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, |
| 663 |
9); |
| 664 |
test_2fg_scroll(dev, 40, 0.1, false); |
| 665 |
litest_assert_scroll(li, |
| 666 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 667 |
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, |
| 668 |
-9); |
| 669 |
test_2fg_scroll(dev, -40, 0.1, false); |
| 670 |
litest_assert_scroll(li, |
| 671 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 672 |
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, |
| 673 |
9); |
| 674 |
} |
| 675 |
END_TEST |
| 676 |
|
| 677 |
START_TEST(touchpad_scroll_natural_edge) |
| 678 |
{ |
| 679 |
struct litest_device *dev = litest_current_device(); |
| 680 |
struct libinput *li = dev->libinput; |
| 681 |
|
| 682 |
litest_enable_edge_scroll(dev); |
| 683 |
litest_drain_events(li); |
| 684 |
|
| 685 |
libinput_device_config_scroll_set_natural_scroll_enabled(dev->libinput_device, |
| 686 |
1); |
| 687 |
|
| 688 |
litest_touch_down(dev, 0, 99, 20); |
| 689 |
litest_touch_move_to(dev, 0, 99, 20, 99, 80, 10); |
| 690 |
litest_touch_up(dev, 0); |
| 691 |
|
| 692 |
litest_dispatch(li); |
| 693 |
litest_assert_scroll(li, |
| 694 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 695 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, |
| 696 |
-4); |
| 697 |
litest_assert_empty_queue(li); |
| 698 |
|
| 699 |
litest_touch_down(dev, 0, 99, 80); |
| 700 |
litest_touch_move_to(dev, 0, 99, 80, 99, 20, 10); |
| 701 |
litest_touch_up(dev, 0); |
| 702 |
|
| 703 |
litest_dispatch(li); |
| 704 |
litest_assert_scroll(li, |
| 705 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 706 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, |
| 707 |
4); |
| 708 |
litest_assert_empty_queue(li); |
| 709 |
} |
| 710 |
END_TEST |
| 711 |
|
| 712 |
START_TEST(touchpad_edge_scroll_vert) |
| 713 |
{ |
| 714 |
struct litest_device *dev = litest_current_device(); |
| 715 |
struct libinput *li = dev->libinput; |
| 716 |
|
| 717 |
litest_touch_down(dev, 0, 99, 20); |
| 718 |
litest_touch_move_to(dev, 0, 99, 20, 99, 80, 10); |
| 719 |
litest_touch_up(dev, 0); |
| 720 |
|
| 721 |
litest_drain_events(li); |
| 722 |
litest_enable_edge_scroll(dev); |
| 723 |
|
| 724 |
litest_touch_down(dev, 0, 99, 20); |
| 725 |
litest_touch_move_to(dev, 0, 99, 20, 99, 80, 10); |
| 726 |
litest_touch_up(dev, 0); |
| 727 |
|
| 728 |
litest_dispatch(li); |
| 729 |
litest_assert_scroll(li, |
| 730 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 731 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, |
| 732 |
4); |
| 733 |
litest_assert_empty_queue(li); |
| 734 |
|
| 735 |
litest_touch_down(dev, 0, 99, 80); |
| 736 |
litest_touch_move_to(dev, 0, 99, 80, 99, 20, 10); |
| 737 |
litest_touch_up(dev, 0); |
| 738 |
|
| 739 |
litest_dispatch(li); |
| 740 |
litest_assert_scroll(li, |
| 741 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 742 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, |
| 743 |
-4); |
| 744 |
litest_assert_empty_queue(li); |
| 745 |
} |
| 746 |
END_TEST |
| 747 |
|
| 748 |
static int |
| 749 |
touchpad_has_horiz_edge_scroll_size(struct litest_device *dev) |
| 750 |
{ |
| 751 |
double width, height; |
| 752 |
int rc; |
| 753 |
|
| 754 |
rc = libinput_device_get_size(dev->libinput_device, &width, &height); |
| 755 |
|
| 756 |
return rc == 0 && height >= 40; |
| 757 |
} |
| 758 |
|
| 759 |
START_TEST(touchpad_edge_scroll_horiz) |
| 760 |
{ |
| 761 |
struct litest_device *dev = litest_current_device(); |
| 762 |
struct libinput *li = dev->libinput; |
| 763 |
|
| 764 |
litest_touch_down(dev, 0, 99, 20); |
| 765 |
litest_touch_move_to(dev, 0, 99, 20, 99, 80, 10); |
| 766 |
litest_touch_up(dev, 0); |
| 767 |
|
| 768 |
if (!touchpad_has_horiz_edge_scroll_size(dev)) |
| 769 |
return LITEST_NOT_APPLICABLE; |
| 770 |
|
| 771 |
litest_drain_events(li); |
| 772 |
litest_enable_edge_scroll(dev); |
| 773 |
|
| 774 |
litest_touch_down(dev, 0, 20, 99); |
| 775 |
litest_touch_move_to(dev, 0, 20, 99, 70, 99, 10); |
| 776 |
litest_touch_up(dev, 0); |
| 777 |
|
| 778 |
litest_dispatch(li); |
| 779 |
litest_assert_scroll(li, |
| 780 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 781 |
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, |
| 782 |
4); |
| 783 |
litest_assert_empty_queue(li); |
| 784 |
|
| 785 |
litest_touch_down(dev, 0, 70, 99); |
| 786 |
litest_touch_move_to(dev, 0, 70, 99, 20, 99, 10); |
| 787 |
litest_touch_up(dev, 0); |
| 788 |
|
| 789 |
litest_dispatch(li); |
| 790 |
litest_assert_scroll(li, |
| 791 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 792 |
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, |
| 793 |
-4); |
| 794 |
litest_assert_empty_queue(li); |
| 795 |
} |
| 796 |
END_TEST |
| 797 |
|
| 798 |
START_TEST(touchpad_edge_scroll_horiz_clickpad) |
| 799 |
{ |
| 800 |
struct litest_device *dev = litest_current_device(); |
| 801 |
struct libinput *li = dev->libinput; |
| 802 |
|
| 803 |
litest_drain_events(li); |
| 804 |
litest_enable_edge_scroll(dev); |
| 805 |
|
| 806 |
litest_touch_down(dev, 0, 20, 99); |
| 807 |
litest_touch_move_to(dev, 0, 20, 99, 70, 99, 15); |
| 808 |
litest_touch_up(dev, 0); |
| 809 |
|
| 810 |
litest_dispatch(li); |
| 811 |
litest_assert_scroll(li, |
| 812 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 813 |
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, |
| 814 |
4); |
| 815 |
litest_assert_empty_queue(li); |
| 816 |
|
| 817 |
litest_touch_down(dev, 0, 70, 99); |
| 818 |
litest_touch_move_to(dev, 0, 70, 99, 20, 99, 15); |
| 819 |
litest_touch_up(dev, 0); |
| 820 |
|
| 821 |
litest_dispatch(li); |
| 822 |
litest_assert_scroll(li, |
| 823 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 824 |
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, |
| 825 |
-4); |
| 826 |
litest_assert_empty_queue(li); |
| 827 |
} |
| 828 |
END_TEST |
| 829 |
|
| 830 |
START_TEST(touchpad_edge_scroll_no_horiz) |
| 831 |
{ |
| 832 |
struct litest_device *dev = litest_current_device(); |
| 833 |
struct libinput *li = dev->libinput; |
| 834 |
|
| 835 |
if (touchpad_has_horiz_edge_scroll_size(dev)) |
| 836 |
return LITEST_NOT_APPLICABLE; |
| 837 |
|
| 838 |
litest_drain_events(li); |
| 839 |
litest_enable_edge_scroll(dev); |
| 840 |
|
| 841 |
litest_touch_down(dev, 0, 20, 99); |
| 842 |
litest_touch_move_to(dev, 0, 20, 99, 70, 99, 10); |
| 843 |
litest_touch_up(dev, 0); |
| 844 |
|
| 845 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 846 |
|
| 847 |
litest_touch_down(dev, 0, 70, 99); |
| 848 |
litest_touch_move_to(dev, 0, 70, 99, 20, 99, 10); |
| 849 |
litest_touch_up(dev, 0); |
| 850 |
|
| 851 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 852 |
} |
| 853 |
END_TEST |
| 854 |
|
| 855 |
START_TEST(touchpad_scroll_defaults) |
| 856 |
{ |
| 857 |
struct litest_device *dev = litest_current_device(); |
| 858 |
struct libinput_device *device = dev->libinput_device; |
| 859 |
struct libevdev *evdev = dev->evdev; |
| 860 |
enum libinput_config_scroll_method method, expected; |
| 861 |
enum libinput_config_status status; |
| 862 |
bool should_have_2fg = false; |
| 863 |
|
| 864 |
if (libevdev_get_num_slots(evdev) > 1 || |
| 865 |
(libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_APPLE && |
| 866 |
libevdev_get_id_product(dev->evdev) == PRODUCT_ID_APPLE_APPLETOUCH)) |
| 867 |
should_have_2fg = true; |
| 868 |
|
| 869 |
method = libinput_device_config_scroll_get_methods(device); |
| 870 |
litest_assert(method & LIBINPUT_CONFIG_SCROLL_EDGE); |
| 871 |
if (should_have_2fg) |
| 872 |
litest_assert(method & LIBINPUT_CONFIG_SCROLL_2FG); |
| 873 |
else |
| 874 |
litest_assert((method & LIBINPUT_CONFIG_SCROLL_2FG) == 0); |
| 875 |
|
| 876 |
if (should_have_2fg) |
| 877 |
expected = LIBINPUT_CONFIG_SCROLL_2FG; |
| 878 |
else |
| 879 |
expected = LIBINPUT_CONFIG_SCROLL_EDGE; |
| 880 |
|
| 881 |
method = libinput_device_config_scroll_get_method(device); |
| 882 |
litest_assert_int_eq(method, expected); |
| 883 |
method = libinput_device_config_scroll_get_default_method(device); |
| 884 |
litest_assert_int_eq(method, expected); |
| 885 |
|
| 886 |
status = libinput_device_config_scroll_set_method(device, |
| 887 |
LIBINPUT_CONFIG_SCROLL_EDGE); |
| 888 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 889 |
status = libinput_device_config_scroll_set_method(device, |
| 890 |
LIBINPUT_CONFIG_SCROLL_2FG); |
| 891 |
|
| 892 |
if (should_have_2fg) |
| 893 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 894 |
else |
| 895 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); |
| 896 |
} |
| 897 |
END_TEST |
| 898 |
|
| 899 |
START_TEST(touchpad_edge_scroll_timeout) |
| 900 |
{ |
| 901 |
struct litest_device *dev = litest_current_device(); |
| 902 |
struct libinput *li = dev->libinput; |
| 903 |
struct libinput_event *event; |
| 904 |
double width = 0, height = 0; |
| 905 |
int nevents = 0; |
| 906 |
double mm; /* one mm in percent of the device */ |
| 907 |
|
| 908 |
litest_assert_int_eq( |
| 909 |
libinput_device_get_size(dev->libinput_device, &width, &height), |
| 910 |
0); |
| 911 |
mm = 100.0 / height; |
| 912 |
|
| 913 |
/* timeout-based scrolling is disabled when software buttons are |
| 914 |
* active, so switch to clickfinger. Not all test devices support |
| 915 |
* that, hence the extra check. */ |
| 916 |
if (libinput_device_config_click_get_methods(dev->libinput_device) & |
| 917 |
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER) |
| 918 |
litest_enable_clickfinger(dev); |
| 919 |
|
| 920 |
litest_drain_events(li); |
| 921 |
litest_enable_edge_scroll(dev); |
| 922 |
|
| 923 |
/* move 0.5mm, enough to load up the motion history, but less than |
| 924 |
* the scroll threshold of 2mm */ |
| 925 |
litest_touch_down(dev, 0, 99, 20); |
| 926 |
litest_dispatch(li); |
| 927 |
litest_timeout_hysteresis(li); |
| 928 |
litest_dispatch(li); |
| 929 |
|
| 930 |
litest_touch_move_to(dev, 0, 99, 20, 99, 20 + mm / 2, 8); |
| 931 |
litest_dispatch(li); |
| 932 |
litest_assert_empty_queue(li); |
| 933 |
|
| 934 |
litest_timeout_edgescroll(li); |
| 935 |
litest_dispatch(li); |
| 936 |
|
| 937 |
litest_assert_empty_queue(li); |
| 938 |
|
| 939 |
/* now move slowly up to the 2mm scroll threshold. we expect events */ |
| 940 |
litest_touch_move_to(dev, 0, 99, 20 + mm / 2, 99, 20 + mm * 2, 20); |
| 941 |
litest_touch_up(dev, 0); |
| 942 |
litest_dispatch(li); |
| 943 |
|
| 944 |
litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS); |
| 945 |
|
| 946 |
while ((event = libinput_get_event(li))) { |
| 947 |
struct libinput_event_pointer *ptrev; |
| 948 |
double value; |
| 949 |
|
| 950 |
ptrev = litest_is_axis_event(event, |
| 951 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 952 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, |
| 953 |
0); |
| 954 |
value = litest_event_pointer_get_value( |
| 955 |
ptrev, |
| 956 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); |
| 957 |
litest_assert_double_lt(value, 5.0); |
| 958 |
libinput_event_destroy(event); |
| 959 |
nevents++; |
| 960 |
} |
| 961 |
|
| 962 |
/* we sent 20 events but allow for some to be swallowed by rounding |
| 963 |
* errors, the hysteresis, etc. */ |
| 964 |
litest_assert_int_ge(nevents, 10); |
| 965 |
|
| 966 |
litest_assert_empty_queue(li); |
| 967 |
libinput_event_destroy(event); |
| 968 |
} |
| 969 |
END_TEST |
| 970 |
|
| 971 |
START_TEST(touchpad_edge_scroll_no_motion) |
| 972 |
{ |
| 973 |
struct litest_device *dev = litest_current_device(); |
| 974 |
struct libinput *li = dev->libinput; |
| 975 |
|
| 976 |
litest_drain_events(li); |
| 977 |
litest_enable_edge_scroll(dev); |
| 978 |
|
| 979 |
litest_touch_down(dev, 0, 99, 10); |
| 980 |
litest_touch_move_to(dev, 0, 99, 10, 99, 70, 12); |
| 981 |
/* moving outside -> no motion event */ |
| 982 |
litest_touch_move_to(dev, 0, 99, 70, 20, 70, 12); |
| 983 |
/* moving down outside edge once scrolling had started -> scroll */ |
| 984 |
litest_touch_move_to(dev, 0, 20, 70, 40, 99, 12); |
| 985 |
litest_touch_up(dev, 0); |
| 986 |
litest_dispatch(li); |
| 987 |
|
| 988 |
litest_assert_scroll(li, |
| 989 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 990 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, |
| 991 |
4); |
| 992 |
litest_assert_empty_queue(li); |
| 993 |
} |
| 994 |
END_TEST |
| 995 |
|
| 996 |
START_TEST(touchpad_edge_scroll_no_edge_after_motion) |
| 997 |
{ |
| 998 |
struct litest_device *dev = litest_current_device(); |
| 999 |
struct libinput *li = dev->libinput; |
| 1000 |
|
| 1001 |
litest_drain_events(li); |
| 1002 |
litest_enable_edge_scroll(dev); |
| 1003 |
|
| 1004 |
/* moving into the edge zone must not trigger scroll events */ |
| 1005 |
litest_touch_down(dev, 0, 20, 20); |
| 1006 |
litest_touch_move_to(dev, 0, 20, 20, 99, 20, 22); |
| 1007 |
litest_touch_move_to(dev, 0, 99, 20, 99, 80, 22); |
| 1008 |
litest_touch_up(dev, 0); |
| 1009 |
litest_dispatch(li); |
| 1010 |
|
| 1011 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 1012 |
litest_assert_empty_queue(li); |
| 1013 |
} |
| 1014 |
END_TEST |
| 1015 |
|
| 1016 |
START_TEST(touchpad_edge_scroll_source) |
| 1017 |
{ |
| 1018 |
struct litest_device *dev = litest_current_device(); |
| 1019 |
struct libinput *li = dev->libinput; |
| 1020 |
struct libinput_event *event; |
| 1021 |
|
| 1022 |
litest_drain_events(li); |
| 1023 |
litest_enable_edge_scroll(dev); |
| 1024 |
|
| 1025 |
litest_touch_down(dev, 0, 99, 20); |
| 1026 |
litest_touch_move_to(dev, 0, 99, 20, 99, 80, 10); |
| 1027 |
litest_touch_up(dev, 0); |
| 1028 |
|
| 1029 |
litest_wait_for_event_of_type(li, LIBINPUT_EVENT_POINTER_AXIS); |
| 1030 |
|
| 1031 |
while ((event = libinput_get_event(li))) { |
| 1032 |
struct libinput_event_pointer *ptrev; |
| 1033 |
ptrev = litest_is_axis_event(event, |
| 1034 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 1035 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, |
| 1036 |
LIBINPUT_POINTER_AXIS_SOURCE_FINGER); |
| 1037 |
litest_assert_enum_eq(litest_event_pointer_get_axis_source(ptrev), |
| 1038 |
LIBINPUT_POINTER_AXIS_SOURCE_FINGER); |
| 1039 |
libinput_event_destroy(event); |
| 1040 |
} |
| 1041 |
} |
| 1042 |
END_TEST |
| 1043 |
|
| 1044 |
START_TEST(touchpad_edge_scroll_no_2fg) |
| 1045 |
{ |
| 1046 |
struct litest_device *dev = litest_current_device(); |
| 1047 |
struct libinput *li = dev->libinput; |
| 1048 |
|
| 1049 |
litest_drain_events(li); |
| 1050 |
litest_enable_edge_scroll(dev); |
| 1051 |
|
| 1052 |
litest_touch_down(dev, 0, 49, 50); |
| 1053 |
litest_touch_down(dev, 1, 51, 50); |
| 1054 |
litest_touch_move_two_touches(dev, 49, 50, 51, 50, 20, 30, 10); |
| 1055 |
litest_dispatch(li); |
| 1056 |
litest_touch_up(dev, 0); |
| 1057 |
litest_touch_up(dev, 1); |
| 1058 |
litest_dispatch(li); |
| 1059 |
|
| 1060 |
litest_assert_empty_queue(li); |
| 1061 |
} |
| 1062 |
END_TEST |
| 1063 |
|
| 1064 |
START_TEST(touchpad_edge_scroll_into_buttonareas) |
| 1065 |
{ |
| 1066 |
struct litest_device *dev = litest_current_device(); |
| 1067 |
struct libinput *li = dev->libinput; |
| 1068 |
|
| 1069 |
litest_enable_buttonareas(dev); |
| 1070 |
litest_enable_edge_scroll(dev); |
| 1071 |
litest_drain_events(li); |
| 1072 |
|
| 1073 |
litest_touch_down(dev, 0, 99, 40); |
| 1074 |
litest_touch_move_to(dev, 0, 99, 40, 99, 95, 10); |
| 1075 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 1076 |
/* in the button zone now, make sure we still get events */ |
| 1077 |
litest_touch_move_to(dev, 0, 99, 95, 99, 100, 10); |
| 1078 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 1079 |
|
| 1080 |
/* and out of the zone again */ |
| 1081 |
litest_touch_move_to(dev, 0, 99, 100, 99, 70, 10); |
| 1082 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 1083 |
|
| 1084 |
/* still out of the zone */ |
| 1085 |
litest_touch_move_to(dev, 0, 99, 70, 99, 50, 10); |
| 1086 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 1087 |
} |
| 1088 |
END_TEST |
| 1089 |
|
| 1090 |
START_TEST(touchpad_edge_scroll_within_buttonareas) |
| 1091 |
{ |
| 1092 |
struct litest_device *dev = litest_current_device(); |
| 1093 |
struct libinput *li = dev->libinput; |
| 1094 |
|
| 1095 |
if (!touchpad_has_horiz_edge_scroll_size(dev)) |
| 1096 |
return LITEST_NOT_APPLICABLE; |
| 1097 |
|
| 1098 |
litest_enable_buttonareas(dev); |
| 1099 |
litest_enable_edge_scroll(dev); |
| 1100 |
litest_drain_events(li); |
| 1101 |
|
| 1102 |
litest_touch_down(dev, 0, 20, 99); |
| 1103 |
|
| 1104 |
/* within left button */ |
| 1105 |
litest_touch_move_to(dev, 0, 20, 99, 40, 99, 10); |
| 1106 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 1107 |
|
| 1108 |
/* over to right button */ |
| 1109 |
litest_touch_move_to(dev, 0, 40, 99, 60, 99, 10); |
| 1110 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 1111 |
|
| 1112 |
/* within right button */ |
| 1113 |
litest_touch_move_to(dev, 0, 60, 99, 80, 99, 10); |
| 1114 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 1115 |
} |
| 1116 |
END_TEST |
| 1117 |
|
| 1118 |
START_TEST(touchpad_edge_scroll_buttonareas_click_stops_scroll) |
| 1119 |
{ |
| 1120 |
struct litest_device *dev = litest_current_device(); |
| 1121 |
struct libinput *li = dev->libinput; |
| 1122 |
struct libinput_event *event; |
| 1123 |
|
| 1124 |
if (!touchpad_has_horiz_edge_scroll_size(dev)) |
| 1125 |
return LITEST_NOT_APPLICABLE; |
| 1126 |
|
| 1127 |
litest_enable_buttonareas(dev); |
| 1128 |
litest_enable_edge_scroll(dev); |
| 1129 |
litest_drain_events(li); |
| 1130 |
|
| 1131 |
litest_touch_down(dev, 0, 20, 95); |
| 1132 |
litest_touch_move_to(dev, 0, 20, 95, 70, 95, 15); |
| 1133 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 1134 |
|
| 1135 |
litest_button_click(dev, BTN_LEFT, true); |
| 1136 |
litest_dispatch(li); |
| 1137 |
|
| 1138 |
litest_assert_axis_end_sequence(li, |
| 1139 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 1140 |
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, |
| 1141 |
LIBINPUT_POINTER_AXIS_SOURCE_FINGER); |
| 1142 |
|
| 1143 |
event = libinput_get_event(li); |
| 1144 |
litest_is_button_event(event, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 1145 |
|
| 1146 |
libinput_event_destroy(event); |
| 1147 |
|
| 1148 |
/* move within button areas but we cancelled the scroll so now we |
| 1149 |
* get pointer motion events when moving. |
| 1150 |
* |
| 1151 |
* This is not ideal behavior, but the use-case of horizontal |
| 1152 |
* edge scrolling, click, then scrolling without lifting the finger |
| 1153 |
* is so small we'll let it pass. |
| 1154 |
*/ |
| 1155 |
litest_touch_move_to(dev, 0, 70, 95, 90, 95, 15); |
| 1156 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 1157 |
|
| 1158 |
litest_button_click(dev, BTN_LEFT, false); |
| 1159 |
|
| 1160 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); |
| 1161 |
|
| 1162 |
litest_touch_up(dev, 0); |
| 1163 |
} |
| 1164 |
END_TEST |
| 1165 |
|
| 1166 |
START_TEST(touchpad_edge_scroll_clickfinger_click_stops_scroll) |
| 1167 |
{ |
| 1168 |
struct litest_device *dev = litest_current_device(); |
| 1169 |
struct libinput *li = dev->libinput; |
| 1170 |
struct libinput_event *event; |
| 1171 |
|
| 1172 |
if (!touchpad_has_horiz_edge_scroll_size(dev)) |
| 1173 |
return LITEST_NOT_APPLICABLE; |
| 1174 |
|
| 1175 |
litest_enable_clickfinger(dev); |
| 1176 |
litest_enable_edge_scroll(dev); |
| 1177 |
litest_drain_events(li); |
| 1178 |
|
| 1179 |
litest_touch_down(dev, 0, 20, 95); |
| 1180 |
litest_touch_move_to(dev, 0, 20, 95, 70, 95, 15); |
| 1181 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 1182 |
|
| 1183 |
litest_button_click(dev, BTN_LEFT, true); |
| 1184 |
litest_dispatch(li); |
| 1185 |
|
| 1186 |
litest_assert_axis_end_sequence(li, |
| 1187 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 1188 |
LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, |
| 1189 |
LIBINPUT_POINTER_AXIS_SOURCE_FINGER); |
| 1190 |
|
| 1191 |
event = libinput_get_event(li); |
| 1192 |
litest_is_button_event(event, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 1193 |
|
| 1194 |
libinput_event_destroy(event); |
| 1195 |
|
| 1196 |
/* clickfinger releases pointer -> expect movement */ |
| 1197 |
litest_touch_move_to(dev, 0, 70, 95, 90, 95, 15); |
| 1198 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 1199 |
litest_assert_empty_queue(li); |
| 1200 |
|
| 1201 |
litest_button_click(dev, BTN_LEFT, false); |
| 1202 |
|
| 1203 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); |
| 1204 |
|
| 1205 |
litest_touch_up(dev, 0); |
| 1206 |
} |
| 1207 |
END_TEST |
| 1208 |
|
| 1209 |
START_TEST(touchpad_edge_scroll_into_area) |
| 1210 |
{ |
| 1211 |
struct litest_device *dev = litest_current_device(); |
| 1212 |
struct libinput *li = dev->libinput; |
| 1213 |
|
| 1214 |
litest_enable_edge_scroll(dev); |
| 1215 |
litest_drain_events(li); |
| 1216 |
|
| 1217 |
/* move into area, move vertically, move back to edge */ |
| 1218 |
|
| 1219 |
litest_touch_down(dev, 0, 99, 20); |
| 1220 |
litest_touch_move_to(dev, 0, 99, 20, 99, 50, 15); |
| 1221 |
litest_touch_move_to(dev, 0, 99, 50, 20, 50, 15); |
| 1222 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 1223 |
|
| 1224 |
litest_touch_move_to(dev, 0, 20, 50, 20, 20, 15); |
| 1225 |
litest_touch_move_to(dev, 0, 20, 20, 99, 20, 15); |
| 1226 |
litest_assert_empty_queue(li); |
| 1227 |
|
| 1228 |
litest_touch_move_to(dev, 0, 99, 20, 99, 50, 15); |
| 1229 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 1230 |
} |
| 1231 |
END_TEST |
| 1232 |
|
| 1233 |
static bool |
| 1234 |
touchpad_has_top_palm_detect_size(struct litest_device *dev) |
| 1235 |
{ |
| 1236 |
double width, height; |
| 1237 |
int rc; |
| 1238 |
|
| 1239 |
if (!litest_has_palm_detect_size(dev)) |
| 1240 |
return false; |
| 1241 |
|
| 1242 |
rc = libinput_device_get_size(dev->libinput_device, &width, &height); |
| 1243 |
|
| 1244 |
return rc == 0 && height > 55; |
| 1245 |
} |
| 1246 |
|
| 1247 |
START_TEST(touchpad_palm_detect_at_edge) |
| 1248 |
{ |
| 1249 |
struct litest_device *dev = litest_current_device(); |
| 1250 |
struct libinput *li = dev->libinput; |
| 1251 |
|
| 1252 |
if (!litest_has_palm_detect_size(dev) || !litest_has_2fg_scroll(dev)) |
| 1253 |
return LITEST_NOT_APPLICABLE; |
| 1254 |
|
| 1255 |
litest_enable_2fg_scroll(dev); |
| 1256 |
|
| 1257 |
litest_disable_tap(dev->libinput_device); |
| 1258 |
litest_disable_hold_gestures(dev->libinput_device); |
| 1259 |
litest_drain_events(li); |
| 1260 |
|
| 1261 |
litest_touch_down(dev, 0, 99, 50); |
| 1262 |
litest_touch_move_to(dev, 0, 99, 50, 99, 70, 5); |
| 1263 |
litest_touch_up(dev, 0); |
| 1264 |
|
| 1265 |
litest_assert_empty_queue(li); |
| 1266 |
|
| 1267 |
litest_touch_down(dev, 0, 5, 50); |
| 1268 |
litest_touch_move_to(dev, 0, 5, 50, 5, 70, 5); |
| 1269 |
litest_touch_up(dev, 0); |
| 1270 |
|
| 1271 |
litest_assert_empty_queue(li); |
| 1272 |
} |
| 1273 |
END_TEST |
| 1274 |
|
| 1275 |
START_TEST(touchpad_palm_detect_at_top) |
| 1276 |
{ |
| 1277 |
struct litest_device *dev = litest_current_device(); |
| 1278 |
struct libinput *li = dev->libinput; |
| 1279 |
|
| 1280 |
if (!touchpad_has_top_palm_detect_size(dev)) |
| 1281 |
return LITEST_NOT_APPLICABLE; |
| 1282 |
|
| 1283 |
litest_disable_tap(dev->libinput_device); |
| 1284 |
litest_disable_hold_gestures(dev->libinput_device); |
| 1285 |
litest_drain_events(li); |
| 1286 |
|
| 1287 |
litest_touch_down(dev, 0, 20, 1); |
| 1288 |
litest_touch_move_to(dev, 0, 20, 1, 70, 1, 15); |
| 1289 |
litest_touch_up(dev, 0); |
| 1290 |
|
| 1291 |
litest_assert_empty_queue(li); |
| 1292 |
} |
| 1293 |
END_TEST |
| 1294 |
|
| 1295 |
START_TEST(touchpad_no_palm_detect_at_edge_for_edge_scrolling) |
| 1296 |
{ |
| 1297 |
struct litest_device *dev = litest_current_device(); |
| 1298 |
struct libinput *li = dev->libinput; |
| 1299 |
|
| 1300 |
if (!litest_has_palm_detect_size(dev)) |
| 1301 |
return LITEST_NOT_APPLICABLE; |
| 1302 |
|
| 1303 |
litest_enable_edge_scroll(dev); |
| 1304 |
|
| 1305 |
litest_drain_events(li); |
| 1306 |
|
| 1307 |
litest_touch_down(dev, 0, 99, 50); |
| 1308 |
litest_touch_move_to(dev, 0, 99, 50, 99, 70, 5); |
| 1309 |
litest_touch_up(dev, 0); |
| 1310 |
|
| 1311 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 1312 |
} |
| 1313 |
END_TEST |
| 1314 |
|
| 1315 |
START_TEST(touchpad_palm_detect_at_bottom_corners) |
| 1316 |
{ |
| 1317 |
struct litest_device *dev = litest_current_device(); |
| 1318 |
struct libinput *li = dev->libinput; |
| 1319 |
|
| 1320 |
if (!litest_has_palm_detect_size(dev) || !litest_has_2fg_scroll(dev)) |
| 1321 |
return LITEST_NOT_APPLICABLE; |
| 1322 |
|
| 1323 |
litest_enable_2fg_scroll(dev); |
| 1324 |
|
| 1325 |
litest_disable_tap(dev->libinput_device); |
| 1326 |
litest_disable_hold_gestures(dev->libinput_device); |
| 1327 |
|
| 1328 |
/* Run for non-clickpads only: make sure the bottom corners trigger |
| 1329 |
palm detection too */ |
| 1330 |
litest_drain_events(li); |
| 1331 |
|
| 1332 |
litest_touch_down(dev, 0, 99, 95); |
| 1333 |
litest_touch_move_to(dev, 0, 99, 95, 99, 99, 10); |
| 1334 |
litest_touch_up(dev, 0); |
| 1335 |
|
| 1336 |
litest_assert_empty_queue(li); |
| 1337 |
|
| 1338 |
litest_touch_down(dev, 0, 5, 95); |
| 1339 |
litest_touch_move_to(dev, 0, 5, 95, 5, 99, 5); |
| 1340 |
litest_touch_up(dev, 0); |
| 1341 |
} |
| 1342 |
END_TEST |
| 1343 |
|
| 1344 |
START_TEST(touchpad_palm_detect_at_top_corners) |
| 1345 |
{ |
| 1346 |
struct litest_device *dev = litest_current_device(); |
| 1347 |
struct libinput *li = dev->libinput; |
| 1348 |
|
| 1349 |
if (!litest_has_palm_detect_size(dev) || !litest_has_2fg_scroll(dev)) |
| 1350 |
return LITEST_NOT_APPLICABLE; |
| 1351 |
|
| 1352 |
litest_enable_2fg_scroll(dev); |
| 1353 |
|
| 1354 |
litest_disable_tap(dev->libinput_device); |
| 1355 |
litest_disable_hold_gestures(dev->libinput_device); |
| 1356 |
|
| 1357 |
/* Run for non-clickpads only: make sure the bottom corners trigger |
| 1358 |
palm detection too */ |
| 1359 |
litest_drain_events(li); |
| 1360 |
|
| 1361 |
litest_touch_down(dev, 0, 99, 5); |
| 1362 |
litest_touch_move_to(dev, 0, 99, 5, 99, 9, 10); |
| 1363 |
litest_touch_up(dev, 0); |
| 1364 |
|
| 1365 |
litest_assert_empty_queue(li); |
| 1366 |
|
| 1367 |
litest_touch_down(dev, 0, 5, 5); |
| 1368 |
litest_touch_move_to(dev, 0, 5, 5, 5, 9, 5); |
| 1369 |
litest_touch_up(dev, 0); |
| 1370 |
|
| 1371 |
litest_assert_empty_queue(li); |
| 1372 |
} |
| 1373 |
END_TEST |
| 1374 |
|
| 1375 |
START_TEST(touchpad_palm_detect_palm_stays_palm) |
| 1376 |
{ |
| 1377 |
struct litest_device *dev = litest_current_device(); |
| 1378 |
struct libinput *li = dev->libinput; |
| 1379 |
|
| 1380 |
if (!litest_has_palm_detect_size(dev) || !litest_has_2fg_scroll(dev)) |
| 1381 |
return LITEST_NOT_APPLICABLE; |
| 1382 |
|
| 1383 |
litest_enable_2fg_scroll(dev); |
| 1384 |
|
| 1385 |
litest_disable_tap(dev->libinput_device); |
| 1386 |
litest_disable_hold_gestures(dev->libinput_device); |
| 1387 |
litest_drain_events(li); |
| 1388 |
|
| 1389 |
litest_touch_down(dev, 0, 99, 20); |
| 1390 |
litest_touch_move_to(dev, 0, 99, 20, 75, 99, 20); |
| 1391 |
litest_touch_up(dev, 0); |
| 1392 |
litest_assert_empty_queue(li); |
| 1393 |
} |
| 1394 |
END_TEST |
| 1395 |
|
| 1396 |
START_TEST(touchpad_palm_detect_top_palm_stays_palm) |
| 1397 |
{ |
| 1398 |
struct litest_device *dev = litest_current_device(); |
| 1399 |
struct libinput *li = dev->libinput; |
| 1400 |
|
| 1401 |
if (!touchpad_has_top_palm_detect_size(dev)) |
| 1402 |
return LITEST_NOT_APPLICABLE; |
| 1403 |
|
| 1404 |
litest_disable_tap(dev->libinput_device); |
| 1405 |
litest_disable_hold_gestures(dev->libinput_device); |
| 1406 |
litest_drain_events(li); |
| 1407 |
|
| 1408 |
litest_touch_down(dev, 0, 20, 1); |
| 1409 |
litest_touch_move_to(dev, 0, 20, 1, 50, 30, 20); |
| 1410 |
litest_touch_up(dev, 0); |
| 1411 |
|
| 1412 |
litest_assert_empty_queue(li); |
| 1413 |
} |
| 1414 |
END_TEST |
| 1415 |
|
| 1416 |
START_TEST(touchpad_palm_detect_palm_becomes_pointer) |
| 1417 |
{ |
| 1418 |
struct litest_device *dev = litest_current_device(); |
| 1419 |
struct libinput *li = dev->libinput; |
| 1420 |
|
| 1421 |
if (!litest_has_palm_detect_size(dev) || !litest_has_2fg_scroll(dev)) |
| 1422 |
return LITEST_NOT_APPLICABLE; |
| 1423 |
|
| 1424 |
litest_enable_2fg_scroll(dev); |
| 1425 |
|
| 1426 |
litest_disable_tap(dev->libinput_device); |
| 1427 |
litest_disable_hold_gestures(dev->libinput_device); |
| 1428 |
litest_drain_events(li); |
| 1429 |
|
| 1430 |
litest_touch_down(dev, 0, 99, 50); |
| 1431 |
litest_touch_move_to(dev, 0, 99, 50, 0, 70, 25); |
| 1432 |
litest_touch_up(dev, 0); |
| 1433 |
|
| 1434 |
litest_dispatch(li); |
| 1435 |
|
| 1436 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 1437 |
|
| 1438 |
litest_assert_empty_queue(li); |
| 1439 |
} |
| 1440 |
END_TEST |
| 1441 |
|
| 1442 |
START_TEST(touchpad_palm_detect_top_palm_becomes_pointer) |
| 1443 |
{ |
| 1444 |
struct litest_device *dev = litest_current_device(); |
| 1445 |
struct libinput *li = dev->libinput; |
| 1446 |
|
| 1447 |
if (!touchpad_has_top_palm_detect_size(dev)) |
| 1448 |
return LITEST_NOT_APPLICABLE; |
| 1449 |
|
| 1450 |
litest_disable_tap(dev->libinput_device); |
| 1451 |
litest_disable_hold_gestures(dev->libinput_device); |
| 1452 |
litest_drain_events(li); |
| 1453 |
|
| 1454 |
litest_touch_down(dev, 0, 50, 1); |
| 1455 |
litest_touch_move_to(dev, 0, 50, 1, 50, 60, 20); |
| 1456 |
litest_touch_up(dev, 0); |
| 1457 |
|
| 1458 |
litest_dispatch(li); |
| 1459 |
|
| 1460 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 1461 |
|
| 1462 |
litest_assert_empty_queue(li); |
| 1463 |
} |
| 1464 |
END_TEST |
| 1465 |
|
| 1466 |
START_TEST(touchpad_palm_detect_no_palm_moving_into_edges) |
| 1467 |
{ |
| 1468 |
struct litest_device *dev = litest_current_device(); |
| 1469 |
struct libinput *li = dev->libinput; |
| 1470 |
|
| 1471 |
if (!litest_has_palm_detect_size(dev)) |
| 1472 |
return LITEST_NOT_APPLICABLE; |
| 1473 |
|
| 1474 |
litest_disable_tap(dev->libinput_device); |
| 1475 |
litest_disable_hold_gestures(dev->libinput_device); |
| 1476 |
|
| 1477 |
/* moving non-palm into the edge does not label it as palm */ |
| 1478 |
litest_drain_events(li); |
| 1479 |
|
| 1480 |
litest_touch_down(dev, 0, 50, 50); |
| 1481 |
litest_touch_move_to(dev, 0, 50, 50, 99, 50, 15); |
| 1482 |
|
| 1483 |
litest_drain_events(li); |
| 1484 |
|
| 1485 |
litest_touch_move_to(dev, 0, 99, 50, 99, 90, 15); |
| 1486 |
litest_dispatch(li); |
| 1487 |
|
| 1488 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 1489 |
|
| 1490 |
litest_touch_up(dev, 0); |
| 1491 |
litest_dispatch(li); |
| 1492 |
litest_assert_empty_queue(li); |
| 1493 |
} |
| 1494 |
END_TEST |
| 1495 |
|
| 1496 |
START_TEST(touchpad_palm_detect_no_palm_moving_into_top) |
| 1497 |
{ |
| 1498 |
struct litest_device *dev = litest_current_device(); |
| 1499 |
struct libinput *li = dev->libinput; |
| 1500 |
|
| 1501 |
if (!touchpad_has_top_palm_detect_size(dev)) |
| 1502 |
return LITEST_NOT_APPLICABLE; |
| 1503 |
|
| 1504 |
litest_disable_tap(dev->libinput_device); |
| 1505 |
litest_disable_hold_gestures(dev->libinput_device); |
| 1506 |
|
| 1507 |
/* moving non-palm into the edge does not label it as palm */ |
| 1508 |
litest_drain_events(li); |
| 1509 |
|
| 1510 |
litest_touch_down(dev, 0, 50, 50); |
| 1511 |
litest_touch_move_to(dev, 0, 50, 50, 0, 2, 15); |
| 1512 |
|
| 1513 |
litest_drain_events(li); |
| 1514 |
|
| 1515 |
litest_touch_move_to(dev, 0, 0, 2, 50, 50, 15); |
| 1516 |
litest_dispatch(li); |
| 1517 |
|
| 1518 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 1519 |
|
| 1520 |
litest_touch_up(dev, 0); |
| 1521 |
litest_dispatch(li); |
| 1522 |
litest_assert_empty_queue(li); |
| 1523 |
} |
| 1524 |
END_TEST |
| 1525 |
|
| 1526 |
START_TEST(touchpad_palm_detect_no_tap_top_edge) |
| 1527 |
{ |
| 1528 |
struct litest_device *dev = litest_current_device(); |
| 1529 |
struct libinput *li = dev->libinput; |
| 1530 |
|
| 1531 |
if (!touchpad_has_top_palm_detect_size(dev)) |
| 1532 |
return LITEST_NOT_APPLICABLE; |
| 1533 |
|
| 1534 |
litest_enable_tap(dev->libinput_device); |
| 1535 |
litest_disable_hold_gestures(dev->libinput_device); |
| 1536 |
litest_drain_events(li); |
| 1537 |
|
| 1538 |
litest_touch_down(dev, 0, 50, 1); |
| 1539 |
litest_touch_up(dev, 0); |
| 1540 |
litest_timeout_tap(li); |
| 1541 |
litest_assert_empty_queue(li); |
| 1542 |
} |
| 1543 |
END_TEST |
| 1544 |
|
| 1545 |
START_TEST(touchpad_palm_detect_tap_hardbuttons) |
| 1546 |
{ |
| 1547 |
struct litest_device *dev = litest_current_device(); |
| 1548 |
struct libinput *li = dev->libinput; |
| 1549 |
|
| 1550 |
if (!litest_has_palm_detect_size(dev)) |
| 1551 |
return LITEST_NOT_APPLICABLE; |
| 1552 |
|
| 1553 |
litest_enable_tap(dev->libinput_device); |
| 1554 |
litest_disable_hold_gestures(dev->libinput_device); |
| 1555 |
litest_drain_events(li); |
| 1556 |
|
| 1557 |
litest_touch_down(dev, 0, 95, 5); |
| 1558 |
litest_touch_up(dev, 0); |
| 1559 |
litest_timeout_tap(li); |
| 1560 |
litest_assert_empty_queue(li); |
| 1561 |
|
| 1562 |
litest_touch_down(dev, 0, 5, 5); |
| 1563 |
litest_touch_up(dev, 0); |
| 1564 |
litest_timeout_tap(li); |
| 1565 |
litest_assert_empty_queue(li); |
| 1566 |
|
| 1567 |
litest_touch_down(dev, 0, 5, 99); |
| 1568 |
litest_touch_up(dev, 0); |
| 1569 |
litest_timeout_tap(li); |
| 1570 |
litest_assert_empty_queue(li); |
| 1571 |
|
| 1572 |
litest_touch_down(dev, 0, 95, 99); |
| 1573 |
litest_touch_up(dev, 0); |
| 1574 |
litest_timeout_tap(li); |
| 1575 |
litest_assert_empty_queue(li); |
| 1576 |
} |
| 1577 |
END_TEST |
| 1578 |
|
| 1579 |
START_TEST(touchpad_palm_detect_tap_softbuttons) |
| 1580 |
{ |
| 1581 |
struct litest_device *dev = litest_current_device(); |
| 1582 |
struct libinput *li = dev->libinput; |
| 1583 |
|
| 1584 |
if (!litest_has_palm_detect_size(dev)) |
| 1585 |
return LITEST_NOT_APPLICABLE; |
| 1586 |
|
| 1587 |
litest_enable_tap(dev->libinput_device); |
| 1588 |
litest_enable_buttonareas(dev); |
| 1589 |
litest_disable_hold_gestures(dev->libinput_device); |
| 1590 |
litest_drain_events(li); |
| 1591 |
|
| 1592 |
/* Two touches in the software button area, but inside |
| 1593 |
* the palm detection edge zone -> expect palm detection */ |
| 1594 |
litest_touch_down(dev, 0, 99, 99); |
| 1595 |
litest_touch_up(dev, 0); |
| 1596 |
litest_timeout_tap(li); |
| 1597 |
litest_assert_empty_queue(li); |
| 1598 |
|
| 1599 |
litest_touch_down(dev, 0, 1, 99); |
| 1600 |
litest_touch_up(dev, 0); |
| 1601 |
litest_timeout_tap(li); |
| 1602 |
litest_assert_empty_queue(li); |
| 1603 |
|
| 1604 |
/* Two touches in the software button area, but |
| 1605 |
* not in the palm detection edge zone -> expect taps */ |
| 1606 |
litest_touch_down(dev, 0, 10, 99); |
| 1607 |
litest_touch_up(dev, 0); |
| 1608 |
litest_timeout_tap(li); |
| 1609 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 1610 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 1611 |
litest_assert_empty_queue(li); |
| 1612 |
|
| 1613 |
litest_touch_down(dev, 0, 90, 99); |
| 1614 |
litest_touch_up(dev, 0); |
| 1615 |
litest_timeout_tap(li); |
| 1616 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 1617 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 1618 |
litest_assert_empty_queue(li); |
| 1619 |
} |
| 1620 |
END_TEST |
| 1621 |
|
| 1622 |
START_TEST(touchpad_palm_detect_tap_clickfinger) |
| 1623 |
{ |
| 1624 |
struct litest_device *dev = litest_current_device(); |
| 1625 |
struct libinput *li = dev->libinput; |
| 1626 |
|
| 1627 |
if (!litest_has_palm_detect_size(dev)) |
| 1628 |
return LITEST_NOT_APPLICABLE; |
| 1629 |
|
| 1630 |
litest_enable_tap(dev->libinput_device); |
| 1631 |
litest_enable_clickfinger(dev); |
| 1632 |
litest_disable_hold_gestures(dev->libinput_device); |
| 1633 |
litest_drain_events(li); |
| 1634 |
|
| 1635 |
/* Taps in each of the 4 corners of the touchpad, all |
| 1636 |
* inside the palm detection edge zone*/ |
| 1637 |
litest_touch_down(dev, 0, 95, 5); |
| 1638 |
litest_touch_up(dev, 0); |
| 1639 |
litest_timeout_tap(li); |
| 1640 |
litest_assert_empty_queue(li); |
| 1641 |
|
| 1642 |
litest_touch_down(dev, 0, 5, 5); |
| 1643 |
litest_touch_up(dev, 0); |
| 1644 |
litest_timeout_tap(li); |
| 1645 |
litest_assert_empty_queue(li); |
| 1646 |
|
| 1647 |
litest_touch_down(dev, 0, 5, 99); |
| 1648 |
litest_touch_up(dev, 0); |
| 1649 |
litest_timeout_tap(li); |
| 1650 |
litest_assert_empty_queue(li); |
| 1651 |
|
| 1652 |
litest_touch_down(dev, 0, 95, 99); |
| 1653 |
litest_touch_up(dev, 0); |
| 1654 |
litest_timeout_tap(li); |
| 1655 |
litest_assert_empty_queue(li); |
| 1656 |
} |
| 1657 |
END_TEST |
| 1658 |
|
| 1659 |
START_TEST(touchpad_no_palm_detect_2fg_scroll) |
| 1660 |
{ |
| 1661 |
struct litest_device *dev = litest_current_device(); |
| 1662 |
struct libinput *li = dev->libinput; |
| 1663 |
|
| 1664 |
if (!litest_has_palm_detect_size(dev) || !litest_has_2fg_scroll(dev)) |
| 1665 |
return LITEST_NOT_APPLICABLE; |
| 1666 |
|
| 1667 |
litest_enable_2fg_scroll(dev); |
| 1668 |
|
| 1669 |
litest_drain_events(li); |
| 1670 |
|
| 1671 |
/* first finger is palm, second finger isn't so we trigger 2fg |
| 1672 |
* scrolling */ |
| 1673 |
litest_touch_down(dev, 0, 99, 50); |
| 1674 |
litest_touch_move_to(dev, 0, 99, 50, 99, 40, 45); |
| 1675 |
litest_touch_move_to(dev, 0, 99, 40, 99, 50, 45); |
| 1676 |
litest_assert_empty_queue(li); |
| 1677 |
litest_touch_down(dev, 1, 50, 50); |
| 1678 |
litest_assert_empty_queue(li); |
| 1679 |
|
| 1680 |
litest_touch_move_two_touches(dev, 99, 50, 50, 50, 0, -20, 10); |
| 1681 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 1682 |
} |
| 1683 |
END_TEST |
| 1684 |
|
| 1685 |
START_TEST(touchpad_palm_detect_both_edges) |
| 1686 |
{ |
| 1687 |
struct litest_device *dev = litest_current_device(); |
| 1688 |
struct libinput *li = dev->libinput; |
| 1689 |
|
| 1690 |
if (!litest_has_palm_detect_size(dev) || !litest_has_2fg_scroll(dev)) |
| 1691 |
return LITEST_NOT_APPLICABLE; |
| 1692 |
|
| 1693 |
litest_enable_2fg_scroll(dev); |
| 1694 |
|
| 1695 |
litest_drain_events(li); |
| 1696 |
|
| 1697 |
/* two fingers moving up/down in the left/right palm zone must not |
| 1698 |
* generate events */ |
| 1699 |
litest_touch_down(dev, 0, 99, 50); |
| 1700 |
litest_touch_move_to(dev, 0, 99, 50, 99, 40, 10); |
| 1701 |
litest_touch_move_to(dev, 0, 99, 40, 99, 50, 10); |
| 1702 |
litest_assert_empty_queue(li); |
| 1703 |
/* This set generates events */ |
| 1704 |
litest_touch_down(dev, 1, 1, 50); |
| 1705 |
litest_touch_move_to(dev, 1, 1, 50, 1, 40, 10); |
| 1706 |
litest_touch_move_to(dev, 1, 1, 40, 1, 50, 10); |
| 1707 |
litest_assert_empty_queue(li); |
| 1708 |
|
| 1709 |
litest_touch_move_two_touches(dev, 99, 50, 1, 50, 0, -20, 10); |
| 1710 |
litest_assert_empty_queue(li); |
| 1711 |
} |
| 1712 |
END_TEST |
| 1713 |
|
| 1714 |
static inline bool |
| 1715 |
touchpad_has_tool_palm(struct litest_device *dev) |
| 1716 |
{ |
| 1717 |
return libevdev_has_event_code(dev->evdev, EV_ABS, ABS_MT_TOOL_TYPE); |
| 1718 |
} |
| 1719 |
|
| 1720 |
START_TEST(touchpad_palm_detect_tool_palm) |
| 1721 |
{ |
| 1722 |
struct litest_device *dev = litest_current_device(); |
| 1723 |
struct libinput *li = dev->libinput; |
| 1724 |
|
| 1725 |
if (!touchpad_has_tool_palm(dev)) |
| 1726 |
return LITEST_NOT_APPLICABLE; |
| 1727 |
|
| 1728 |
litest_touch_down(dev, 0, 50, 50); |
| 1729 |
litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10); |
| 1730 |
litest_drain_events(li); |
| 1731 |
|
| 1732 |
litest_event(dev, EV_ABS, ABS_MT_TOOL_TYPE, MT_TOOL_PALM); |
| 1733 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 1734 |
litest_touch_move_to(dev, 0, 70, 70, 50, 40, 10); |
| 1735 |
litest_touch_up(dev, 0); |
| 1736 |
|
| 1737 |
litest_assert_empty_queue(li); |
| 1738 |
} |
| 1739 |
END_TEST |
| 1740 |
|
| 1741 |
START_TEST(touchpad_palm_detect_tool_palm_on_off) |
| 1742 |
{ |
| 1743 |
struct litest_device *dev = litest_current_device(); |
| 1744 |
struct libinput *li = dev->libinput; |
| 1745 |
|
| 1746 |
if (!touchpad_has_tool_palm(dev)) |
| 1747 |
return LITEST_NOT_APPLICABLE; |
| 1748 |
|
| 1749 |
litest_touch_down(dev, 0, 50, 50); |
| 1750 |
litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10); |
| 1751 |
litest_drain_events(li); |
| 1752 |
|
| 1753 |
litest_event(dev, EV_ABS, ABS_MT_TOOL_TYPE, MT_TOOL_PALM); |
| 1754 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 1755 |
litest_touch_move_to(dev, 0, 70, 70, 50, 40, 10); |
| 1756 |
|
| 1757 |
litest_assert_empty_queue(li); |
| 1758 |
|
| 1759 |
litest_event(dev, EV_ABS, ABS_MT_TOOL_TYPE, MT_TOOL_FINGER); |
| 1760 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 1761 |
litest_touch_move_to(dev, 0, 50, 40, 70, 70, 10); |
| 1762 |
litest_touch_up(dev, 0); |
| 1763 |
|
| 1764 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 1765 |
} |
| 1766 |
END_TEST |
| 1767 |
|
| 1768 |
START_TEST(touchpad_palm_detect_tool_palm_tap_after) |
| 1769 |
{ |
| 1770 |
struct litest_device *dev = litest_current_device(); |
| 1771 |
struct libinput *li = dev->libinput; |
| 1772 |
|
| 1773 |
if (!touchpad_has_tool_palm(dev)) |
| 1774 |
return LITEST_NOT_APPLICABLE; |
| 1775 |
|
| 1776 |
litest_enable_tap(dev->libinput_device); |
| 1777 |
litest_disable_hold_gestures(dev->libinput_device); |
| 1778 |
litest_drain_events(li); |
| 1779 |
|
| 1780 |
litest_push_event_frame(dev); |
| 1781 |
litest_event(dev, EV_ABS, ABS_MT_TOOL_TYPE, MT_TOOL_PALM); |
| 1782 |
litest_touch_down(dev, 0, 50, 50); |
| 1783 |
litest_pop_event_frame(dev); |
| 1784 |
litest_dispatch(li); |
| 1785 |
|
| 1786 |
litest_touch_move_to(dev, 0, 50, 50, 50, 80, 10); |
| 1787 |
litest_dispatch(li); |
| 1788 |
|
| 1789 |
litest_assert_empty_queue(li); |
| 1790 |
|
| 1791 |
litest_push_event_frame(dev); |
| 1792 |
litest_event(dev, EV_ABS, ABS_MT_TOOL_TYPE, MT_TOOL_FINGER); |
| 1793 |
litest_touch_up(dev, 0); |
| 1794 |
litest_pop_event_frame(dev); |
| 1795 |
litest_timeout_tap(li); |
| 1796 |
litest_assert_empty_queue(li); |
| 1797 |
|
| 1798 |
litest_touch_down(dev, 0, 50, 50); |
| 1799 |
litest_dispatch(li); |
| 1800 |
litest_touch_up(dev, 0); |
| 1801 |
litest_timeout_tap(li); |
| 1802 |
|
| 1803 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 1804 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 1805 |
litest_assert_empty_queue(li); |
| 1806 |
} |
| 1807 |
END_TEST |
| 1808 |
|
| 1809 |
START_TEST(touchpad_palm_detect_tool_palm_tap) |
| 1810 |
{ |
| 1811 |
struct litest_device *dev = litest_current_device(); |
| 1812 |
struct libinput *li = dev->libinput; |
| 1813 |
|
| 1814 |
if (!touchpad_has_tool_palm(dev)) |
| 1815 |
return LITEST_NOT_APPLICABLE; |
| 1816 |
|
| 1817 |
litest_enable_tap(dev->libinput_device); |
| 1818 |
litest_disable_hold_gestures(dev->libinput_device); |
| 1819 |
litest_drain_events(li); |
| 1820 |
|
| 1821 |
litest_push_event_frame(dev); |
| 1822 |
litest_event(dev, EV_ABS, ABS_MT_TOOL_TYPE, MT_TOOL_PALM); |
| 1823 |
litest_touch_down(dev, 0, 50, 50); |
| 1824 |
litest_pop_event_frame(dev); |
| 1825 |
litest_dispatch(li); |
| 1826 |
litest_assert_empty_queue(li); |
| 1827 |
|
| 1828 |
litest_touch_up(dev, 0); |
| 1829 |
litest_timeout_tap(li); |
| 1830 |
|
| 1831 |
litest_assert_empty_queue(li); |
| 1832 |
} |
| 1833 |
END_TEST |
| 1834 |
|
| 1835 |
static inline bool |
| 1836 |
touchpad_has_palm_pressure(struct litest_device *dev) |
| 1837 |
{ |
| 1838 |
struct libevdev *evdev = dev->evdev; |
| 1839 |
|
| 1840 |
if (dev->which == LITEST_SYNAPTICS_PRESSUREPAD) |
| 1841 |
return false; |
| 1842 |
|
| 1843 |
if (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_PRESSURE)) |
| 1844 |
return libevdev_get_abs_resolution(evdev, ABS_MT_PRESSURE) == 0; |
| 1845 |
|
| 1846 |
return false; |
| 1847 |
} |
| 1848 |
|
| 1849 |
START_TEST(touchpad_palm_detect_pressure) |
| 1850 |
{ |
| 1851 |
struct litest_device *dev = litest_current_device(); |
| 1852 |
struct libinput *li = dev->libinput; |
| 1853 |
struct axis_replacement axes[] = { |
| 1854 |
{ ABS_MT_PRESSURE, 75 }, |
| 1855 |
{ -1, 0 }, |
| 1856 |
}; |
| 1857 |
|
| 1858 |
if (!touchpad_has_palm_pressure(dev)) |
| 1859 |
return LITEST_NOT_APPLICABLE; |
| 1860 |
|
| 1861 |
litest_disable_tap(dev->libinput_device); |
| 1862 |
litest_disable_hold_gestures(dev->libinput_device); |
| 1863 |
litest_drain_events(li); |
| 1864 |
|
| 1865 |
litest_touch_down_extended(dev, 0, 50, 99, axes); |
| 1866 |
litest_touch_move_to(dev, 0, 50, 50, 80, 99, 10); |
| 1867 |
litest_touch_up(dev, 0); |
| 1868 |
|
| 1869 |
litest_assert_empty_queue(li); |
| 1870 |
} |
| 1871 |
END_TEST |
| 1872 |
|
| 1873 |
START_TEST(touchpad_palm_detect_pressure_late_tap) |
| 1874 |
{ |
| 1875 |
struct litest_device *dev = litest_current_device(); |
| 1876 |
struct libinput *li = dev->libinput; |
| 1877 |
struct axis_replacement axes[] = { |
| 1878 |
{ ABS_MT_PRESSURE, 75 }, |
| 1879 |
{ -1, 0 }, |
| 1880 |
}; |
| 1881 |
|
| 1882 |
if (!touchpad_has_palm_pressure(dev)) |
| 1883 |
return LITEST_NOT_APPLICABLE; |
| 1884 |
|
| 1885 |
litest_enable_tap(dev->libinput_device); |
| 1886 |
litest_enable_clickfinger(dev); |
| 1887 |
litest_disable_hold_gestures(dev->libinput_device); |
| 1888 |
litest_drain_events(li); |
| 1889 |
|
| 1890 |
/* event after touch down is palm */ |
| 1891 |
litest_touch_down(dev, 0, 50, 80); |
| 1892 |
litest_touch_move_extended(dev, 0, 51, 99, axes); |
| 1893 |
litest_touch_up(dev, 0); |
| 1894 |
litest_timeout_tap(li); |
| 1895 |
litest_assert_empty_queue(li); |
| 1896 |
|
| 1897 |
/* make sure normal tap still works */ |
| 1898 |
litest_touch_down(dev, 0, 50, 99); |
| 1899 |
litest_touch_up(dev, 0); |
| 1900 |
litest_timeout_tap(li); |
| 1901 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); |
| 1902 |
} |
| 1903 |
END_TEST |
| 1904 |
|
| 1905 |
START_TEST(touchpad_palm_detect_pressure_tap_hold) |
| 1906 |
{ |
| 1907 |
struct litest_device *dev = litest_current_device(); |
| 1908 |
struct libinput *li = dev->libinput; |
| 1909 |
struct axis_replacement axes[] = { |
| 1910 |
{ ABS_MT_PRESSURE, 75 }, |
| 1911 |
{ -1, 0 }, |
| 1912 |
}; |
| 1913 |
|
| 1914 |
if (!touchpad_has_palm_pressure(dev)) |
| 1915 |
return LITEST_NOT_APPLICABLE; |
| 1916 |
|
| 1917 |
litest_enable_tap(dev->libinput_device); |
| 1918 |
litest_enable_clickfinger(dev); |
| 1919 |
litest_disable_hold_gestures(dev->libinput_device); |
| 1920 |
litest_drain_events(li); |
| 1921 |
|
| 1922 |
/* event in state HOLD is thumb */ |
| 1923 |
litest_touch_down(dev, 0, 50, 99); |
| 1924 |
litest_timeout_tap(li); |
| 1925 |
litest_touch_move_extended(dev, 0, 51, 99, axes); |
| 1926 |
litest_touch_up(dev, 0); |
| 1927 |
litest_assert_empty_queue(li); |
| 1928 |
|
| 1929 |
/* make sure normal tap still works */ |
| 1930 |
litest_touch_down(dev, 0, 50, 99); |
| 1931 |
litest_touch_up(dev, 0); |
| 1932 |
litest_timeout_tap(li); |
| 1933 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); |
| 1934 |
} |
| 1935 |
END_TEST |
| 1936 |
|
| 1937 |
START_TEST(touchpad_palm_detect_pressure_tap_hold_2ndfg) |
| 1938 |
{ |
| 1939 |
struct litest_device *dev = litest_current_device(); |
| 1940 |
struct libinput *li = dev->libinput; |
| 1941 |
struct axis_replacement axes[] = { |
| 1942 |
{ ABS_MT_PRESSURE, 75 }, |
| 1943 |
{ -1, 0 }, |
| 1944 |
}; |
| 1945 |
|
| 1946 |
if (!touchpad_has_palm_pressure(dev)) |
| 1947 |
return LITEST_NOT_APPLICABLE; |
| 1948 |
|
| 1949 |
litest_enable_tap(dev->libinput_device); |
| 1950 |
litest_enable_clickfinger(dev); |
| 1951 |
litest_disable_hold_gestures(dev->libinput_device); |
| 1952 |
litest_drain_events(li); |
| 1953 |
|
| 1954 |
/* event in state HOLD is thumb */ |
| 1955 |
litest_touch_down(dev, 0, 50, 99); |
| 1956 |
litest_timeout_tap(li); |
| 1957 |
litest_touch_move_extended(dev, 0, 51, 99, axes); |
| 1958 |
|
| 1959 |
litest_assert_empty_queue(li); |
| 1960 |
|
| 1961 |
/* one finger is a thumb, now get second finger down */ |
| 1962 |
litest_touch_down(dev, 1, 60, 50); |
| 1963 |
litest_assert_empty_queue(li); |
| 1964 |
/* release thumb */ |
| 1965 |
litest_touch_up(dev, 0); |
| 1966 |
litest_assert_empty_queue(li); |
| 1967 |
|
| 1968 |
/* timeout -> into HOLD, no event on release */ |
| 1969 |
litest_timeout_tap(li); |
| 1970 |
litest_touch_up(dev, 1); |
| 1971 |
litest_assert_empty_queue(li); |
| 1972 |
|
| 1973 |
/* make sure normal tap still works */ |
| 1974 |
litest_touch_down(dev, 0, 50, 99); |
| 1975 |
litest_touch_up(dev, 0); |
| 1976 |
litest_timeout_tap(li); |
| 1977 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); |
| 1978 |
} |
| 1979 |
END_TEST |
| 1980 |
|
| 1981 |
START_TEST(touchpad_palm_detect_move_and_tap) |
| 1982 |
{ |
| 1983 |
struct litest_device *dev = litest_current_device(); |
| 1984 |
struct libinput *li = dev->libinput; |
| 1985 |
struct axis_replacement axes[] = { |
| 1986 |
{ ABS_MT_PRESSURE, 75 }, |
| 1987 |
{ -1, 0 }, |
| 1988 |
}; |
| 1989 |
|
| 1990 |
if (!touchpad_has_palm_pressure(dev)) |
| 1991 |
return LITEST_NOT_APPLICABLE; |
| 1992 |
|
| 1993 |
litest_enable_tap(dev->libinput_device); |
| 1994 |
litest_disable_hold_gestures(dev->libinput_device); |
| 1995 |
litest_drain_events(li); |
| 1996 |
|
| 1997 |
/* trigger thumb detection by pressure after a slight movement */ |
| 1998 |
litest_touch_down(dev, 0, 50, 99); |
| 1999 |
litest_touch_move(dev, 0, 51, 99); |
| 2000 |
litest_touch_move_extended(dev, 0, 55, 99, axes); |
| 2001 |
litest_dispatch(li); |
| 2002 |
|
| 2003 |
litest_assert_empty_queue(li); |
| 2004 |
|
| 2005 |
/* thumb is resting, check if tapping still works */ |
| 2006 |
litest_touch_down(dev, 1, 50, 50); |
| 2007 |
litest_touch_up(dev, 1); |
| 2008 |
litest_timeout_tap(li); |
| 2009 |
|
| 2010 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 2011 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 2012 |
litest_assert_empty_queue(li); |
| 2013 |
} |
| 2014 |
END_TEST |
| 2015 |
|
| 2016 |
START_TEST(touchpad_palm_detect_pressure_late) |
| 2017 |
{ |
| 2018 |
struct litest_device *dev = litest_current_device(); |
| 2019 |
struct libinput *li = dev->libinput; |
| 2020 |
struct axis_replacement axes[] = { |
| 2021 |
{ ABS_MT_PRESSURE, 75 }, |
| 2022 |
{ -1, 0 }, |
| 2023 |
}; |
| 2024 |
|
| 2025 |
if (!touchpad_has_palm_pressure(dev)) |
| 2026 |
return LITEST_NOT_APPLICABLE; |
| 2027 |
|
| 2028 |
litest_disable_tap(dev->libinput_device); |
| 2029 |
litest_disable_hold_gestures(dev->libinput_device); |
| 2030 |
litest_drain_events(li); |
| 2031 |
|
| 2032 |
litest_touch_down(dev, 0, 50, 50); |
| 2033 |
litest_touch_move_to(dev, 0, 50, 70, 80, 90, 10); |
| 2034 |
litest_drain_events(li); |
| 2035 |
litest_dispatch(li); |
| 2036 |
litest_touch_move_to_extended(dev, 0, 80, 90, 50, 20, axes, 10); |
| 2037 |
litest_touch_up(dev, 0); |
| 2038 |
|
| 2039 |
litest_assert_empty_queue(li); |
| 2040 |
} |
| 2041 |
END_TEST |
| 2042 |
|
| 2043 |
START_TEST(touchpad_palm_detect_pressure_keep_palm) |
| 2044 |
{ |
| 2045 |
struct litest_device *dev = litest_current_device(); |
| 2046 |
struct libinput *li = dev->libinput; |
| 2047 |
struct axis_replacement axes[] = { |
| 2048 |
{ ABS_MT_PRESSURE, 75 }, |
| 2049 |
{ -1, 0 }, |
| 2050 |
}; |
| 2051 |
|
| 2052 |
if (!touchpad_has_palm_pressure(dev)) |
| 2053 |
return LITEST_NOT_APPLICABLE; |
| 2054 |
|
| 2055 |
litest_disable_tap(dev->libinput_device); |
| 2056 |
litest_disable_hold_gestures(dev->libinput_device); |
| 2057 |
litest_drain_events(li); |
| 2058 |
|
| 2059 |
litest_touch_down(dev, 0, 80, 90); |
| 2060 |
litest_touch_move_to_extended(dev, 0, 80, 90, 50, 20, axes, 10); |
| 2061 |
litest_touch_move_to(dev, 0, 50, 20, 80, 90, 10); |
| 2062 |
litest_touch_up(dev, 0); |
| 2063 |
|
| 2064 |
litest_assert_empty_queue(li); |
| 2065 |
} |
| 2066 |
END_TEST |
| 2067 |
|
| 2068 |
START_TEST(touchpad_palm_detect_pressure_after_edge) |
| 2069 |
{ |
| 2070 |
struct litest_device *dev = litest_current_device(); |
| 2071 |
struct libinput *li = dev->libinput; |
| 2072 |
struct axis_replacement axes[] = { |
| 2073 |
{ ABS_MT_PRESSURE, 75 }, |
| 2074 |
{ -1, 0 }, |
| 2075 |
}; |
| 2076 |
|
| 2077 |
if (!touchpad_has_palm_pressure(dev) || !litest_has_palm_detect_size(dev) || |
| 2078 |
!litest_has_2fg_scroll(dev)) |
| 2079 |
return LITEST_NOT_APPLICABLE; |
| 2080 |
|
| 2081 |
litest_enable_2fg_scroll(dev); |
| 2082 |
litest_disable_tap(dev->libinput_device); |
| 2083 |
litest_disable_hold_gestures(dev->libinput_device); |
| 2084 |
litest_drain_events(li); |
| 2085 |
|
| 2086 |
litest_touch_down(dev, 0, 99, 50); |
| 2087 |
litest_touch_move_to_extended(dev, 0, 99, 50, 20, 50, axes, 20); |
| 2088 |
litest_touch_up(dev, 0); |
| 2089 |
litest_dispatch(li); |
| 2090 |
|
| 2091 |
litest_assert_empty_queue(li); |
| 2092 |
} |
| 2093 |
END_TEST |
| 2094 |
|
| 2095 |
START_TEST(touchpad_palm_detect_pressure_after_dwt) |
| 2096 |
{ |
| 2097 |
struct litest_device *touchpad = litest_current_device(); |
| 2098 |
struct litest_device *keyboard; |
| 2099 |
struct libinput *li = touchpad->libinput; |
| 2100 |
struct axis_replacement axes[] = { |
| 2101 |
{ ABS_MT_PRESSURE, 75 }, |
| 2102 |
{ -1, 0 }, |
| 2103 |
}; |
| 2104 |
|
| 2105 |
if (!touchpad_has_palm_pressure(touchpad)) |
| 2106 |
return LITEST_NOT_APPLICABLE; |
| 2107 |
|
| 2108 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 2109 |
litest_disable_tap(touchpad->libinput_device); |
| 2110 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 2111 |
litest_drain_events(li); |
| 2112 |
|
| 2113 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 2114 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 2115 |
litest_drain_events(li); |
| 2116 |
|
| 2117 |
/* within dwt timeout, dwt blocks events */ |
| 2118 |
litest_touch_down(touchpad, 0, 50, 50); |
| 2119 |
litest_touch_move_to_extended(touchpad, 0, 50, 50, 20, 50, axes, 20); |
| 2120 |
litest_assert_empty_queue(li); |
| 2121 |
|
| 2122 |
litest_timeout_dwt_short(li); |
| 2123 |
litest_assert_empty_queue(li); |
| 2124 |
|
| 2125 |
/* after dwt timeout, pressure blocks events */ |
| 2126 |
litest_touch_move_to_extended(touchpad, 0, 20, 50, 50, 50, axes, 20); |
| 2127 |
litest_touch_up(touchpad, 0); |
| 2128 |
|
| 2129 |
litest_assert_empty_queue(li); |
| 2130 |
|
| 2131 |
litest_device_destroy(keyboard); |
| 2132 |
} |
| 2133 |
END_TEST |
| 2134 |
|
| 2135 |
START_TEST(touchpad_palm_ignore_threshold_zero) |
| 2136 |
{ |
| 2137 |
struct litest_device *dev = litest_current_device(); |
| 2138 |
struct libinput *li = dev->libinput; |
| 2139 |
struct axis_replacement axes[] = { |
| 2140 |
{ ABS_MT_PRESSURE, 75 }, |
| 2141 |
{ -1, 0 }, |
| 2142 |
}; |
| 2143 |
|
| 2144 |
litest_disable_tap(dev->libinput_device); |
| 2145 |
litest_disable_hold_gestures(dev->libinput_device); |
| 2146 |
litest_drain_events(li); |
| 2147 |
|
| 2148 |
litest_touch_down_extended(dev, 0, 50, 99, axes); |
| 2149 |
litest_touch_move_to(dev, 0, 50, 50, 80, 99, 10); |
| 2150 |
litest_touch_up(dev, 0); |
| 2151 |
|
| 2152 |
litest_dispatch(li); |
| 2153 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 2154 |
} |
| 2155 |
END_TEST |
| 2156 |
|
| 2157 |
START_TEST(touchpad_palm_clickfinger_pressure) |
| 2158 |
{ |
| 2159 |
struct litest_device *dev = litest_current_device(); |
| 2160 |
struct libinput *li = dev->libinput; |
| 2161 |
struct axis_replacement axes[] = { |
| 2162 |
{ ABS_MT_PRESSURE, 75 }, |
| 2163 |
{ -1, 0 }, |
| 2164 |
}; |
| 2165 |
|
| 2166 |
if (!touchpad_has_palm_pressure(dev)) |
| 2167 |
return LITEST_NOT_APPLICABLE; |
| 2168 |
|
| 2169 |
litest_enable_clickfinger(dev); |
| 2170 |
litest_disable_tap(dev->libinput_device); |
| 2171 |
litest_disable_hold_gestures(dev->libinput_device); |
| 2172 |
litest_drain_events(li); |
| 2173 |
|
| 2174 |
litest_touch_down_extended(dev, 0, 50, 95, axes); |
| 2175 |
litest_touch_down(dev, 1, 50, 50); |
| 2176 |
litest_button_click(dev, BTN_LEFT, true); |
| 2177 |
litest_button_click(dev, BTN_LEFT, false); |
| 2178 |
|
| 2179 |
litest_touch_up(dev, 1); |
| 2180 |
litest_touch_up(dev, 0); |
| 2181 |
|
| 2182 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 2183 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 2184 |
litest_assert_empty_queue(li); |
| 2185 |
} |
| 2186 |
END_TEST |
| 2187 |
|
| 2188 |
START_TEST(touchpad_palm_clickfinger_pressure_2fg) |
| 2189 |
{ |
| 2190 |
struct litest_device *dev = litest_current_device(); |
| 2191 |
struct libinput *li = dev->libinput; |
| 2192 |
struct axis_replacement axes[] = { |
| 2193 |
{ ABS_MT_PRESSURE, 75 }, |
| 2194 |
{ -1, 0 }, |
| 2195 |
}; |
| 2196 |
|
| 2197 |
if (!touchpad_has_palm_pressure(dev)) |
| 2198 |
return LITEST_NOT_APPLICABLE; |
| 2199 |
|
| 2200 |
if (libevdev_get_num_slots(dev->evdev) < 3) |
| 2201 |
return LITEST_NOT_APPLICABLE; |
| 2202 |
|
| 2203 |
litest_enable_clickfinger(dev); |
| 2204 |
litest_disable_tap(dev->libinput_device); |
| 2205 |
litest_disable_hold_gestures(dev->libinput_device); |
| 2206 |
litest_drain_events(li); |
| 2207 |
|
| 2208 |
litest_touch_down_extended(dev, 0, 50, 95, axes); |
| 2209 |
litest_touch_down(dev, 1, 50, 50); |
| 2210 |
litest_touch_down(dev, 2, 50, 60); |
| 2211 |
litest_button_click(dev, BTN_LEFT, true); |
| 2212 |
litest_button_click(dev, BTN_LEFT, false); |
| 2213 |
|
| 2214 |
litest_touch_up(dev, 1); |
| 2215 |
litest_touch_up(dev, 2); |
| 2216 |
litest_touch_up(dev, 0); |
| 2217 |
|
| 2218 |
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 2219 |
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 2220 |
litest_assert_empty_queue(li); |
| 2221 |
} |
| 2222 |
END_TEST |
| 2223 |
|
| 2224 |
static inline bool |
| 2225 |
touchpad_has_touch_size(struct litest_device *dev) |
| 2226 |
{ |
| 2227 |
struct libevdev *evdev = dev->evdev; |
| 2228 |
|
| 2229 |
if (!libevdev_has_event_code(evdev, EV_ABS, ABS_MT_TOUCH_MAJOR)) |
| 2230 |
return false; |
| 2231 |
|
| 2232 |
if (libevdev_get_id_vendor(evdev) == VENDOR_ID_APPLE) |
| 2233 |
return true; |
| 2234 |
|
| 2235 |
return false; |
| 2236 |
} |
| 2237 |
|
| 2238 |
START_TEST(touchpad_palm_clickfinger_size) |
| 2239 |
{ |
| 2240 |
struct litest_device *dev = litest_current_device(); |
| 2241 |
struct libinput *li = dev->libinput; |
| 2242 |
struct axis_replacement axes[] = { |
| 2243 |
{ ABS_MT_TOUCH_MAJOR, 0 }, |
| 2244 |
{ ABS_MT_TOUCH_MINOR, 0 }, |
| 2245 |
{ ABS_MT_ORIENTATION, 0 }, |
| 2246 |
{ -1, 0 }, |
| 2247 |
}; |
| 2248 |
|
| 2249 |
if (!touchpad_has_touch_size(dev)) |
| 2250 |
return LITEST_NOT_APPLICABLE; |
| 2251 |
|
| 2252 |
litest_enable_clickfinger(dev); |
| 2253 |
litest_disable_tap(dev->libinput_device); |
| 2254 |
litest_disable_hold_gestures(dev->libinput_device); |
| 2255 |
litest_drain_events(li); |
| 2256 |
|
| 2257 |
litest_touch_down_extended(dev, 0, 50, 95, axes); |
| 2258 |
litest_touch_down(dev, 1, 50, 50); |
| 2259 |
litest_button_click(dev, BTN_LEFT, true); |
| 2260 |
litest_button_click(dev, BTN_LEFT, false); |
| 2261 |
|
| 2262 |
litest_touch_up(dev, 1); |
| 2263 |
litest_touch_up(dev, 0); |
| 2264 |
|
| 2265 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 2266 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 2267 |
litest_assert_empty_queue(li); |
| 2268 |
} |
| 2269 |
END_TEST |
| 2270 |
|
| 2271 |
START_TEST(touchpad_palm_clickfinger_size_2fg) |
| 2272 |
{ |
| 2273 |
struct litest_device *dev = litest_current_device(); |
| 2274 |
struct libinput *li = dev->libinput; |
| 2275 |
struct axis_replacement axes[] = { |
| 2276 |
{ ABS_MT_TOUCH_MAJOR, 0 }, |
| 2277 |
{ ABS_MT_TOUCH_MINOR, 0 }, |
| 2278 |
{ ABS_MT_ORIENTATION, 0 }, |
| 2279 |
{ -1, 0 }, |
| 2280 |
}; |
| 2281 |
|
| 2282 |
if (!touchpad_has_touch_size(dev)) |
| 2283 |
return LITEST_NOT_APPLICABLE; |
| 2284 |
|
| 2285 |
if (libevdev_get_num_slots(dev->evdev) < 3) |
| 2286 |
return LITEST_NOT_APPLICABLE; |
| 2287 |
|
| 2288 |
litest_enable_clickfinger(dev); |
| 2289 |
litest_disable_tap(dev->libinput_device); |
| 2290 |
litest_disable_hold_gestures(dev->libinput_device); |
| 2291 |
litest_drain_events(li); |
| 2292 |
|
| 2293 |
litest_touch_down_extended(dev, 0, 50, 95, axes); |
| 2294 |
litest_touch_down(dev, 1, 50, 50); |
| 2295 |
litest_touch_down(dev, 2, 50, 60); |
| 2296 |
litest_button_click(dev, BTN_LEFT, true); |
| 2297 |
litest_button_click(dev, BTN_LEFT, false); |
| 2298 |
|
| 2299 |
litest_touch_up(dev, 1); |
| 2300 |
litest_touch_up(dev, 2); |
| 2301 |
litest_touch_up(dev, 0); |
| 2302 |
|
| 2303 |
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 2304 |
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 2305 |
litest_assert_empty_queue(li); |
| 2306 |
} |
| 2307 |
END_TEST |
| 2308 |
|
| 2309 |
START_TEST(touchpad_left_handed) |
| 2310 |
{ |
| 2311 |
struct litest_device *dev = litest_current_device(); |
| 2312 |
struct libinput_device *d = dev->libinput_device; |
| 2313 |
struct libinput *li = dev->libinput; |
| 2314 |
enum libinput_config_status status; |
| 2315 |
|
| 2316 |
if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_APPLE && |
| 2317 |
libevdev_get_id_product(dev->evdev) == PRODUCT_ID_APPLE_APPLETOUCH) |
| 2318 |
return LITEST_NOT_APPLICABLE; |
| 2319 |
|
| 2320 |
status = libinput_device_config_left_handed_set(d, 1); |
| 2321 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 2322 |
|
| 2323 |
litest_drain_events(li); |
| 2324 |
litest_button_click(dev, BTN_LEFT, 1); |
| 2325 |
litest_button_click(dev, BTN_LEFT, 0); |
| 2326 |
|
| 2327 |
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 2328 |
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 2329 |
|
| 2330 |
litest_button_click(dev, BTN_RIGHT, 1); |
| 2331 |
litest_button_click(dev, BTN_RIGHT, 0); |
| 2332 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 2333 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 2334 |
|
| 2335 |
if (libevdev_has_event_code(dev->evdev, EV_KEY, BTN_MIDDLE)) { |
| 2336 |
litest_button_click(dev, BTN_MIDDLE, 1); |
| 2337 |
litest_button_click(dev, BTN_MIDDLE, 0); |
| 2338 |
litest_assert_button_event(li, |
| 2339 |
BTN_MIDDLE, |
| 2340 |
LIBINPUT_BUTTON_STATE_PRESSED); |
| 2341 |
litest_assert_button_event(li, |
| 2342 |
BTN_MIDDLE, |
| 2343 |
LIBINPUT_BUTTON_STATE_RELEASED); |
| 2344 |
} |
| 2345 |
} |
| 2346 |
END_TEST |
| 2347 |
|
| 2348 |
START_TEST(touchpad_left_handed_appletouch) |
| 2349 |
{ |
| 2350 |
struct litest_device *dev = litest_current_device(); |
| 2351 |
struct libinput_device *d = dev->libinput_device; |
| 2352 |
enum libinput_config_status status; |
| 2353 |
|
| 2354 |
litest_assert_int_eq(libinput_device_config_left_handed_is_available(d), 0); |
| 2355 |
status = libinput_device_config_left_handed_set(d, 1); |
| 2356 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); |
| 2357 |
litest_assert_int_eq(libinput_device_config_left_handed_get(d), 0); |
| 2358 |
} |
| 2359 |
END_TEST |
| 2360 |
|
| 2361 |
START_TEST(touchpad_left_handed_clickpad) |
| 2362 |
{ |
| 2363 |
struct litest_device *dev = litest_current_device(); |
| 2364 |
struct libinput_device *d = dev->libinput_device; |
| 2365 |
struct libinput *li = dev->libinput; |
| 2366 |
enum libinput_config_status status; |
| 2367 |
|
| 2368 |
if (!libinput_device_config_left_handed_is_available(d)) |
| 2369 |
return LITEST_NOT_APPLICABLE; |
| 2370 |
|
| 2371 |
status = libinput_device_config_left_handed_set(d, 1); |
| 2372 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 2373 |
|
| 2374 |
litest_drain_events(li); |
| 2375 |
litest_touch_down(dev, 0, 10, 90); |
| 2376 |
litest_button_click(dev, BTN_LEFT, 1); |
| 2377 |
litest_button_click(dev, BTN_LEFT, 0); |
| 2378 |
litest_touch_up(dev, 0); |
| 2379 |
|
| 2380 |
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 2381 |
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 2382 |
|
| 2383 |
litest_drain_events(li); |
| 2384 |
litest_touch_down(dev, 0, 90, 90); |
| 2385 |
litest_button_click(dev, BTN_LEFT, 1); |
| 2386 |
litest_button_click(dev, BTN_LEFT, 0); |
| 2387 |
litest_touch_up(dev, 0); |
| 2388 |
|
| 2389 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 2390 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 2391 |
|
| 2392 |
litest_drain_events(li); |
| 2393 |
litest_touch_down(dev, 0, 50, 50); |
| 2394 |
litest_button_click(dev, BTN_LEFT, 1); |
| 2395 |
litest_button_click(dev, BTN_LEFT, 0); |
| 2396 |
litest_touch_up(dev, 0); |
| 2397 |
|
| 2398 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 2399 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 2400 |
} |
| 2401 |
END_TEST |
| 2402 |
|
| 2403 |
START_TEST(touchpad_left_handed_clickfinger) |
| 2404 |
{ |
| 2405 |
struct litest_device *dev = litest_current_device(); |
| 2406 |
struct libinput_device *d = dev->libinput_device; |
| 2407 |
struct libinput *li = dev->libinput; |
| 2408 |
enum libinput_config_status status; |
| 2409 |
|
| 2410 |
if (!libinput_device_config_left_handed_is_available(d)) |
| 2411 |
return LITEST_NOT_APPLICABLE; |
| 2412 |
|
| 2413 |
status = libinput_device_config_left_handed_set(d, 1); |
| 2414 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 2415 |
|
| 2416 |
litest_drain_events(li); |
| 2417 |
litest_touch_down(dev, 0, 10, 90); |
| 2418 |
litest_button_click(dev, BTN_LEFT, 1); |
| 2419 |
litest_button_click(dev, BTN_LEFT, 0); |
| 2420 |
litest_touch_up(dev, 0); |
| 2421 |
|
| 2422 |
/* Clickfinger is unaffected by left-handed setting */ |
| 2423 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 2424 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 2425 |
|
| 2426 |
litest_drain_events(li); |
| 2427 |
litest_touch_down(dev, 0, 10, 90); |
| 2428 |
litest_touch_down(dev, 1, 30, 90); |
| 2429 |
litest_button_click(dev, BTN_LEFT, 1); |
| 2430 |
litest_button_click(dev, BTN_LEFT, 0); |
| 2431 |
litest_touch_up(dev, 0); |
| 2432 |
litest_touch_up(dev, 1); |
| 2433 |
|
| 2434 |
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 2435 |
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 2436 |
} |
| 2437 |
END_TEST |
| 2438 |
|
| 2439 |
START_TEST(touchpad_left_handed_tapping) |
| 2440 |
{ |
| 2441 |
struct litest_device *dev = litest_current_device(); |
| 2442 |
struct libinput_device *d = dev->libinput_device; |
| 2443 |
struct libinput *li = dev->libinput; |
| 2444 |
enum libinput_config_status status; |
| 2445 |
|
| 2446 |
if (!libinput_device_config_left_handed_is_available(d)) |
| 2447 |
return LITEST_NOT_APPLICABLE; |
| 2448 |
|
| 2449 |
litest_enable_tap(dev->libinput_device); |
| 2450 |
litest_disable_hold_gestures(dev->libinput_device); |
| 2451 |
|
| 2452 |
status = libinput_device_config_left_handed_set(d, 1); |
| 2453 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 2454 |
|
| 2455 |
litest_drain_events(li); |
| 2456 |
|
| 2457 |
litest_touch_down(dev, 0, 50, 50); |
| 2458 |
litest_touch_up(dev, 0); |
| 2459 |
litest_timeout_tap(li); |
| 2460 |
|
| 2461 |
/* Tapping is unaffected by left-handed setting */ |
| 2462 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 2463 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 2464 |
} |
| 2465 |
END_TEST |
| 2466 |
|
| 2467 |
START_TEST(touchpad_left_handed_tapping_2fg) |
| 2468 |
{ |
| 2469 |
struct litest_device *dev = litest_current_device(); |
| 2470 |
struct libinput_device *d = dev->libinput_device; |
| 2471 |
struct libinput *li = dev->libinput; |
| 2472 |
enum libinput_config_status status; |
| 2473 |
|
| 2474 |
if (!libinput_device_config_left_handed_is_available(d)) |
| 2475 |
return LITEST_NOT_APPLICABLE; |
| 2476 |
|
| 2477 |
litest_enable_tap(dev->libinput_device); |
| 2478 |
litest_disable_hold_gestures(dev->libinput_device); |
| 2479 |
|
| 2480 |
status = libinput_device_config_left_handed_set(d, 1); |
| 2481 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 2482 |
|
| 2483 |
litest_drain_events(li); |
| 2484 |
|
| 2485 |
litest_touch_down(dev, 0, 50, 50); |
| 2486 |
litest_touch_down(dev, 1, 70, 50); |
| 2487 |
litest_touch_up(dev, 1); |
| 2488 |
litest_touch_up(dev, 0); |
| 2489 |
litest_timeout_tap(li); |
| 2490 |
|
| 2491 |
/* Tapping is unaffected by left-handed setting */ |
| 2492 |
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 2493 |
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 2494 |
} |
| 2495 |
END_TEST |
| 2496 |
|
| 2497 |
START_TEST(touchpad_left_handed_delayed) |
| 2498 |
{ |
| 2499 |
struct litest_device *dev = litest_current_device(); |
| 2500 |
struct libinput_device *d = dev->libinput_device; |
| 2501 |
struct libinput *li = dev->libinput; |
| 2502 |
enum libinput_config_status status; |
| 2503 |
|
| 2504 |
if (!libinput_device_config_left_handed_is_available(d)) |
| 2505 |
return LITEST_NOT_APPLICABLE; |
| 2506 |
|
| 2507 |
litest_drain_events(li); |
| 2508 |
litest_button_click(dev, BTN_LEFT, 1); |
| 2509 |
litest_dispatch(li); |
| 2510 |
|
| 2511 |
status = libinput_device_config_left_handed_set(d, 1); |
| 2512 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 2513 |
|
| 2514 |
litest_button_click(dev, BTN_LEFT, 0); |
| 2515 |
|
| 2516 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 2517 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 2518 |
|
| 2519 |
/* left-handed takes effect now */ |
| 2520 |
litest_button_click(dev, BTN_RIGHT, 1); |
| 2521 |
litest_timeout_middlebutton(li); |
| 2522 |
litest_button_click(dev, BTN_LEFT, 1); |
| 2523 |
litest_dispatch(li); |
| 2524 |
|
| 2525 |
status = libinput_device_config_left_handed_set(d, 0); |
| 2526 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 2527 |
|
| 2528 |
litest_button_click(dev, BTN_RIGHT, 0); |
| 2529 |
litest_button_click(dev, BTN_LEFT, 0); |
| 2530 |
|
| 2531 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 2532 |
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 2533 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 2534 |
litest_assert_button_event(li, BTN_RIGHT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 2535 |
} |
| 2536 |
END_TEST |
| 2537 |
|
| 2538 |
START_TEST(touchpad_left_handed_clickpad_delayed) |
| 2539 |
{ |
| 2540 |
struct litest_device *dev = litest_current_device(); |
| 2541 |
struct libinput_device *d = dev->libinput_device; |
| 2542 |
struct libinput *li = dev->libinput; |
| 2543 |
enum libinput_config_status status; |
| 2544 |
|
| 2545 |
if (!libinput_device_config_left_handed_is_available(d)) |
| 2546 |
return LITEST_NOT_APPLICABLE; |
| 2547 |
|
| 2548 |
litest_drain_events(li); |
| 2549 |
litest_touch_down(dev, 0, 10, 90); |
| 2550 |
litest_button_click(dev, BTN_LEFT, 1); |
| 2551 |
litest_dispatch(li); |
| 2552 |
|
| 2553 |
status = libinput_device_config_left_handed_set(d, 1); |
| 2554 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 2555 |
|
| 2556 |
litest_button_click(dev, BTN_LEFT, 0); |
| 2557 |
litest_touch_up(dev, 0); |
| 2558 |
|
| 2559 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 2560 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 2561 |
|
| 2562 |
/* left-handed takes effect now */ |
| 2563 |
litest_drain_events(li); |
| 2564 |
litest_touch_down(dev, 0, 90, 90); |
| 2565 |
litest_button_click(dev, BTN_LEFT, 1); |
| 2566 |
litest_dispatch(li); |
| 2567 |
|
| 2568 |
status = libinput_device_config_left_handed_set(d, 0); |
| 2569 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 2570 |
|
| 2571 |
litest_button_click(dev, BTN_LEFT, 0); |
| 2572 |
litest_touch_up(dev, 0); |
| 2573 |
|
| 2574 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 2575 |
litest_assert_button_event(li, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 2576 |
} |
| 2577 |
END_TEST |
| 2578 |
|
| 2579 |
#ifdef HAVE_LIBWACOM |
| 2580 |
static inline bool |
| 2581 |
touchpad_has_rotation(struct libevdev *evdev) |
| 2582 |
{ |
| 2583 |
return libevdev_get_id_vendor(evdev) == VENDOR_ID_WACOM; |
| 2584 |
} |
| 2585 |
#endif /* HAVE_LIBWACOM */ |
| 2586 |
|
| 2587 |
START_TEST(touchpad_left_handed_rotation) |
| 2588 |
{ |
| 2589 |
#ifdef HAVE_LIBWACOM |
| 2590 |
struct litest_device *dev = litest_current_device(); |
| 2591 |
struct libinput_device *d = dev->libinput_device; |
| 2592 |
struct libinput *li = dev->libinput; |
| 2593 |
enum libinput_config_status status; |
| 2594 |
struct libinput_event *event; |
| 2595 |
bool rotate = touchpad_has_rotation(dev->evdev); |
| 2596 |
|
| 2597 |
if (!libinput_device_config_left_handed_is_available(d)) |
| 2598 |
return LITEST_NOT_APPLICABLE; |
| 2599 |
|
| 2600 |
status = libinput_device_config_left_handed_set(d, 1); |
| 2601 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 2602 |
|
| 2603 |
litest_drain_events(li); |
| 2604 |
|
| 2605 |
litest_touch_down(dev, 0, 20, 80); |
| 2606 |
litest_touch_move_to(dev, 0, 20, 80, 80, 20, 20); |
| 2607 |
litest_touch_up(dev, 0); |
| 2608 |
litest_dispatch(li); |
| 2609 |
|
| 2610 |
event = libinput_get_event(li); |
| 2611 |
litest_assert_notnull(event); |
| 2612 |
do { |
| 2613 |
struct libinput_event_pointer *p; |
| 2614 |
double x, y, ux, uy; |
| 2615 |
|
| 2616 |
p = litest_is_motion_event(event); |
| 2617 |
|
| 2618 |
x = libinput_event_pointer_get_dx(p); |
| 2619 |
y = libinput_event_pointer_get_dy(p); |
| 2620 |
ux = libinput_event_pointer_get_dx_unaccelerated(p); |
| 2621 |
uy = libinput_event_pointer_get_dy_unaccelerated(p); |
| 2622 |
|
| 2623 |
if (rotate) { |
| 2624 |
litest_assert_double_lt(x, 0); |
| 2625 |
litest_assert_double_gt(y, 0); |
| 2626 |
litest_assert_double_lt(ux, 0); |
| 2627 |
litest_assert_double_gt(uy, 0); |
| 2628 |
} else { |
| 2629 |
litest_assert_double_gt(x, 0); |
| 2630 |
litest_assert_double_lt(y, 0); |
| 2631 |
litest_assert_double_gt(ux, 0); |
| 2632 |
litest_assert_double_lt(uy, 0); |
| 2633 |
} |
| 2634 |
|
| 2635 |
libinput_event_destroy(event); |
| 2636 |
} while ((event = libinput_get_event(li))); |
| 2637 |
#endif |
| 2638 |
} |
| 2639 |
END_TEST |
| 2640 |
|
| 2641 |
static void |
| 2642 |
hover_continue(struct litest_device *dev, unsigned int slot, int x, int y) |
| 2643 |
{ |
| 2644 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, slot); |
| 2645 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); |
| 2646 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); |
| 2647 |
litest_event(dev, EV_ABS, ABS_X, x); |
| 2648 |
litest_event(dev, EV_ABS, ABS_Y, y); |
| 2649 |
litest_event(dev, EV_ABS, ABS_PRESSURE, 10); |
| 2650 |
litest_event(dev, EV_ABS, ABS_TOOL_WIDTH, 6); |
| 2651 |
/* WARNING: no SYN_REPORT! */ |
| 2652 |
} |
| 2653 |
|
| 2654 |
static void |
| 2655 |
hover_start(struct litest_device *dev, unsigned int slot, int x, int y) |
| 2656 |
{ |
| 2657 |
static unsigned int tracking_id; |
| 2658 |
|
| 2659 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, slot); |
| 2660 |
litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, ++tracking_id); |
| 2661 |
hover_continue(dev, slot, x, y); |
| 2662 |
/* WARNING: no SYN_REPORT! */ |
| 2663 |
} |
| 2664 |
|
| 2665 |
START_TEST(touchpad_semi_mt_hover_noevent) |
| 2666 |
{ |
| 2667 |
struct litest_device *dev = litest_current_device(); |
| 2668 |
struct libinput *li = dev->libinput; |
| 2669 |
int i; |
| 2670 |
int x = 2400, y = 2400; |
| 2671 |
|
| 2672 |
litest_drain_events(li); |
| 2673 |
|
| 2674 |
hover_start(dev, 0, x, y); |
| 2675 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); |
| 2676 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2677 |
|
| 2678 |
for (i = 0; i < 10; i++) { |
| 2679 |
x += 200; |
| 2680 |
y -= 200; |
| 2681 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); |
| 2682 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); |
| 2683 |
litest_event(dev, EV_ABS, ABS_X, x); |
| 2684 |
litest_event(dev, EV_ABS, ABS_Y, y); |
| 2685 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2686 |
} |
| 2687 |
|
| 2688 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); |
| 2689 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2690 |
|
| 2691 |
litest_assert_empty_queue(li); |
| 2692 |
} |
| 2693 |
END_TEST |
| 2694 |
|
| 2695 |
START_TEST(touchpad_semi_mt_hover_down) |
| 2696 |
{ |
| 2697 |
struct litest_device *dev = litest_current_device(); |
| 2698 |
struct libinput *li = dev->libinput; |
| 2699 |
struct libinput_event *event; |
| 2700 |
int i; |
| 2701 |
int x = 2400, y = 2400; |
| 2702 |
|
| 2703 |
litest_drain_events(li); |
| 2704 |
|
| 2705 |
hover_start(dev, 0, x, y); |
| 2706 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); |
| 2707 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2708 |
|
| 2709 |
for (i = 0; i < 10; i++) { |
| 2710 |
x += 200; |
| 2711 |
y -= 200; |
| 2712 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); |
| 2713 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); |
| 2714 |
litest_event(dev, EV_ABS, ABS_X, x); |
| 2715 |
litest_event(dev, EV_ABS, ABS_Y, y); |
| 2716 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2717 |
} |
| 2718 |
|
| 2719 |
litest_assert_empty_queue(li); |
| 2720 |
|
| 2721 |
litest_event(dev, EV_ABS, ABS_X, x + 100); |
| 2722 |
litest_event(dev, EV_ABS, ABS_Y, y + 100); |
| 2723 |
litest_event(dev, EV_ABS, ABS_PRESSURE, 50); |
| 2724 |
litest_event(dev, EV_KEY, BTN_TOUCH, 1); |
| 2725 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2726 |
litest_dispatch(li); |
| 2727 |
for (i = 0; i < 10; i++) { |
| 2728 |
x -= 200; |
| 2729 |
y += 200; |
| 2730 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); |
| 2731 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); |
| 2732 |
litest_event(dev, EV_ABS, ABS_X, x); |
| 2733 |
litest_event(dev, EV_ABS, ABS_Y, y); |
| 2734 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2735 |
} |
| 2736 |
|
| 2737 |
litest_dispatch(li); |
| 2738 |
|
| 2739 |
litest_wait_for_event(li); |
| 2740 |
while ((event = libinput_get_event(li)) != NULL) { |
| 2741 |
litest_assert_event_type(event, LIBINPUT_EVENT_POINTER_MOTION); |
| 2742 |
libinput_event_destroy(event); |
| 2743 |
litest_dispatch(li); |
| 2744 |
} |
| 2745 |
|
| 2746 |
/* go back to hover */ |
| 2747 |
hover_continue(dev, 0, x, y); |
| 2748 |
litest_event(dev, EV_ABS, ABS_PRESSURE, 0); |
| 2749 |
litest_event(dev, EV_KEY, BTN_TOUCH, 0); |
| 2750 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2751 |
|
| 2752 |
for (i = 0; i < 10; i++) { |
| 2753 |
x += 200; |
| 2754 |
y -= 200; |
| 2755 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); |
| 2756 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); |
| 2757 |
litest_event(dev, EV_ABS, ABS_X, x); |
| 2758 |
litest_event(dev, EV_ABS, ABS_Y, y); |
| 2759 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2760 |
} |
| 2761 |
|
| 2762 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); |
| 2763 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2764 |
|
| 2765 |
litest_assert_empty_queue(li); |
| 2766 |
} |
| 2767 |
END_TEST |
| 2768 |
|
| 2769 |
START_TEST(touchpad_semi_mt_hover_down_hover_down) |
| 2770 |
{ |
| 2771 |
struct litest_device *dev = litest_current_device(); |
| 2772 |
struct libinput *li = dev->libinput; |
| 2773 |
int i, j; |
| 2774 |
int x = 1400, y = 1400; |
| 2775 |
|
| 2776 |
litest_drain_events(li); |
| 2777 |
|
| 2778 |
/* hover */ |
| 2779 |
hover_start(dev, 0, x, y); |
| 2780 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); |
| 2781 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2782 |
litest_assert_empty_queue(li); |
| 2783 |
|
| 2784 |
for (i = 0; i < 3; i++) { |
| 2785 |
/* touch */ |
| 2786 |
litest_event(dev, EV_ABS, ABS_X, x + 100); |
| 2787 |
litest_event(dev, EV_ABS, ABS_Y, y + 100); |
| 2788 |
litest_event(dev, EV_ABS, ABS_PRESSURE, 50); |
| 2789 |
litest_event(dev, EV_KEY, BTN_TOUCH, 1); |
| 2790 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2791 |
litest_dispatch(li); |
| 2792 |
|
| 2793 |
for (j = 0; j < 5; j++) { |
| 2794 |
x += 200; |
| 2795 |
y += 200; |
| 2796 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); |
| 2797 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); |
| 2798 |
litest_event(dev, EV_ABS, ABS_X, x); |
| 2799 |
litest_event(dev, EV_ABS, ABS_Y, y); |
| 2800 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2801 |
} |
| 2802 |
|
| 2803 |
litest_dispatch(li); |
| 2804 |
|
| 2805 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 2806 |
|
| 2807 |
/* go back to hover */ |
| 2808 |
hover_continue(dev, 0, x, y); |
| 2809 |
litest_event(dev, EV_ABS, ABS_PRESSURE, 0); |
| 2810 |
litest_event(dev, EV_KEY, BTN_TOUCH, 0); |
| 2811 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2812 |
|
| 2813 |
for (j = 0; j < 5; j++) { |
| 2814 |
x -= 200; |
| 2815 |
y -= 200; |
| 2816 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); |
| 2817 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); |
| 2818 |
litest_event(dev, EV_ABS, ABS_X, x); |
| 2819 |
litest_event(dev, EV_ABS, ABS_Y, y); |
| 2820 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2821 |
} |
| 2822 |
|
| 2823 |
litest_assert_empty_queue(li); |
| 2824 |
} |
| 2825 |
|
| 2826 |
/* touch */ |
| 2827 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); |
| 2828 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2829 |
|
| 2830 |
litest_assert_empty_queue(li); |
| 2831 |
|
| 2832 |
/* start a new touch to be sure */ |
| 2833 |
litest_push_event_frame(dev); |
| 2834 |
litest_touch_down(dev, 0, 50, 50); |
| 2835 |
litest_event(dev, EV_ABS, ABS_PRESSURE, 50); |
| 2836 |
litest_pop_event_frame(dev); |
| 2837 |
litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10); |
| 2838 |
litest_touch_up(dev, 0); |
| 2839 |
|
| 2840 |
litest_dispatch(li); |
| 2841 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 2842 |
} |
| 2843 |
END_TEST |
| 2844 |
|
| 2845 |
START_TEST(touchpad_semi_mt_hover_down_up) |
| 2846 |
{ |
| 2847 |
struct litest_device *dev = litest_current_device(); |
| 2848 |
struct libinput *li = dev->libinput; |
| 2849 |
int i; |
| 2850 |
int x = 1400, y = 1400; |
| 2851 |
|
| 2852 |
litest_drain_events(li); |
| 2853 |
|
| 2854 |
/* hover two fingers, then touch */ |
| 2855 |
hover_start(dev, 0, x, y); |
| 2856 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); |
| 2857 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2858 |
litest_assert_empty_queue(li); |
| 2859 |
|
| 2860 |
hover_start(dev, 1, x, y); |
| 2861 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); |
| 2862 |
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); |
| 2863 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2864 |
litest_assert_empty_queue(li); |
| 2865 |
|
| 2866 |
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); |
| 2867 |
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); |
| 2868 |
litest_event(dev, EV_KEY, BTN_TOUCH, 1); |
| 2869 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2870 |
|
| 2871 |
litest_assert_empty_queue(li); |
| 2872 |
|
| 2873 |
/* hover first finger, end second in same frame */ |
| 2874 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); |
| 2875 |
litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); |
| 2876 |
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); |
| 2877 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); |
| 2878 |
litest_event(dev, EV_KEY, BTN_TOUCH, 0); |
| 2879 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2880 |
|
| 2881 |
litest_assert_empty_queue(li); |
| 2882 |
|
| 2883 |
litest_event(dev, EV_ABS, ABS_PRESSURE, 50); |
| 2884 |
litest_event(dev, EV_KEY, BTN_TOUCH, 1); |
| 2885 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2886 |
litest_dispatch(li); |
| 2887 |
|
| 2888 |
/* now move the finger */ |
| 2889 |
for (i = 0; i < 10; i++) { |
| 2890 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); |
| 2891 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); |
| 2892 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); |
| 2893 |
litest_event(dev, EV_ABS, ABS_X, x); |
| 2894 |
litest_event(dev, EV_ABS, ABS_Y, y); |
| 2895 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2896 |
x -= 100; |
| 2897 |
y -= 100; |
| 2898 |
} |
| 2899 |
|
| 2900 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 2901 |
|
| 2902 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); |
| 2903 |
litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); |
| 2904 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); |
| 2905 |
litest_event(dev, EV_KEY, BTN_TOUCH, 0); |
| 2906 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2907 |
litest_dispatch(li); |
| 2908 |
} |
| 2909 |
END_TEST |
| 2910 |
|
| 2911 |
START_TEST(touchpad_semi_mt_hover_2fg_noevent) |
| 2912 |
{ |
| 2913 |
struct litest_device *dev = litest_current_device(); |
| 2914 |
struct libinput *li = dev->libinput; |
| 2915 |
int i; |
| 2916 |
int x = 2400, y = 2400; |
| 2917 |
|
| 2918 |
litest_drain_events(li); |
| 2919 |
|
| 2920 |
hover_start(dev, 0, x, y); |
| 2921 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); |
| 2922 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2923 |
|
| 2924 |
hover_start(dev, 1, x + 500, y + 500); |
| 2925 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); |
| 2926 |
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); |
| 2927 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2928 |
|
| 2929 |
for (i = 0; i < 10; i++) { |
| 2930 |
x += 200; |
| 2931 |
y -= 200; |
| 2932 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); |
| 2933 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); |
| 2934 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); |
| 2935 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); |
| 2936 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x + 500); |
| 2937 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y + 500); |
| 2938 |
litest_event(dev, EV_ABS, ABS_X, x); |
| 2939 |
litest_event(dev, EV_ABS, ABS_Y, y); |
| 2940 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2941 |
} |
| 2942 |
|
| 2943 |
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); |
| 2944 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2945 |
|
| 2946 |
litest_assert_empty_queue(li); |
| 2947 |
|
| 2948 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); |
| 2949 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2950 |
|
| 2951 |
litest_assert_empty_queue(li); |
| 2952 |
} |
| 2953 |
END_TEST |
| 2954 |
|
| 2955 |
START_TEST(touchpad_semi_mt_hover_2fg_1fg_down) |
| 2956 |
{ |
| 2957 |
struct litest_device *dev = litest_current_device(); |
| 2958 |
struct libinput *li = dev->libinput; |
| 2959 |
int i; |
| 2960 |
int x = 2400, y = 2400; |
| 2961 |
|
| 2962 |
litest_drain_events(li); |
| 2963 |
|
| 2964 |
/* two slots active, but BTN_TOOL_FINGER only */ |
| 2965 |
hover_start(dev, 0, x, y); |
| 2966 |
hover_start(dev, 1, x + 500, y + 500); |
| 2967 |
litest_event(dev, EV_ABS, ABS_PRESSURE, 50); |
| 2968 |
litest_event(dev, EV_KEY, BTN_TOUCH, 1); |
| 2969 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); |
| 2970 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2971 |
|
| 2972 |
for (i = 0; i < 10; i++) { |
| 2973 |
x += 200; |
| 2974 |
y -= 200; |
| 2975 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); |
| 2976 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x); |
| 2977 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y); |
| 2978 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); |
| 2979 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, x + 500); |
| 2980 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, y + 500); |
| 2981 |
litest_event(dev, EV_ABS, ABS_X, x); |
| 2982 |
litest_event(dev, EV_ABS, ABS_Y, y); |
| 2983 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2984 |
} |
| 2985 |
|
| 2986 |
litest_event(dev, EV_ABS, ABS_PRESSURE, 0); |
| 2987 |
litest_event(dev, EV_KEY, BTN_TOUCH, 0); |
| 2988 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); |
| 2989 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 2990 |
|
| 2991 |
litest_dispatch(li); |
| 2992 |
|
| 2993 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 2994 |
} |
| 2995 |
END_TEST |
| 2996 |
|
| 2997 |
START_TEST(touchpad_semi_mt_hover_2fg_up) |
| 2998 |
{ |
| 2999 |
struct litest_device *dev = litest_current_device(); |
| 3000 |
struct libinput *li = dev->libinput; |
| 3001 |
|
| 3002 |
litest_touch_down(dev, 0, 70, 50); |
| 3003 |
litest_touch_down(dev, 1, 50, 50); |
| 3004 |
|
| 3005 |
litest_push_event_frame(dev); |
| 3006 |
litest_touch_move(dev, 0, 72, 50); |
| 3007 |
litest_touch_move(dev, 1, 52, 50); |
| 3008 |
litest_event(dev, EV_ABS, ABS_PRESSURE, 0); |
| 3009 |
litest_event(dev, EV_KEY, BTN_TOUCH, 0); |
| 3010 |
litest_pop_event_frame(dev); |
| 3011 |
|
| 3012 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); |
| 3013 |
litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); |
| 3014 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); |
| 3015 |
litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); |
| 3016 |
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); |
| 3017 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 3018 |
|
| 3019 |
litest_drain_events(li); |
| 3020 |
} |
| 3021 |
END_TEST |
| 3022 |
|
| 3023 |
START_TEST(touchpad_hover_noevent) |
| 3024 |
{ |
| 3025 |
struct litest_device *dev = litest_current_device(); |
| 3026 |
struct libinput *li = dev->libinput; |
| 3027 |
|
| 3028 |
litest_drain_events(li); |
| 3029 |
|
| 3030 |
litest_hover_start(dev, 0, 50, 50); |
| 3031 |
litest_hover_move_to(dev, 0, 50, 50, 70, 70, 10); |
| 3032 |
litest_hover_end(dev, 0); |
| 3033 |
|
| 3034 |
litest_assert_empty_queue(li); |
| 3035 |
} |
| 3036 |
END_TEST |
| 3037 |
|
| 3038 |
START_TEST(touchpad_hover_down) |
| 3039 |
{ |
| 3040 |
struct litest_device *dev = litest_current_device(); |
| 3041 |
struct libinput *li = dev->libinput; |
| 3042 |
|
| 3043 |
litest_drain_events(li); |
| 3044 |
|
| 3045 |
/* hover the finger */ |
| 3046 |
litest_hover_start(dev, 0, 50, 50); |
| 3047 |
|
| 3048 |
litest_hover_move_to(dev, 0, 50, 50, 70, 70, 10); |
| 3049 |
|
| 3050 |
litest_assert_empty_queue(li); |
| 3051 |
|
| 3052 |
/* touch the finger on the sensor */ |
| 3053 |
litest_touch_move_to(dev, 0, 70, 70, 50, 50, 10); |
| 3054 |
|
| 3055 |
litest_dispatch(li); |
| 3056 |
|
| 3057 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 3058 |
|
| 3059 |
/* go back to hover */ |
| 3060 |
litest_hover_move_to(dev, 0, 50, 50, 70, 70, 10); |
| 3061 |
litest_hover_end(dev, 0); |
| 3062 |
|
| 3063 |
litest_assert_empty_queue(li); |
| 3064 |
} |
| 3065 |
END_TEST |
| 3066 |
|
| 3067 |
START_TEST(touchpad_hover_down_hover_down) |
| 3068 |
{ |
| 3069 |
struct litest_device *dev = litest_current_device(); |
| 3070 |
struct libinput *li = dev->libinput; |
| 3071 |
int i; |
| 3072 |
|
| 3073 |
litest_drain_events(li); |
| 3074 |
|
| 3075 |
litest_hover_start(dev, 0, 50, 50); |
| 3076 |
|
| 3077 |
for (i = 0; i < 3; i++) { |
| 3078 |
|
| 3079 |
/* hover the finger */ |
| 3080 |
litest_hover_move_to(dev, 0, 50, 50, 70, 70, 10); |
| 3081 |
|
| 3082 |
litest_assert_empty_queue(li); |
| 3083 |
|
| 3084 |
/* touch the finger */ |
| 3085 |
litest_touch_move_to(dev, 0, 70, 70, 50, 50, 10); |
| 3086 |
|
| 3087 |
litest_dispatch(li); |
| 3088 |
|
| 3089 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 3090 |
} |
| 3091 |
|
| 3092 |
litest_hover_end(dev, 0); |
| 3093 |
|
| 3094 |
/* start a new touch to be sure */ |
| 3095 |
litest_touch_down(dev, 0, 50, 50); |
| 3096 |
litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10); |
| 3097 |
litest_touch_up(dev, 0); |
| 3098 |
|
| 3099 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 3100 |
} |
| 3101 |
END_TEST |
| 3102 |
|
| 3103 |
START_TEST(touchpad_hover_down_up) |
| 3104 |
{ |
| 3105 |
struct litest_device *dev = litest_current_device(); |
| 3106 |
struct libinput *li = dev->libinput; |
| 3107 |
|
| 3108 |
litest_drain_events(li); |
| 3109 |
|
| 3110 |
/* hover two fingers, and a touch */ |
| 3111 |
litest_push_event_frame(dev); |
| 3112 |
litest_hover_start(dev, 0, 50, 50); |
| 3113 |
litest_hover_start(dev, 1, 50, 50); |
| 3114 |
litest_touch_down(dev, 2, 50, 50); |
| 3115 |
litest_pop_event_frame(dev); |
| 3116 |
|
| 3117 |
litest_assert_empty_queue(li); |
| 3118 |
|
| 3119 |
/* hover first finger, end second and third in same frame */ |
| 3120 |
litest_push_event_frame(dev); |
| 3121 |
litest_hover_move(dev, 0, 55, 55); |
| 3122 |
litest_hover_end(dev, 1); |
| 3123 |
litest_touch_up(dev, 2); |
| 3124 |
litest_pop_event_frame(dev); |
| 3125 |
|
| 3126 |
litest_assert_empty_queue(li); |
| 3127 |
|
| 3128 |
/* now move the finger */ |
| 3129 |
litest_touch_move_to(dev, 0, 50, 50, 70, 70, 10); |
| 3130 |
|
| 3131 |
litest_touch_up(dev, 0); |
| 3132 |
|
| 3133 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 3134 |
} |
| 3135 |
END_TEST |
| 3136 |
|
| 3137 |
START_TEST(touchpad_hover_2fg_noevent) |
| 3138 |
{ |
| 3139 |
struct litest_device *dev = litest_current_device(); |
| 3140 |
struct libinput *li = dev->libinput; |
| 3141 |
|
| 3142 |
litest_drain_events(li); |
| 3143 |
|
| 3144 |
/* hover two fingers */ |
| 3145 |
litest_push_event_frame(dev); |
| 3146 |
litest_hover_start(dev, 0, 25, 25); |
| 3147 |
litest_hover_start(dev, 1, 50, 50); |
| 3148 |
litest_pop_event_frame(dev); |
| 3149 |
|
| 3150 |
litest_hover_move_two_touches(dev, 25, 25, 50, 50, 50, 50, 10); |
| 3151 |
|
| 3152 |
litest_push_event_frame(dev); |
| 3153 |
litest_hover_end(dev, 0); |
| 3154 |
litest_hover_end(dev, 1); |
| 3155 |
litest_pop_event_frame(dev); |
| 3156 |
|
| 3157 |
litest_assert_empty_queue(li); |
| 3158 |
} |
| 3159 |
END_TEST |
| 3160 |
|
| 3161 |
START_TEST(touchpad_hover_2fg_1fg_down) |
| 3162 |
{ |
| 3163 |
struct litest_device *dev = litest_current_device(); |
| 3164 |
struct libinput *li = dev->libinput; |
| 3165 |
int i; |
| 3166 |
|
| 3167 |
litest_drain_events(li); |
| 3168 |
|
| 3169 |
/* hover two fingers */ |
| 3170 |
litest_push_event_frame(dev); |
| 3171 |
litest_hover_start(dev, 0, 25, 25); |
| 3172 |
litest_touch_down(dev, 1, 50, 50); |
| 3173 |
litest_pop_event_frame(dev); |
| 3174 |
|
| 3175 |
for (i = 0; i < 10; i++) { |
| 3176 |
litest_push_event_frame(dev); |
| 3177 |
litest_hover_move(dev, 0, 25 + 5 * i, 25 + 5 * i); |
| 3178 |
litest_touch_move(dev, 1, 50 + 5 * i, 50 - 5 * i); |
| 3179 |
litest_pop_event_frame(dev); |
| 3180 |
} |
| 3181 |
|
| 3182 |
litest_push_event_frame(dev); |
| 3183 |
litest_hover_end(dev, 0); |
| 3184 |
litest_touch_up(dev, 1); |
| 3185 |
litest_pop_event_frame(dev); |
| 3186 |
|
| 3187 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 3188 |
} |
| 3189 |
END_TEST |
| 3190 |
|
| 3191 |
START_TEST(touchpad_hover_1fg_tap) |
| 3192 |
{ |
| 3193 |
struct litest_device *dev = litest_current_device(); |
| 3194 |
struct libinput *li = dev->libinput; |
| 3195 |
|
| 3196 |
litest_enable_tap(dev->libinput_device); |
| 3197 |
litest_disable_hold_gestures(dev->libinput_device); |
| 3198 |
litest_drain_events(li); |
| 3199 |
|
| 3200 |
litest_hover_start(dev, 0, 50, 50); |
| 3201 |
litest_hover_end(dev, 0); |
| 3202 |
|
| 3203 |
litest_dispatch(li); |
| 3204 |
litest_assert_empty_queue(li); |
| 3205 |
} |
| 3206 |
END_TEST |
| 3207 |
|
| 3208 |
static void |
| 3209 |
assert_btnevent_from_device(struct litest_device *device, |
| 3210 |
unsigned int button, |
| 3211 |
enum libinput_button_state state) |
| 3212 |
{ |
| 3213 |
struct libinput *li = device->libinput; |
| 3214 |
struct libinput_event *e; |
| 3215 |
|
| 3216 |
litest_dispatch(li); |
| 3217 |
e = libinput_get_event(li); |
| 3218 |
litest_is_button_event(e, button, state); |
| 3219 |
|
| 3220 |
litest_assert_ptr_eq(libinput_event_get_device(e), device->libinput_device); |
| 3221 |
libinput_event_destroy(e); |
| 3222 |
} |
| 3223 |
|
| 3224 |
START_TEST(touchpad_trackpoint_buttons) |
| 3225 |
{ |
| 3226 |
struct litest_device *touchpad = litest_current_device(); |
| 3227 |
struct litest_device *trackpoint; |
| 3228 |
struct libinput *li = touchpad->libinput; |
| 3229 |
|
| 3230 |
const struct buttons { |
| 3231 |
unsigned int device_value; |
| 3232 |
unsigned int real_value; |
| 3233 |
} buttons[] = { |
| 3234 |
{ BTN_0, BTN_LEFT }, |
| 3235 |
{ BTN_1, BTN_RIGHT }, |
| 3236 |
{ BTN_2, BTN_MIDDLE }, |
| 3237 |
}; |
| 3238 |
|
| 3239 |
trackpoint = litest_add_device(li, LITEST_TRACKPOINT); |
| 3240 |
libinput_device_config_scroll_set_method(trackpoint->libinput_device, |
| 3241 |
LIBINPUT_CONFIG_SCROLL_NO_SCROLL); |
| 3242 |
|
| 3243 |
litest_drain_events(li); |
| 3244 |
|
| 3245 |
ARRAY_FOR_EACH(buttons, b) { |
| 3246 |
litest_button_click_debounced(touchpad, li, b->device_value, true); |
| 3247 |
assert_btnevent_from_device(trackpoint, |
| 3248 |
b->real_value, |
| 3249 |
LIBINPUT_BUTTON_STATE_PRESSED); |
| 3250 |
|
| 3251 |
litest_button_click_debounced(touchpad, li, b->device_value, false); |
| 3252 |
|
| 3253 |
assert_btnevent_from_device(trackpoint, |
| 3254 |
b->real_value, |
| 3255 |
LIBINPUT_BUTTON_STATE_RELEASED); |
| 3256 |
} |
| 3257 |
|
| 3258 |
litest_device_destroy(trackpoint); |
| 3259 |
} |
| 3260 |
END_TEST |
| 3261 |
|
| 3262 |
START_TEST(touchpad_trackpoint_mb_scroll) |
| 3263 |
{ |
| 3264 |
struct litest_device *touchpad = litest_current_device(); |
| 3265 |
struct litest_device *trackpoint; |
| 3266 |
struct libinput *li = touchpad->libinput; |
| 3267 |
|
| 3268 |
trackpoint = litest_add_device(li, LITEST_TRACKPOINT); |
| 3269 |
|
| 3270 |
litest_drain_events(li); |
| 3271 |
litest_button_click(touchpad, BTN_2, true); /* middle */ |
| 3272 |
litest_timeout_buttonscroll(li); |
| 3273 |
litest_event(trackpoint, EV_REL, REL_Y, -2); |
| 3274 |
litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); |
| 3275 |
litest_event(trackpoint, EV_REL, REL_Y, -2); |
| 3276 |
litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); |
| 3277 |
litest_event(trackpoint, EV_REL, REL_Y, -2); |
| 3278 |
litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); |
| 3279 |
litest_event(trackpoint, EV_REL, REL_Y, -2); |
| 3280 |
litest_event(trackpoint, EV_SYN, SYN_REPORT, 0); |
| 3281 |
litest_button_click(touchpad, BTN_2, false); |
| 3282 |
|
| 3283 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_CONTINUOUS); |
| 3284 |
|
| 3285 |
litest_device_destroy(trackpoint); |
| 3286 |
} |
| 3287 |
END_TEST |
| 3288 |
|
| 3289 |
START_TEST(touchpad_trackpoint_mb_click) |
| 3290 |
{ |
| 3291 |
struct litest_device *touchpad = litest_current_device(); |
| 3292 |
struct litest_device *trackpoint; |
| 3293 |
struct libinput *li = touchpad->libinput; |
| 3294 |
enum libinput_config_status status; |
| 3295 |
|
| 3296 |
trackpoint = litest_add_device(li, LITEST_TRACKPOINT); |
| 3297 |
status = libinput_device_config_scroll_set_method( |
| 3298 |
trackpoint->libinput_device, |
| 3299 |
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN); |
| 3300 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 3301 |
|
| 3302 |
litest_drain_events(li); |
| 3303 |
litest_button_click_debounced(touchpad, li, BTN_2, true); /* middle */ |
| 3304 |
litest_button_click_debounced(touchpad, li, BTN_2, false); |
| 3305 |
|
| 3306 |
assert_btnevent_from_device(trackpoint, |
| 3307 |
BTN_MIDDLE, |
| 3308 |
LIBINPUT_BUTTON_STATE_PRESSED); |
| 3309 |
assert_btnevent_from_device(trackpoint, |
| 3310 |
BTN_MIDDLE, |
| 3311 |
LIBINPUT_BUTTON_STATE_RELEASED); |
| 3312 |
litest_device_destroy(trackpoint); |
| 3313 |
} |
| 3314 |
END_TEST |
| 3315 |
|
| 3316 |
START_TEST(touchpad_trackpoint_buttons_softbuttons) |
| 3317 |
{ |
| 3318 |
struct litest_device *touchpad = litest_current_device(); |
| 3319 |
struct litest_device *trackpoint; |
| 3320 |
struct libinput *li = touchpad->libinput; |
| 3321 |
|
| 3322 |
trackpoint = litest_add_device(li, LITEST_TRACKPOINT); |
| 3323 |
|
| 3324 |
litest_drain_events(li); |
| 3325 |
|
| 3326 |
litest_touch_down(touchpad, 0, 95, 90); |
| 3327 |
litest_button_click_debounced(touchpad, li, BTN_LEFT, true); |
| 3328 |
litest_button_click_debounced(touchpad, li, BTN_1, true); |
| 3329 |
litest_button_click_debounced(touchpad, li, BTN_LEFT, false); |
| 3330 |
litest_touch_up(touchpad, 0); |
| 3331 |
litest_button_click_debounced(touchpad, li, BTN_1, false); |
| 3332 |
|
| 3333 |
assert_btnevent_from_device(touchpad, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 3334 |
assert_btnevent_from_device(trackpoint, |
| 3335 |
BTN_RIGHT, |
| 3336 |
LIBINPUT_BUTTON_STATE_PRESSED); |
| 3337 |
assert_btnevent_from_device(touchpad, |
| 3338 |
BTN_RIGHT, |
| 3339 |
LIBINPUT_BUTTON_STATE_RELEASED); |
| 3340 |
assert_btnevent_from_device(trackpoint, |
| 3341 |
BTN_RIGHT, |
| 3342 |
LIBINPUT_BUTTON_STATE_RELEASED); |
| 3343 |
|
| 3344 |
litest_touch_down(touchpad, 0, 95, 90); |
| 3345 |
litest_button_click_debounced(touchpad, li, BTN_LEFT, true); |
| 3346 |
litest_button_click_debounced(touchpad, li, BTN_1, true); |
| 3347 |
litest_button_click_debounced(touchpad, li, BTN_1, false); |
| 3348 |
litest_button_click_debounced(touchpad, li, BTN_LEFT, false); |
| 3349 |
litest_touch_up(touchpad, 0); |
| 3350 |
|
| 3351 |
assert_btnevent_from_device(touchpad, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 3352 |
assert_btnevent_from_device(trackpoint, |
| 3353 |
BTN_RIGHT, |
| 3354 |
LIBINPUT_BUTTON_STATE_PRESSED); |
| 3355 |
assert_btnevent_from_device(trackpoint, |
| 3356 |
BTN_RIGHT, |
| 3357 |
LIBINPUT_BUTTON_STATE_RELEASED); |
| 3358 |
assert_btnevent_from_device(touchpad, |
| 3359 |
BTN_RIGHT, |
| 3360 |
LIBINPUT_BUTTON_STATE_RELEASED); |
| 3361 |
|
| 3362 |
litest_device_destroy(trackpoint); |
| 3363 |
} |
| 3364 |
END_TEST |
| 3365 |
|
| 3366 |
START_TEST(touchpad_trackpoint_buttons_2fg_scroll) |
| 3367 |
{ |
| 3368 |
struct litest_device *touchpad = litest_current_device(); |
| 3369 |
struct litest_device *trackpoint; |
| 3370 |
struct libinput *li = touchpad->libinput; |
| 3371 |
struct libinput_event *e; |
| 3372 |
double val; |
| 3373 |
|
| 3374 |
trackpoint = litest_add_device(li, LITEST_TRACKPOINT); |
| 3375 |
|
| 3376 |
litest_drain_events(li); |
| 3377 |
|
| 3378 |
litest_touch_down(touchpad, 0, 40, 70); |
| 3379 |
litest_touch_down(touchpad, 1, 60, 70); |
| 3380 |
litest_touch_move_two_touches(touchpad, 40, 70, 60, 70, 0, -40, 10); |
| 3381 |
|
| 3382 |
litest_dispatch(li); |
| 3383 |
litest_wait_for_event(li); |
| 3384 |
|
| 3385 |
/* Make sure we get scroll events but _not_ the scroll release */ |
| 3386 |
while ((e = libinput_get_event(li))) { |
| 3387 |
struct libinput_event_pointer *pev; |
| 3388 |
|
| 3389 |
pev = litest_is_axis_event(e, |
| 3390 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 3391 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, |
| 3392 |
0); |
| 3393 |
val = litest_event_pointer_get_value( |
| 3394 |
pev, |
| 3395 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); |
| 3396 |
litest_assert(val != 0.0); |
| 3397 |
libinput_event_destroy(e); |
| 3398 |
} |
| 3399 |
|
| 3400 |
litest_button_click_debounced(touchpad, li, BTN_1, true); |
| 3401 |
assert_btnevent_from_device(trackpoint, |
| 3402 |
BTN_RIGHT, |
| 3403 |
LIBINPUT_BUTTON_STATE_PRESSED); |
| 3404 |
|
| 3405 |
litest_touch_move_to(touchpad, 0, 40, 30, 40, 70, 10); |
| 3406 |
litest_touch_move_to(touchpad, 1, 60, 30, 60, 70, 10); |
| 3407 |
|
| 3408 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 3409 |
|
| 3410 |
while ((e = libinput_get_event(li))) { |
| 3411 |
struct libinput_event_pointer *pev; |
| 3412 |
|
| 3413 |
pev = litest_is_axis_event(e, |
| 3414 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 3415 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, |
| 3416 |
0); |
| 3417 |
val = litest_event_pointer_get_value( |
| 3418 |
pev, |
| 3419 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL); |
| 3420 |
litest_assert(val != 0.0); |
| 3421 |
libinput_event_destroy(e); |
| 3422 |
} |
| 3423 |
|
| 3424 |
litest_button_click_debounced(touchpad, li, BTN_1, false); |
| 3425 |
assert_btnevent_from_device(trackpoint, |
| 3426 |
BTN_RIGHT, |
| 3427 |
LIBINPUT_BUTTON_STATE_RELEASED); |
| 3428 |
|
| 3429 |
/* the movement lags behind the touch movement, so the first couple |
| 3430 |
events can be downwards even though we started scrolling up. do a |
| 3431 |
short scroll up, drain those events, then we can use |
| 3432 |
litest_assert_scroll() which tests for the trailing 0/0 scroll |
| 3433 |
for us. |
| 3434 |
*/ |
| 3435 |
litest_touch_move_to(touchpad, 0, 40, 70, 40, 60, 10); |
| 3436 |
litest_touch_move_to(touchpad, 1, 60, 70, 60, 60, 10); |
| 3437 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 3438 |
litest_touch_move_to(touchpad, 0, 40, 60, 40, 30, 10); |
| 3439 |
litest_touch_move_to(touchpad, 1, 60, 60, 60, 30, 10); |
| 3440 |
|
| 3441 |
litest_touch_up(touchpad, 0); |
| 3442 |
litest_touch_up(touchpad, 1); |
| 3443 |
|
| 3444 |
litest_dispatch(li); |
| 3445 |
|
| 3446 |
litest_assert_scroll(li, |
| 3447 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 3448 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, |
| 3449 |
-1); |
| 3450 |
|
| 3451 |
litest_device_destroy(trackpoint); |
| 3452 |
} |
| 3453 |
END_TEST |
| 3454 |
|
| 3455 |
START_TEST(touchpad_trackpoint_no_trackpoint) |
| 3456 |
{ |
| 3457 |
struct litest_device *touchpad = litest_current_device(); |
| 3458 |
struct libinput *li = touchpad->libinput; |
| 3459 |
|
| 3460 |
litest_drain_events(li); |
| 3461 |
litest_button_click(touchpad, BTN_0, true); /* left */ |
| 3462 |
litest_button_click(touchpad, BTN_0, false); |
| 3463 |
litest_assert_empty_queue(li); |
| 3464 |
|
| 3465 |
litest_button_click(touchpad, BTN_1, true); /* right */ |
| 3466 |
litest_button_click(touchpad, BTN_1, false); |
| 3467 |
litest_assert_empty_queue(li); |
| 3468 |
|
| 3469 |
litest_button_click(touchpad, BTN_2, true); /* middle */ |
| 3470 |
litest_button_click(touchpad, BTN_2, false); |
| 3471 |
litest_assert_empty_queue(li); |
| 3472 |
} |
| 3473 |
END_TEST |
| 3474 |
|
| 3475 |
START_TEST(touchpad_initial_state) |
| 3476 |
{ |
| 3477 |
struct litest_device *dev; |
| 3478 |
struct libinput *libinput1; |
| 3479 |
int x = 40, y = 60; |
| 3480 |
int axis = litest_test_param_get_i32(test_env->params, "axis"); |
| 3481 |
|
| 3482 |
dev = litest_current_device(); |
| 3483 |
libinput1 = dev->libinput; |
| 3484 |
|
| 3485 |
litest_disable_tap(dev->libinput_device); |
| 3486 |
litest_disable_hold_gestures(dev->libinput_device); |
| 3487 |
|
| 3488 |
litest_touch_down(dev, 0, x, y); |
| 3489 |
litest_touch_up(dev, 0); |
| 3490 |
|
| 3491 |
/* device is now on some x/y value */ |
| 3492 |
litest_drain_events(libinput1); |
| 3493 |
|
| 3494 |
_litest_context_destroy_ struct libinput *libinput2 = litest_create_context(); |
| 3495 |
libinput_path_add_device(libinput2, libevdev_uinput_get_devnode(dev->uinput)); |
| 3496 |
litest_drain_events(libinput2); |
| 3497 |
|
| 3498 |
if (axis == ABS_X) |
| 3499 |
x = 30; |
| 3500 |
else |
| 3501 |
y = 30; |
| 3502 |
|
| 3503 |
litest_touch_down(dev, 0, x, y); |
| 3504 |
litest_dispatch(libinput1); |
| 3505 |
litest_dispatch(libinput2); |
| 3506 |
litest_touch_move_to(dev, 0, x, y, 70, 70, 10); |
| 3507 |
litest_dispatch(libinput1); |
| 3508 |
litest_dispatch(libinput2); |
| 3509 |
litest_touch_up(dev, 0); |
| 3510 |
litest_dispatch(libinput1); |
| 3511 |
litest_dispatch(libinput2); |
| 3512 |
|
| 3513 |
litest_wait_for_event(libinput1); |
| 3514 |
litest_wait_for_event(libinput2); |
| 3515 |
|
| 3516 |
while (libinput_next_event_type(libinput1)) { |
| 3517 |
struct libinput_event *ev1, *ev2; |
| 3518 |
struct libinput_event_pointer *p1, *p2; |
| 3519 |
|
| 3520 |
ev1 = libinput_get_event(libinput1); |
| 3521 |
ev2 = libinput_get_event(libinput2); |
| 3522 |
|
| 3523 |
p1 = litest_is_motion_event(ev1); |
| 3524 |
p2 = litest_is_motion_event(ev2); |
| 3525 |
|
| 3526 |
litest_assert_int_eq(libinput_event_get_type(ev1), |
| 3527 |
libinput_event_get_type(ev2)); |
| 3528 |
|
| 3529 |
litest_assert_double_eq(libinput_event_pointer_get_dx(p1), |
| 3530 |
libinput_event_pointer_get_dx(p2)); |
| 3531 |
litest_assert_double_eq(libinput_event_pointer_get_dy(p1), |
| 3532 |
libinput_event_pointer_get_dy(p2)); |
| 3533 |
libinput_event_destroy(ev1); |
| 3534 |
libinput_event_destroy(ev2); |
| 3535 |
} |
| 3536 |
} |
| 3537 |
END_TEST |
| 3538 |
|
| 3539 |
START_TEST(touchpad_fingers_down_before_init) |
| 3540 |
{ |
| 3541 |
struct litest_device *dev = litest_current_device(); |
| 3542 |
|
| 3543 |
int finger_count = litest_test_param_get_i32(test_env->params, "fingers"); |
| 3544 |
unsigned int map[] = { 0, |
| 3545 |
BTN_TOOL_PEN, |
| 3546 |
BTN_TOOL_DOUBLETAP, |
| 3547 |
BTN_TOOL_TRIPLETAP, |
| 3548 |
BTN_TOOL_QUADTAP, |
| 3549 |
BTN_TOOL_QUINTTAP }; |
| 3550 |
|
| 3551 |
if (!libevdev_has_event_code(dev->evdev, EV_KEY, map[finger_count])) |
| 3552 |
return LITEST_NOT_APPLICABLE; |
| 3553 |
|
| 3554 |
/* Fingers down but before we have the real context */ |
| 3555 |
for (int i = 0; i < finger_count; i++) { |
| 3556 |
if (litest_slot_count(dev) >= finger_count) { |
| 3557 |
litest_touch_down(dev, i, 20 + 10 * i, 30); |
| 3558 |
} else { |
| 3559 |
litest_event(dev, EV_KEY, map[finger_count], 1); |
| 3560 |
} |
| 3561 |
} |
| 3562 |
|
| 3563 |
litest_drain_events(dev->libinput); |
| 3564 |
|
| 3565 |
/* create anew context that already has the fingers down */ |
| 3566 |
_litest_context_destroy_ struct libinput *li = litest_create_context(); |
| 3567 |
libinput_path_add_device(li, libevdev_uinput_get_devnode(dev->uinput)); |
| 3568 |
litest_drain_events(li); |
| 3569 |
|
| 3570 |
for (int x = 0; x < 10; x++) { |
| 3571 |
for (int i = 0; i < finger_count; i++) { |
| 3572 |
if (litest_slot_count(dev) < finger_count) |
| 3573 |
break; |
| 3574 |
litest_touch_move(dev, i, 20 + 10 * i + x, 30); |
| 3575 |
litest_dispatch(li); |
| 3576 |
} |
| 3577 |
litest_dispatch(li); |
| 3578 |
} |
| 3579 |
litest_dispatch(li); |
| 3580 |
litest_assert_empty_queue(li); |
| 3581 |
|
| 3582 |
for (int i = 0; i < finger_count; i++) { |
| 3583 |
if (litest_slot_count(dev) >= finger_count) { |
| 3584 |
litest_touch_up(dev, i); |
| 3585 |
} else { |
| 3586 |
litest_event(dev, EV_KEY, map[finger_count], 0); |
| 3587 |
} |
| 3588 |
litest_dispatch(li); |
| 3589 |
} |
| 3590 |
|
| 3591 |
litest_assert_empty_queue(li); |
| 3592 |
} |
| 3593 |
END_TEST |
| 3594 |
|
| 3595 |
/* This just tests that we don't completely screw up in one specific case. |
| 3596 |
* The test likely needs to be removed if it starts failing in the future. |
| 3597 |
* |
| 3598 |
* Where we get touch releases during SYN_DROPPED, libevdev < 1.9.0 gives us |
| 3599 |
* wrong event sequence during sync, see |
| 3600 |
* https://gitlab.freedesktop.org/libevdev/libevdev/merge_requests/19 |
| 3601 |
* |
| 3602 |
* libinput 1.15.1 ended up dropping our slot count to 0, making the |
| 3603 |
* touchpad unusable, see #422. This test just checks that we can still move |
| 3604 |
* the pointer and scroll where we trigger such a sequence. This tests for |
| 3605 |
* the worst-case scenario - where we previously reset to a slot count of 0. |
| 3606 |
* |
| 3607 |
* However, the exact behavior depends on how many slots were |
| 3608 |
* stopped/restarted during SYN_DROPPED, a single test is barely useful. |
| 3609 |
* libinput will still do the wrong thing if you start with e.g. 3fg on the |
| 3610 |
* touchpad and release one or two of them. But since this needs to be fixed |
| 3611 |
* in libevdev, here is the most important test. |
| 3612 |
*/ |
| 3613 |
START_TEST(touchpad_state_after_syn_dropped_2fg_change) |
| 3614 |
{ |
| 3615 |
struct litest_device *dev = litest_current_device(); |
| 3616 |
struct libinput *li = dev->libinput; |
| 3617 |
|
| 3618 |
litest_drain_events(li); |
| 3619 |
litest_disable_tap(dev->libinput_device); |
| 3620 |
litest_disable_hold_gestures(dev->libinput_device); |
| 3621 |
|
| 3622 |
litest_touch_down(dev, 0, 10, 10); |
| 3623 |
litest_dispatch(li); |
| 3624 |
|
| 3625 |
/* Force a SYN_DROPPED */ |
| 3626 |
for (int i = 0; i < 500; i++) |
| 3627 |
litest_touch_move(dev, 0, 10 + 0.1 * i, 10 + 0.1 * i); |
| 3628 |
|
| 3629 |
/* still within SYN_DROPPED */ |
| 3630 |
litest_touch_up(dev, 0); |
| 3631 |
litest_touch_down(dev, 0, 50, 50); |
| 3632 |
litest_touch_down(dev, 1, 70, 50); |
| 3633 |
|
| 3634 |
litest_dispatch(li); |
| 3635 |
litest_drain_events(li); |
| 3636 |
|
| 3637 |
litest_touch_up(dev, 0); |
| 3638 |
litest_touch_up(dev, 1); |
| 3639 |
|
| 3640 |
/* 2fg scrolling still works? */ |
| 3641 |
litest_touch_down(dev, 0, 50, 50); |
| 3642 |
litest_touch_down(dev, 1, 70, 50); |
| 3643 |
litest_touch_move_two_touches(dev, 50, 50, 70, 50, 0, -20, 10); |
| 3644 |
litest_touch_up(dev, 0); |
| 3645 |
litest_touch_up(dev, 1); |
| 3646 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 3647 |
|
| 3648 |
/* pointer motion still works? */ |
| 3649 |
litest_touch_down(dev, 0, 50, 50); |
| 3650 |
for (int i = 0; i < 10; i++) |
| 3651 |
litest_touch_move(dev, 0, 10 + 0.1 * i, 10 + 0.1 * i); |
| 3652 |
litest_touch_up(dev, 0); |
| 3653 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 3654 |
} |
| 3655 |
END_TEST |
| 3656 |
|
| 3657 |
START_TEST(touchpad_dwt_single_key) |
| 3658 |
{ |
| 3659 |
struct litest_device *touchpad = litest_current_device(); |
| 3660 |
struct litest_device *keyboard; |
| 3661 |
struct libinput *li = touchpad->libinput; |
| 3662 |
|
| 3663 |
if (!has_disable_while_typing(touchpad)) |
| 3664 |
return LITEST_NOT_APPLICABLE; |
| 3665 |
|
| 3666 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 3667 |
litest_disable_tap(touchpad->libinput_device); |
| 3668 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 3669 |
litest_drain_events(li); |
| 3670 |
|
| 3671 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 3672 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 3673 |
litest_dispatch(li); |
| 3674 |
litest_touch_down(touchpad, 0, 50, 50); |
| 3675 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 3676 |
litest_touch_up(touchpad, 0); |
| 3677 |
|
| 3678 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 3679 |
|
| 3680 |
litest_timeout_dwt_long(li); |
| 3681 |
|
| 3682 |
/* after timeout - motion events*/ |
| 3683 |
litest_touch_down(touchpad, 0, 50, 50); |
| 3684 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 3685 |
litest_touch_up(touchpad, 0); |
| 3686 |
|
| 3687 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 3688 |
|
| 3689 |
litest_device_destroy(keyboard); |
| 3690 |
} |
| 3691 |
END_TEST |
| 3692 |
|
| 3693 |
START_TEST(touchpad_dwt_ext_and_int_keyboard) |
| 3694 |
{ |
| 3695 |
struct litest_device *touchpad = litest_current_device(); |
| 3696 |
struct litest_device *keyboard, *yubikey; |
| 3697 |
struct libinput *li = touchpad->libinput; |
| 3698 |
|
| 3699 |
if (!has_disable_while_typing(touchpad)) |
| 3700 |
return LITEST_NOT_APPLICABLE; |
| 3701 |
|
| 3702 |
litest_disable_tap(touchpad->libinput_device); |
| 3703 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 3704 |
|
| 3705 |
/* Yubikey is initialized first */ |
| 3706 |
yubikey = litest_add_device(li, LITEST_YUBIKEY); |
| 3707 |
litest_drain_events(li); |
| 3708 |
|
| 3709 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 3710 |
litest_drain_events(li); |
| 3711 |
|
| 3712 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 3713 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 3714 |
litest_dispatch(li); |
| 3715 |
litest_touch_down(touchpad, 0, 50, 50); |
| 3716 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 3717 |
litest_touch_up(touchpad, 0); |
| 3718 |
|
| 3719 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 3720 |
|
| 3721 |
litest_timeout_dwt_short(li); |
| 3722 |
|
| 3723 |
/* after timeout - motion events*/ |
| 3724 |
litest_touch_down(touchpad, 0, 50, 50); |
| 3725 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 3726 |
litest_touch_up(touchpad, 0); |
| 3727 |
|
| 3728 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 3729 |
|
| 3730 |
litest_device_destroy(keyboard); |
| 3731 |
litest_device_destroy(yubikey); |
| 3732 |
} |
| 3733 |
END_TEST |
| 3734 |
|
| 3735 |
START_TEST(touchpad_dwt_enable_touch) |
| 3736 |
{ |
| 3737 |
struct litest_device *touchpad = litest_current_device(); |
| 3738 |
struct litest_device *keyboard; |
| 3739 |
struct libinput *li = touchpad->libinput; |
| 3740 |
|
| 3741 |
if (!has_disable_while_typing(touchpad)) |
| 3742 |
return LITEST_NOT_APPLICABLE; |
| 3743 |
|
| 3744 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 3745 |
litest_disable_tap(touchpad->libinput_device); |
| 3746 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 3747 |
litest_drain_events(li); |
| 3748 |
|
| 3749 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 3750 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 3751 |
litest_dispatch(li); |
| 3752 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 3753 |
|
| 3754 |
/* finger down after last key event, but |
| 3755 |
we're still within timeout - no events */ |
| 3756 |
msleep(10); |
| 3757 |
litest_touch_down(touchpad, 0, 50, 50); |
| 3758 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 3759 |
litest_assert_empty_queue(li); |
| 3760 |
|
| 3761 |
litest_timeout_dwt_short(li); |
| 3762 |
|
| 3763 |
/* same touch after timeout - motion events*/ |
| 3764 |
litest_touch_move_to(touchpad, 0, 70, 50, 50, 50, 10); |
| 3765 |
litest_touch_up(touchpad, 0); |
| 3766 |
|
| 3767 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 3768 |
|
| 3769 |
litest_device_destroy(keyboard); |
| 3770 |
} |
| 3771 |
END_TEST |
| 3772 |
|
| 3773 |
START_TEST(touchpad_dwt_touch_hold) |
| 3774 |
{ |
| 3775 |
struct litest_device *touchpad = litest_current_device(); |
| 3776 |
struct litest_device *keyboard; |
| 3777 |
struct libinput *li = touchpad->libinput; |
| 3778 |
|
| 3779 |
if (!has_disable_while_typing(touchpad)) |
| 3780 |
return LITEST_NOT_APPLICABLE; |
| 3781 |
|
| 3782 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 3783 |
litest_disable_tap(touchpad->libinput_device); |
| 3784 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 3785 |
litest_drain_events(li); |
| 3786 |
|
| 3787 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 3788 |
msleep(1); /* make sure touch starts after key press */ |
| 3789 |
litest_touch_down(touchpad, 0, 50, 50); |
| 3790 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); |
| 3791 |
|
| 3792 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 3793 |
|
| 3794 |
/* touch still down - no events */ |
| 3795 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 3796 |
litest_dispatch(li); |
| 3797 |
litest_touch_move_to(touchpad, 0, 70, 50, 30, 50, 5); |
| 3798 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 3799 |
|
| 3800 |
/* touch still down - no events */ |
| 3801 |
litest_timeout_dwt_short(li); |
| 3802 |
litest_touch_move_to(touchpad, 0, 30, 50, 50, 50, 5); |
| 3803 |
litest_touch_up(touchpad, 0); |
| 3804 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 3805 |
|
| 3806 |
litest_device_destroy(keyboard); |
| 3807 |
} |
| 3808 |
END_TEST |
| 3809 |
|
| 3810 |
START_TEST(touchpad_dwt_key_hold) |
| 3811 |
{ |
| 3812 |
struct litest_device *touchpad = litest_current_device(); |
| 3813 |
struct litest_device *keyboard; |
| 3814 |
struct libinput *li = touchpad->libinput; |
| 3815 |
|
| 3816 |
if (!has_disable_while_typing(touchpad)) |
| 3817 |
return LITEST_NOT_APPLICABLE; |
| 3818 |
|
| 3819 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 3820 |
litest_disable_tap(touchpad->libinput_device); |
| 3821 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 3822 |
litest_drain_events(li); |
| 3823 |
|
| 3824 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 3825 |
litest_dispatch(li); |
| 3826 |
litest_touch_down(touchpad, 0, 50, 50); |
| 3827 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); |
| 3828 |
litest_touch_up(touchpad, 0); |
| 3829 |
|
| 3830 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 3831 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 3832 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 3833 |
|
| 3834 |
litest_device_destroy(keyboard); |
| 3835 |
} |
| 3836 |
END_TEST |
| 3837 |
|
| 3838 |
START_TEST(touchpad_dwt_key_hold_timeout) |
| 3839 |
{ |
| 3840 |
struct litest_device *touchpad = litest_current_device(); |
| 3841 |
struct litest_device *keyboard; |
| 3842 |
struct libinput *li = touchpad->libinput; |
| 3843 |
|
| 3844 |
if (!has_disable_while_typing(touchpad)) |
| 3845 |
return LITEST_NOT_APPLICABLE; |
| 3846 |
|
| 3847 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 3848 |
litest_disable_tap(touchpad->libinput_device); |
| 3849 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 3850 |
litest_drain_events(li); |
| 3851 |
|
| 3852 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 3853 |
litest_dispatch(li); |
| 3854 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 3855 |
litest_timeout_dwt_long(li); |
| 3856 |
litest_touch_down(touchpad, 0, 50, 50); |
| 3857 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); |
| 3858 |
litest_touch_up(touchpad, 0); |
| 3859 |
|
| 3860 |
litest_assert_empty_queue(li); |
| 3861 |
|
| 3862 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 3863 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 3864 |
/* key is up, but still within timeout */ |
| 3865 |
litest_touch_down(touchpad, 0, 50, 50); |
| 3866 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); |
| 3867 |
litest_touch_up(touchpad, 0); |
| 3868 |
litest_assert_empty_queue(li); |
| 3869 |
|
| 3870 |
/* expire timeout */ |
| 3871 |
litest_timeout_dwt_long(li); |
| 3872 |
litest_touch_down(touchpad, 0, 50, 50); |
| 3873 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); |
| 3874 |
litest_touch_up(touchpad, 0); |
| 3875 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 3876 |
|
| 3877 |
litest_device_destroy(keyboard); |
| 3878 |
} |
| 3879 |
END_TEST |
| 3880 |
|
| 3881 |
START_TEST(touchpad_dwt_key_hold_timeout_existing_touch_cornercase) |
| 3882 |
{ |
| 3883 |
struct litest_device *touchpad = litest_current_device(); |
| 3884 |
struct litest_device *keyboard; |
| 3885 |
struct libinput *li = touchpad->libinput; |
| 3886 |
|
| 3887 |
if (!has_disable_while_typing(touchpad)) |
| 3888 |
return LITEST_NOT_APPLICABLE; |
| 3889 |
|
| 3890 |
/* Note: this tests for the current behavior of a cornercase, and |
| 3891 |
* the behaviour is essentially a bug. If this test fails it may be |
| 3892 |
* because the buggy behavior was fixed. |
| 3893 |
*/ |
| 3894 |
|
| 3895 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 3896 |
litest_disable_tap(touchpad->libinput_device); |
| 3897 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 3898 |
litest_drain_events(li); |
| 3899 |
|
| 3900 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 3901 |
litest_dispatch(li); |
| 3902 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 3903 |
litest_timeout_dwt_long(li); |
| 3904 |
|
| 3905 |
/* Touch starting after re-issuing the dwt timeout */ |
| 3906 |
litest_touch_down(touchpad, 0, 50, 50); |
| 3907 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); |
| 3908 |
|
| 3909 |
litest_assert_empty_queue(li); |
| 3910 |
|
| 3911 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 3912 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 3913 |
/* key is up, but still within timeout */ |
| 3914 |
litest_touch_move_to(touchpad, 0, 70, 50, 50, 50, 5); |
| 3915 |
litest_assert_empty_queue(li); |
| 3916 |
|
| 3917 |
/* Expire dwt timeout. Because the touch started after re-issuing |
| 3918 |
* the last timeout, it looks like the touch started after the last |
| 3919 |
* key press. Such touches are enabled for pointer motion by |
| 3920 |
* libinput when dwt expires. |
| 3921 |
* This is buggy behavior and not what a user would typically |
| 3922 |
* expect. But it's hard to trigger in real life too. |
| 3923 |
*/ |
| 3924 |
litest_timeout_dwt_long(li); |
| 3925 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); |
| 3926 |
litest_touch_up(touchpad, 0); |
| 3927 |
/* If the below check for motion event fails because no events are |
| 3928 |
* in the pipe, the buggy behavior was fixed and this test case |
| 3929 |
* can be removed */ |
| 3930 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 3931 |
|
| 3932 |
litest_device_destroy(keyboard); |
| 3933 |
} |
| 3934 |
END_TEST |
| 3935 |
|
| 3936 |
START_TEST(touchpad_dwt_key_hold_timeout_existing_touch) |
| 3937 |
{ |
| 3938 |
struct litest_device *touchpad = litest_current_device(); |
| 3939 |
struct litest_device *keyboard; |
| 3940 |
struct libinput *li = touchpad->libinput; |
| 3941 |
|
| 3942 |
if (!has_disable_while_typing(touchpad)) |
| 3943 |
return LITEST_NOT_APPLICABLE; |
| 3944 |
|
| 3945 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 3946 |
litest_disable_tap(touchpad->libinput_device); |
| 3947 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 3948 |
litest_drain_events(li); |
| 3949 |
|
| 3950 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 3951 |
litest_dispatch(li); |
| 3952 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 3953 |
litest_touch_down(touchpad, 0, 50, 50); |
| 3954 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); |
| 3955 |
litest_timeout_dwt_long(li); |
| 3956 |
|
| 3957 |
litest_assert_empty_queue(li); |
| 3958 |
|
| 3959 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 3960 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 3961 |
/* key is up, but still within timeout */ |
| 3962 |
litest_touch_move_to(touchpad, 0, 70, 50, 50, 50, 5); |
| 3963 |
litest_assert_empty_queue(li); |
| 3964 |
|
| 3965 |
/* expire timeout, but touch started before release */ |
| 3966 |
litest_timeout_dwt_long(li); |
| 3967 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); |
| 3968 |
litest_touch_up(touchpad, 0); |
| 3969 |
litest_assert_empty_queue(li); |
| 3970 |
|
| 3971 |
litest_device_destroy(keyboard); |
| 3972 |
} |
| 3973 |
END_TEST |
| 3974 |
|
| 3975 |
START_TEST(touchpad_dwt_type) |
| 3976 |
{ |
| 3977 |
struct litest_device *touchpad = litest_current_device(); |
| 3978 |
struct litest_device *keyboard; |
| 3979 |
struct libinput *li = touchpad->libinput; |
| 3980 |
int i; |
| 3981 |
uint32_t timeout = litest_test_param_get_u32(test_env->params, "timeout"); |
| 3982 |
|
| 3983 |
if (!has_disable_while_typing(touchpad)) |
| 3984 |
return LITEST_NOT_APPLICABLE; |
| 3985 |
|
| 3986 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 3987 |
litest_disable_tap(touchpad->libinput_device); |
| 3988 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 3989 |
litest_drain_events(li); |
| 3990 |
|
| 3991 |
if (timeout) { |
| 3992 |
auto status = libinput_device_config_dwt_set_timeout( |
| 3993 |
touchpad->libinput_device, |
| 3994 |
timeout); |
| 3995 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 3996 |
} |
| 3997 |
|
| 3998 |
for (i = 0; i < 5; i++) { |
| 3999 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4000 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4001 |
litest_dispatch(li); |
| 4002 |
} |
| 4003 |
|
| 4004 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4005 |
|
| 4006 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4007 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); |
| 4008 |
litest_touch_up(touchpad, 0); |
| 4009 |
litest_assert_empty_queue(li); |
| 4010 |
|
| 4011 |
if (timeout) { |
| 4012 |
litest_timeout(li, timeout); |
| 4013 |
} else { |
| 4014 |
litest_timeout_dwt_long(li); |
| 4015 |
} |
| 4016 |
|
| 4017 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4018 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); |
| 4019 |
litest_touch_up(touchpad, 0); |
| 4020 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 4021 |
|
| 4022 |
litest_device_destroy(keyboard); |
| 4023 |
} |
| 4024 |
END_TEST |
| 4025 |
|
| 4026 |
START_TEST(touchpad_dwt_type_short_timeout) |
| 4027 |
{ |
| 4028 |
struct litest_device *touchpad = litest_current_device(); |
| 4029 |
struct litest_device *keyboard; |
| 4030 |
struct libinput *li = touchpad->libinput; |
| 4031 |
int i; |
| 4032 |
|
| 4033 |
if (!has_disable_while_typing(touchpad)) |
| 4034 |
return LITEST_NOT_APPLICABLE; |
| 4035 |
|
| 4036 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 4037 |
litest_disable_tap(touchpad->libinput_device); |
| 4038 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 4039 |
litest_drain_events(li); |
| 4040 |
|
| 4041 |
for (i = 0; i < 5; i++) { |
| 4042 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4043 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4044 |
litest_dispatch(li); |
| 4045 |
} |
| 4046 |
|
| 4047 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4048 |
|
| 4049 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4050 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); |
| 4051 |
litest_touch_up(touchpad, 0); |
| 4052 |
litest_assert_empty_queue(li); |
| 4053 |
|
| 4054 |
litest_timeout_dwt_short(li); |
| 4055 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4056 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); |
| 4057 |
litest_touch_up(touchpad, 0); |
| 4058 |
litest_assert_empty_queue(li); |
| 4059 |
|
| 4060 |
litest_device_destroy(keyboard); |
| 4061 |
} |
| 4062 |
END_TEST |
| 4063 |
|
| 4064 |
START_TEST(touchpad_dwt_modifier_no_dwt) |
| 4065 |
{ |
| 4066 |
struct litest_device *touchpad = litest_current_device(); |
| 4067 |
struct litest_device *keyboard; |
| 4068 |
struct libinput *li = touchpad->libinput; |
| 4069 |
unsigned int modifiers[] = { |
| 4070 |
KEY_LEFTCTRL, KEY_RIGHTCTRL, KEY_LEFTALT, KEY_RIGHTALT, |
| 4071 |
KEY_LEFTSHIFT, KEY_RIGHTSHIFT, KEY_FN, KEY_CAPSLOCK, |
| 4072 |
KEY_TAB, KEY_COMPOSE, KEY_RIGHTMETA, KEY_LEFTMETA, |
| 4073 |
KEY_ESC, KEY_KPASTERISK, KEY_F1, |
| 4074 |
}; |
| 4075 |
|
| 4076 |
if (!has_disable_while_typing(touchpad)) |
| 4077 |
return LITEST_NOT_APPLICABLE; |
| 4078 |
|
| 4079 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 4080 |
litest_disable_tap(touchpad->libinput_device); |
| 4081 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 4082 |
litest_drain_events(li); |
| 4083 |
|
| 4084 |
ARRAY_FOR_EACH(modifiers, key) { |
| 4085 |
litest_keyboard_key(keyboard, *key, true); |
| 4086 |
litest_keyboard_key(keyboard, *key, false); |
| 4087 |
litest_dispatch(li); |
| 4088 |
|
| 4089 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4090 |
|
| 4091 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4092 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); |
| 4093 |
litest_touch_up(touchpad, 0); |
| 4094 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 4095 |
} |
| 4096 |
|
| 4097 |
litest_device_destroy(keyboard); |
| 4098 |
} |
| 4099 |
END_TEST |
| 4100 |
|
| 4101 |
START_TEST(touchpad_dwt_shift_combo_triggers_dwt) |
| 4102 |
{ |
| 4103 |
struct litest_device *touchpad = litest_current_device(); |
| 4104 |
struct litest_device *keyboard; |
| 4105 |
struct libinput *li = touchpad->libinput; |
| 4106 |
unsigned int modifiers[] = { |
| 4107 |
KEY_LEFTSHIFT, |
| 4108 |
KEY_RIGHTSHIFT, |
| 4109 |
}; |
| 4110 |
|
| 4111 |
if (!has_disable_while_typing(touchpad)) |
| 4112 |
return LITEST_NOT_APPLICABLE; |
| 4113 |
|
| 4114 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 4115 |
litest_disable_tap(touchpad->libinput_device); |
| 4116 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 4117 |
litest_drain_events(li); |
| 4118 |
|
| 4119 |
ARRAY_FOR_EACH(modifiers, key) { |
| 4120 |
litest_keyboard_key(keyboard, *key, true); |
| 4121 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4122 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4123 |
litest_keyboard_key(keyboard, *key, false); |
| 4124 |
litest_dispatch(li); |
| 4125 |
|
| 4126 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4127 |
|
| 4128 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4129 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); |
| 4130 |
litest_touch_up(touchpad, 0); |
| 4131 |
litest_assert_empty_queue(li); |
| 4132 |
} |
| 4133 |
|
| 4134 |
litest_timeout_dwt_long(li); |
| 4135 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4136 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); |
| 4137 |
litest_touch_up(touchpad, 0); |
| 4138 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 4139 |
|
| 4140 |
litest_device_destroy(keyboard); |
| 4141 |
} |
| 4142 |
END_TEST |
| 4143 |
|
| 4144 |
START_TEST(touchpad_dwt_modifier_combo_no_dwt) |
| 4145 |
{ |
| 4146 |
struct litest_device *touchpad = litest_current_device(); |
| 4147 |
struct litest_device *keyboard; |
| 4148 |
struct libinput *li = touchpad->libinput; |
| 4149 |
unsigned int modifiers[] = { |
| 4150 |
KEY_LEFTCTRL, KEY_RIGHTCTRL, KEY_LEFTALT, KEY_RIGHTALT, KEY_FN, |
| 4151 |
KEY_CAPSLOCK, KEY_TAB, KEY_COMPOSE, KEY_RIGHTMETA, KEY_LEFTMETA, |
| 4152 |
}; |
| 4153 |
|
| 4154 |
if (!has_disable_while_typing(touchpad)) |
| 4155 |
return LITEST_NOT_APPLICABLE; |
| 4156 |
|
| 4157 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 4158 |
litest_disable_tap(touchpad->libinput_device); |
| 4159 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 4160 |
litest_drain_events(li); |
| 4161 |
|
| 4162 |
ARRAY_FOR_EACH(modifiers, key) { |
| 4163 |
litest_keyboard_key(keyboard, *key, true); |
| 4164 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4165 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4166 |
litest_keyboard_key(keyboard, KEY_B, true); |
| 4167 |
litest_keyboard_key(keyboard, KEY_B, false); |
| 4168 |
litest_keyboard_key(keyboard, *key, false); |
| 4169 |
litest_dispatch(li); |
| 4170 |
|
| 4171 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4172 |
|
| 4173 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4174 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); |
| 4175 |
litest_touch_up(touchpad, 0); |
| 4176 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 4177 |
} |
| 4178 |
|
| 4179 |
litest_device_destroy(keyboard); |
| 4180 |
} |
| 4181 |
END_TEST |
| 4182 |
|
| 4183 |
START_TEST(touchpad_dwt_modifier_combo_dwt_after) |
| 4184 |
{ |
| 4185 |
struct litest_device *touchpad = litest_current_device(); |
| 4186 |
struct litest_device *keyboard; |
| 4187 |
struct libinput *li = touchpad->libinput; |
| 4188 |
unsigned int modifiers[] = { |
| 4189 |
KEY_LEFTCTRL, KEY_RIGHTCTRL, KEY_LEFTALT, KEY_RIGHTALT, KEY_FN, |
| 4190 |
KEY_CAPSLOCK, KEY_TAB, KEY_COMPOSE, KEY_RIGHTMETA, KEY_LEFTMETA, |
| 4191 |
}; |
| 4192 |
|
| 4193 |
if (!has_disable_while_typing(touchpad)) |
| 4194 |
return LITEST_NOT_APPLICABLE; |
| 4195 |
|
| 4196 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 4197 |
litest_disable_tap(touchpad->libinput_device); |
| 4198 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 4199 |
litest_drain_events(li); |
| 4200 |
|
| 4201 |
ARRAY_FOR_EACH(modifiers, key) { |
| 4202 |
litest_keyboard_key(keyboard, *key, true); |
| 4203 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4204 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4205 |
litest_keyboard_key(keyboard, *key, false); |
| 4206 |
litest_dispatch(li); |
| 4207 |
|
| 4208 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4209 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4210 |
litest_dispatch(li); |
| 4211 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4212 |
|
| 4213 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4214 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); |
| 4215 |
litest_touch_up(touchpad, 0); |
| 4216 |
litest_assert_empty_queue(li); |
| 4217 |
|
| 4218 |
litest_timeout_dwt_long(li); |
| 4219 |
} |
| 4220 |
|
| 4221 |
litest_device_destroy(keyboard); |
| 4222 |
} |
| 4223 |
END_TEST |
| 4224 |
|
| 4225 |
START_TEST(touchpad_dwt_modifier_combo_dwt_remains) |
| 4226 |
{ |
| 4227 |
struct litest_device *touchpad = litest_current_device(); |
| 4228 |
struct litest_device *keyboard; |
| 4229 |
struct libinput *li = touchpad->libinput; |
| 4230 |
unsigned int modifiers[] = { |
| 4231 |
KEY_LEFTCTRL, KEY_RIGHTCTRL, KEY_LEFTALT, KEY_RIGHTALT, KEY_FN, |
| 4232 |
KEY_CAPSLOCK, KEY_TAB, KEY_COMPOSE, KEY_RIGHTMETA, KEY_LEFTMETA, |
| 4233 |
}; |
| 4234 |
|
| 4235 |
if (!has_disable_while_typing(touchpad)) |
| 4236 |
return LITEST_NOT_APPLICABLE; |
| 4237 |
|
| 4238 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 4239 |
litest_disable_tap(touchpad->libinput_device); |
| 4240 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 4241 |
litest_drain_events(li); |
| 4242 |
|
| 4243 |
ARRAY_FOR_EACH(modifiers, key) { |
| 4244 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4245 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4246 |
litest_dispatch(li); |
| 4247 |
|
| 4248 |
/* this can't really be tested directly. The above key |
| 4249 |
* should enable dwt, the next key continues and extends the |
| 4250 |
* timeout as usual (despite the modifier combo). but |
| 4251 |
* testing for timeout differences is fickle, so all we can |
| 4252 |
* test though is that dwt is still on after the modifier |
| 4253 |
* combo and does not get disabled immediately. |
| 4254 |
*/ |
| 4255 |
litest_keyboard_key(keyboard, *key, true); |
| 4256 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4257 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4258 |
litest_keyboard_key(keyboard, *key, false); |
| 4259 |
litest_dispatch(li); |
| 4260 |
|
| 4261 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4262 |
|
| 4263 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4264 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); |
| 4265 |
litest_touch_up(touchpad, 0); |
| 4266 |
litest_assert_empty_queue(li); |
| 4267 |
|
| 4268 |
litest_timeout_dwt_long(li); |
| 4269 |
} |
| 4270 |
|
| 4271 |
litest_device_destroy(keyboard); |
| 4272 |
} |
| 4273 |
END_TEST |
| 4274 |
|
| 4275 |
START_TEST(touchpad_dwt_fkeys_no_dwt) |
| 4276 |
{ |
| 4277 |
struct litest_device *touchpad = litest_current_device(); |
| 4278 |
struct litest_device *keyboard; |
| 4279 |
struct libinput *li = touchpad->libinput; |
| 4280 |
unsigned int key; |
| 4281 |
|
| 4282 |
if (!has_disable_while_typing(touchpad)) |
| 4283 |
return LITEST_NOT_APPLICABLE; |
| 4284 |
|
| 4285 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 4286 |
litest_disable_tap(touchpad->libinput_device); |
| 4287 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 4288 |
litest_drain_events(li); |
| 4289 |
|
| 4290 |
for (key = KEY_F1; key < KEY_CNT; key++) { |
| 4291 |
if (!libinput_device_keyboard_has_key(keyboard->libinput_device, key)) |
| 4292 |
continue; |
| 4293 |
|
| 4294 |
litest_keyboard_key(keyboard, key, true); |
| 4295 |
litest_keyboard_key(keyboard, key, false); |
| 4296 |
litest_dispatch(li); |
| 4297 |
|
| 4298 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4299 |
|
| 4300 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4301 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); |
| 4302 |
litest_touch_up(touchpad, 0); |
| 4303 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 4304 |
} |
| 4305 |
|
| 4306 |
litest_device_destroy(keyboard); |
| 4307 |
} |
| 4308 |
END_TEST |
| 4309 |
|
| 4310 |
START_TEST(touchpad_dwt_tap) |
| 4311 |
{ |
| 4312 |
struct litest_device *touchpad = litest_current_device(); |
| 4313 |
struct litest_device *keyboard; |
| 4314 |
struct libinput *li = touchpad->libinput; |
| 4315 |
|
| 4316 |
if (!has_disable_while_typing(touchpad)) |
| 4317 |
return LITEST_NOT_APPLICABLE; |
| 4318 |
|
| 4319 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 4320 |
litest_enable_tap(touchpad->libinput_device); |
| 4321 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 4322 |
litest_drain_events(li); |
| 4323 |
|
| 4324 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4325 |
litest_dispatch(li); |
| 4326 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4327 |
litest_touch_up(touchpad, 0); |
| 4328 |
|
| 4329 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4330 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4331 |
|
| 4332 |
litest_timeout_dwt_short(li); |
| 4333 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4334 |
litest_touch_up(touchpad, 0); |
| 4335 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); |
| 4336 |
|
| 4337 |
litest_device_destroy(keyboard); |
| 4338 |
} |
| 4339 |
END_TEST |
| 4340 |
|
| 4341 |
START_TEST(touchpad_dwt_tap_drag) |
| 4342 |
{ |
| 4343 |
struct litest_device *touchpad = litest_current_device(); |
| 4344 |
struct litest_device *keyboard; |
| 4345 |
struct libinput *li = touchpad->libinput; |
| 4346 |
|
| 4347 |
if (!has_disable_while_typing(touchpad)) |
| 4348 |
return LITEST_NOT_APPLICABLE; |
| 4349 |
|
| 4350 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 4351 |
litest_enable_tap(touchpad->libinput_device); |
| 4352 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 4353 |
litest_drain_events(li); |
| 4354 |
|
| 4355 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4356 |
litest_dispatch(li); |
| 4357 |
msleep(1); /* make sure touch starts after key press */ |
| 4358 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4359 |
litest_touch_up(touchpad, 0); |
| 4360 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4361 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 5); |
| 4362 |
|
| 4363 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4364 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4365 |
|
| 4366 |
litest_timeout_dwt_short(li); |
| 4367 |
litest_touch_move_to(touchpad, 0, 70, 50, 50, 50, 5); |
| 4368 |
litest_touch_up(touchpad, 0); |
| 4369 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 4370 |
|
| 4371 |
litest_device_destroy(keyboard); |
| 4372 |
} |
| 4373 |
END_TEST |
| 4374 |
|
| 4375 |
START_TEST(touchpad_dwt_click) |
| 4376 |
{ |
| 4377 |
struct litest_device *touchpad = litest_current_device(); |
| 4378 |
struct litest_device *keyboard; |
| 4379 |
struct libinput *li = touchpad->libinput; |
| 4380 |
|
| 4381 |
if (!has_disable_while_typing(touchpad)) |
| 4382 |
return LITEST_NOT_APPLICABLE; |
| 4383 |
|
| 4384 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 4385 |
litest_disable_tap(touchpad->libinput_device); |
| 4386 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 4387 |
litest_drain_events(li); |
| 4388 |
|
| 4389 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4390 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4391 |
|
| 4392 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4393 |
litest_button_click(touchpad, BTN_LEFT, true); |
| 4394 |
litest_button_click(touchpad, BTN_LEFT, false); |
| 4395 |
litest_dispatch(li); |
| 4396 |
litest_touch_up(touchpad, 0); |
| 4397 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); |
| 4398 |
|
| 4399 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4400 |
|
| 4401 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4402 |
|
| 4403 |
litest_device_destroy(keyboard); |
| 4404 |
} |
| 4405 |
END_TEST |
| 4406 |
|
| 4407 |
START_TEST(touchpad_dwt_edge_scroll) |
| 4408 |
{ |
| 4409 |
struct litest_device *touchpad = litest_current_device(); |
| 4410 |
struct litest_device *keyboard; |
| 4411 |
struct libinput *li = touchpad->libinput; |
| 4412 |
|
| 4413 |
if (!has_disable_while_typing(touchpad)) |
| 4414 |
return LITEST_NOT_APPLICABLE; |
| 4415 |
|
| 4416 |
litest_enable_edge_scroll(touchpad); |
| 4417 |
|
| 4418 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 4419 |
litest_drain_events(li); |
| 4420 |
|
| 4421 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4422 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4423 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4424 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4425 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4426 |
|
| 4427 |
litest_touch_down(touchpad, 0, 99, 20); |
| 4428 |
litest_timeout_edgescroll(li); |
| 4429 |
litest_assert_empty_queue(li); |
| 4430 |
|
| 4431 |
/* edge scroll timeout is 300ms atm, make sure we don't accidentally |
| 4432 |
exit the DWT timeout */ |
| 4433 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4434 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4435 |
litest_dispatch(li); |
| 4436 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4437 |
|
| 4438 |
litest_touch_move_to(touchpad, 0, 99, 20, 99, 80, 60); |
| 4439 |
litest_dispatch(li); |
| 4440 |
litest_assert_empty_queue(li); |
| 4441 |
|
| 4442 |
litest_touch_move_to(touchpad, 0, 99, 80, 99, 20, 60); |
| 4443 |
litest_touch_up(touchpad, 0); |
| 4444 |
litest_dispatch(li); |
| 4445 |
litest_assert_empty_queue(li); |
| 4446 |
|
| 4447 |
litest_device_destroy(keyboard); |
| 4448 |
} |
| 4449 |
END_TEST |
| 4450 |
|
| 4451 |
START_TEST(touchpad_dwt_edge_scroll_interrupt) |
| 4452 |
{ |
| 4453 |
struct litest_device *touchpad = litest_current_device(); |
| 4454 |
struct litest_device *keyboard; |
| 4455 |
struct libinput *li = touchpad->libinput; |
| 4456 |
|
| 4457 |
if (!has_disable_while_typing(touchpad)) |
| 4458 |
return LITEST_NOT_APPLICABLE; |
| 4459 |
|
| 4460 |
litest_enable_edge_scroll(touchpad); |
| 4461 |
|
| 4462 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 4463 |
litest_drain_events(li); |
| 4464 |
|
| 4465 |
litest_touch_down(touchpad, 0, 99, 20); |
| 4466 |
litest_timeout_edgescroll(li); |
| 4467 |
litest_touch_move_to(touchpad, 0, 99, 20, 99, 30, 10); |
| 4468 |
litest_dispatch(li); |
| 4469 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 4470 |
|
| 4471 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4472 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4473 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4474 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4475 |
|
| 4476 |
/* scroll stop events (low and high resolution) */ |
| 4477 |
litest_wait_for_event(li); |
| 4478 |
litest_assert_axis_end_sequence(li, |
| 4479 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 4480 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, |
| 4481 |
LIBINPUT_POINTER_AXIS_SOURCE_FINGER); |
| 4482 |
|
| 4483 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4484 |
|
| 4485 |
litest_timeout_dwt_long(li); |
| 4486 |
|
| 4487 |
/* Known bad behavior: a touch starting to edge-scroll before dwt |
| 4488 |
* kicks in will stop to scroll but be recognized as normal |
| 4489 |
* pointer-moving touch once the timeout expires. We'll fix that |
| 4490 |
* when we need to. |
| 4491 |
*/ |
| 4492 |
litest_touch_move_to(touchpad, 0, 99, 30, 99, 80, 10); |
| 4493 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 4494 |
|
| 4495 |
litest_device_destroy(keyboard); |
| 4496 |
} |
| 4497 |
END_TEST |
| 4498 |
|
| 4499 |
START_TEST(touchpad_dwt_config_default_timeout) |
| 4500 |
{ |
| 4501 |
struct litest_device *dev = litest_current_device(); |
| 4502 |
struct libinput_device *device = dev->libinput_device; |
| 4503 |
|
| 4504 |
if (!libinput_device_config_dwt_is_available(device)) |
| 4505 |
return LITEST_NOT_APPLICABLE; |
| 4506 |
|
| 4507 |
litest_assert_int_eq(libinput_device_config_dwt_get_default_timeout(device), |
| 4508 |
500U); |
| 4509 |
} |
| 4510 |
END_TEST |
| 4511 |
|
| 4512 |
START_TEST(touchpad_dwt_config_default_on) |
| 4513 |
{ |
| 4514 |
struct litest_device *dev = litest_current_device(); |
| 4515 |
struct libinput_device *device = dev->libinput_device; |
| 4516 |
enum libinput_config_status status; |
| 4517 |
enum libinput_config_dwt_state state; |
| 4518 |
|
| 4519 |
if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_WACOM || |
| 4520 |
libevdev_get_id_bustype(dev->evdev) == BUS_BLUETOOTH) { |
| 4521 |
litest_assert(!libinput_device_config_dwt_is_available(device)); |
| 4522 |
return LITEST_NOT_APPLICABLE; |
| 4523 |
} |
| 4524 |
|
| 4525 |
litest_assert(libinput_device_config_dwt_is_available(device)); |
| 4526 |
state = libinput_device_config_dwt_get_enabled(device); |
| 4527 |
litest_assert_enum_eq(state, LIBINPUT_CONFIG_DWT_ENABLED); |
| 4528 |
state = libinput_device_config_dwt_get_default_enabled(device); |
| 4529 |
litest_assert_enum_eq(state, LIBINPUT_CONFIG_DWT_ENABLED); |
| 4530 |
|
| 4531 |
uint32_t timeout = libinput_device_config_dwt_get_timeout(device); |
| 4532 |
litest_assert_int_eq(timeout, 500U); |
| 4533 |
|
| 4534 |
status = libinput_device_config_dwt_set_enabled(device, |
| 4535 |
LIBINPUT_CONFIG_DWT_ENABLED); |
| 4536 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 4537 |
status = libinput_device_config_dwt_set_enabled(device, |
| 4538 |
LIBINPUT_CONFIG_DWT_DISABLED); |
| 4539 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 4540 |
|
| 4541 |
status = libinput_device_config_dwt_set_enabled(device, 3); |
| 4542 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); |
| 4543 |
|
| 4544 |
/* Configurable even if disabled */ |
| 4545 |
status = libinput_device_config_dwt_set_timeout(device, 600); |
| 4546 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 4547 |
timeout = libinput_device_config_dwt_get_timeout(device); |
| 4548 |
litest_assert_int_eq(timeout, 600U); |
| 4549 |
|
| 4550 |
/* Too short, too long */ |
| 4551 |
status = libinput_device_config_dwt_set_timeout(device, 99); |
| 4552 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); |
| 4553 |
timeout = libinput_device_config_dwt_get_timeout(device); |
| 4554 |
litest_assert_int_eq(timeout, 600U); |
| 4555 |
status = libinput_device_config_dwt_set_timeout(device, 5001); |
| 4556 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); |
| 4557 |
timeout = libinput_device_config_dwt_get_timeout(device); |
| 4558 |
litest_assert_int_eq(timeout, 600U); |
| 4559 |
} |
| 4560 |
END_TEST |
| 4561 |
|
| 4562 |
START_TEST(touchpad_dwtp_config_default_timeout) |
| 4563 |
{ |
| 4564 |
struct litest_device *dev = litest_current_device(); |
| 4565 |
struct libinput_device *device = dev->libinput_device; |
| 4566 |
|
| 4567 |
if (!libinput_device_config_dwtp_is_available(device)) |
| 4568 |
return LITEST_NOT_APPLICABLE; |
| 4569 |
|
| 4570 |
litest_assert_int_eq(libinput_device_config_dwtp_get_default_timeout(device), |
| 4571 |
300U); |
| 4572 |
} |
| 4573 |
END_TEST |
| 4574 |
|
| 4575 |
START_TEST(touchpad_dwtp_config_default_on) |
| 4576 |
{ |
| 4577 |
struct litest_device *dev = litest_current_device(); |
| 4578 |
struct libinput_device *device = dev->libinput_device; |
| 4579 |
enum libinput_config_status status; |
| 4580 |
enum libinput_config_dwtp_state state; |
| 4581 |
|
| 4582 |
if (litest_touchpad_is_external(dev)) { |
| 4583 |
litest_assert(!libinput_device_config_dwtp_is_available(device)); |
| 4584 |
return LITEST_NOT_APPLICABLE; |
| 4585 |
} |
| 4586 |
|
| 4587 |
litest_assert(libinput_device_config_dwtp_is_available(device)); |
| 4588 |
state = libinput_device_config_dwtp_get_enabled(device); |
| 4589 |
litest_assert_enum_eq(state, LIBINPUT_CONFIG_DWTP_ENABLED); |
| 4590 |
state = libinput_device_config_dwtp_get_default_enabled(device); |
| 4591 |
litest_assert_enum_eq(state, LIBINPUT_CONFIG_DWTP_ENABLED); |
| 4592 |
|
| 4593 |
status = libinput_device_config_dwtp_set_enabled(device, |
| 4594 |
LIBINPUT_CONFIG_DWTP_ENABLED); |
| 4595 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 4596 |
status = libinput_device_config_dwtp_set_enabled(device, |
| 4597 |
LIBINPUT_CONFIG_DWTP_DISABLED); |
| 4598 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 4599 |
|
| 4600 |
status = libinput_device_config_dwtp_set_enabled(device, 3); |
| 4601 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); |
| 4602 |
} |
| 4603 |
END_TEST |
| 4604 |
|
| 4605 |
START_TEST(touchpad_dwt_config_default_off) |
| 4606 |
{ |
| 4607 |
struct litest_device *dev = litest_current_device(); |
| 4608 |
struct libinput_device *device = dev->libinput_device; |
| 4609 |
enum libinput_config_status status; |
| 4610 |
enum libinput_config_dwt_state state; |
| 4611 |
|
| 4612 |
litest_assert(!libinput_device_config_dwt_is_available(device)); |
| 4613 |
state = libinput_device_config_dwt_get_enabled(device); |
| 4614 |
litest_assert_enum_eq(state, LIBINPUT_CONFIG_DWT_DISABLED); |
| 4615 |
state = libinput_device_config_dwt_get_default_enabled(device); |
| 4616 |
litest_assert_enum_eq(state, LIBINPUT_CONFIG_DWT_DISABLED); |
| 4617 |
|
| 4618 |
status = libinput_device_config_dwt_set_enabled(device, |
| 4619 |
LIBINPUT_CONFIG_DWT_ENABLED); |
| 4620 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); |
| 4621 |
status = libinput_device_config_dwt_set_enabled(device, |
| 4622 |
LIBINPUT_CONFIG_DWT_DISABLED); |
| 4623 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 4624 |
|
| 4625 |
status = libinput_device_config_dwt_set_enabled(device, 3); |
| 4626 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); |
| 4627 |
} |
| 4628 |
END_TEST |
| 4629 |
|
| 4630 |
START_TEST(touchpad_dwtp_config_default_off) |
| 4631 |
{ |
| 4632 |
struct litest_device *dev = litest_current_device(); |
| 4633 |
struct libinput_device *device = dev->libinput_device; |
| 4634 |
enum libinput_config_status status; |
| 4635 |
enum libinput_config_dwtp_state state; |
| 4636 |
|
| 4637 |
litest_assert(!libinput_device_config_dwtp_is_available(device)); |
| 4638 |
state = libinput_device_config_dwtp_get_enabled(device); |
| 4639 |
litest_assert_enum_eq(state, LIBINPUT_CONFIG_DWTP_DISABLED); |
| 4640 |
state = libinput_device_config_dwtp_get_default_enabled(device); |
| 4641 |
litest_assert_enum_eq(state, LIBINPUT_CONFIG_DWTP_DISABLED); |
| 4642 |
|
| 4643 |
status = libinput_device_config_dwtp_set_enabled(device, |
| 4644 |
LIBINPUT_CONFIG_DWTP_ENABLED); |
| 4645 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_UNSUPPORTED); |
| 4646 |
status = libinput_device_config_dwtp_set_enabled(device, |
| 4647 |
LIBINPUT_CONFIG_DWTP_DISABLED); |
| 4648 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 4649 |
|
| 4650 |
status = libinput_device_config_dwtp_set_enabled(device, 3); |
| 4651 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_INVALID); |
| 4652 |
} |
| 4653 |
END_TEST |
| 4654 |
|
| 4655 |
static inline void |
| 4656 |
disable_dwt(struct litest_device *dev) |
| 4657 |
{ |
| 4658 |
enum libinput_config_status status, expected = LIBINPUT_CONFIG_STATUS_SUCCESS; |
| 4659 |
status = libinput_device_config_dwt_set_enabled(dev->libinput_device, |
| 4660 |
LIBINPUT_CONFIG_DWT_DISABLED); |
| 4661 |
litest_assert_int_eq(status, expected); |
| 4662 |
} |
| 4663 |
|
| 4664 |
static inline void |
| 4665 |
enable_dwt(struct litest_device *dev) |
| 4666 |
{ |
| 4667 |
enum libinput_config_status status, expected = LIBINPUT_CONFIG_STATUS_SUCCESS; |
| 4668 |
status = libinput_device_config_dwt_set_enabled(dev->libinput_device, |
| 4669 |
LIBINPUT_CONFIG_DWT_ENABLED); |
| 4670 |
litest_assert_int_eq(status, expected); |
| 4671 |
} |
| 4672 |
|
| 4673 |
START_TEST(touchpad_dwt_disabled) |
| 4674 |
{ |
| 4675 |
struct litest_device *touchpad = litest_current_device(); |
| 4676 |
struct litest_device *keyboard; |
| 4677 |
struct libinput *li = touchpad->libinput; |
| 4678 |
|
| 4679 |
if (!has_disable_while_typing(touchpad)) |
| 4680 |
return LITEST_NOT_APPLICABLE; |
| 4681 |
|
| 4682 |
disable_dwt(touchpad); |
| 4683 |
|
| 4684 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 4685 |
litest_disable_tap(touchpad->libinput_device); |
| 4686 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 4687 |
litest_drain_events(li); |
| 4688 |
|
| 4689 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4690 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4691 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4692 |
|
| 4693 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4694 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 4695 |
litest_touch_up(touchpad, 0); |
| 4696 |
|
| 4697 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 4698 |
|
| 4699 |
litest_device_destroy(keyboard); |
| 4700 |
} |
| 4701 |
END_TEST |
| 4702 |
|
| 4703 |
START_TEST(touchpad_dwt_disable_during_touch) |
| 4704 |
{ |
| 4705 |
struct litest_device *touchpad = litest_current_device(); |
| 4706 |
struct litest_device *keyboard; |
| 4707 |
struct libinput *li = touchpad->libinput; |
| 4708 |
|
| 4709 |
if (!has_disable_while_typing(touchpad)) |
| 4710 |
return LITEST_NOT_APPLICABLE; |
| 4711 |
|
| 4712 |
enable_dwt(touchpad); |
| 4713 |
|
| 4714 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 4715 |
litest_disable_tap(touchpad->libinput_device); |
| 4716 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 4717 |
litest_drain_events(li); |
| 4718 |
|
| 4719 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4720 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4721 |
|
| 4722 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4723 |
|
| 4724 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4725 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4726 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4727 |
|
| 4728 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 4729 |
litest_assert_empty_queue(li); |
| 4730 |
|
| 4731 |
litest_timeout_dwt_long(li); |
| 4732 |
|
| 4733 |
disable_dwt(touchpad); |
| 4734 |
|
| 4735 |
/* touch already down -> keeps being ignored */ |
| 4736 |
litest_touch_move_to(touchpad, 0, 70, 50, 50, 70, 10); |
| 4737 |
litest_touch_up(touchpad, 0); |
| 4738 |
|
| 4739 |
litest_assert_empty_queue(li); |
| 4740 |
|
| 4741 |
litest_device_destroy(keyboard); |
| 4742 |
} |
| 4743 |
END_TEST |
| 4744 |
|
| 4745 |
START_TEST(touchpad_dwt_disable_before_touch) |
| 4746 |
{ |
| 4747 |
struct litest_device *touchpad = litest_current_device(); |
| 4748 |
struct litest_device *keyboard; |
| 4749 |
struct libinput *li = touchpad->libinput; |
| 4750 |
|
| 4751 |
if (!has_disable_while_typing(touchpad)) |
| 4752 |
return LITEST_NOT_APPLICABLE; |
| 4753 |
|
| 4754 |
enable_dwt(touchpad); |
| 4755 |
|
| 4756 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 4757 |
litest_disable_tap(touchpad->libinput_device); |
| 4758 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 4759 |
litest_drain_events(li); |
| 4760 |
|
| 4761 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4762 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4763 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4764 |
|
| 4765 |
disable_dwt(touchpad); |
| 4766 |
litest_dispatch(li); |
| 4767 |
|
| 4768 |
/* touch down during timeout -> still discarded */ |
| 4769 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4770 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 4771 |
litest_assert_empty_queue(li); |
| 4772 |
|
| 4773 |
litest_device_destroy(keyboard); |
| 4774 |
} |
| 4775 |
END_TEST |
| 4776 |
|
| 4777 |
START_TEST(touchpad_dwt_disable_during_key_release) |
| 4778 |
{ |
| 4779 |
struct litest_device *touchpad = litest_current_device(); |
| 4780 |
struct litest_device *keyboard; |
| 4781 |
struct libinput *li = touchpad->libinput; |
| 4782 |
|
| 4783 |
if (!has_disable_while_typing(touchpad)) |
| 4784 |
return LITEST_NOT_APPLICABLE; |
| 4785 |
|
| 4786 |
enable_dwt(touchpad); |
| 4787 |
|
| 4788 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 4789 |
litest_disable_tap(touchpad->libinput_device); |
| 4790 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 4791 |
litest_drain_events(li); |
| 4792 |
|
| 4793 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4794 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4795 |
|
| 4796 |
disable_dwt(touchpad); |
| 4797 |
litest_dispatch(li); |
| 4798 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4799 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4800 |
|
| 4801 |
/* touch down during timeout, wait, should generate events */ |
| 4802 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4803 |
litest_timeout_dwt_long(li); |
| 4804 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 4805 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 4806 |
|
| 4807 |
litest_device_destroy(keyboard); |
| 4808 |
} |
| 4809 |
END_TEST |
| 4810 |
|
| 4811 |
START_TEST(touchpad_dwt_disable_during_key_hold) |
| 4812 |
{ |
| 4813 |
struct litest_device *touchpad = litest_current_device(); |
| 4814 |
struct litest_device *keyboard; |
| 4815 |
struct libinput *li = touchpad->libinput; |
| 4816 |
|
| 4817 |
if (!has_disable_while_typing(touchpad)) |
| 4818 |
return LITEST_NOT_APPLICABLE; |
| 4819 |
|
| 4820 |
enable_dwt(touchpad); |
| 4821 |
|
| 4822 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 4823 |
litest_disable_tap(touchpad->libinput_device); |
| 4824 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 4825 |
litest_drain_events(li); |
| 4826 |
|
| 4827 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4828 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4829 |
|
| 4830 |
disable_dwt(touchpad); |
| 4831 |
litest_dispatch(li); |
| 4832 |
|
| 4833 |
/* touch down during timeout, wait, should generate events */ |
| 4834 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4835 |
litest_timeout_dwt_long(li); |
| 4836 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 4837 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 4838 |
|
| 4839 |
litest_device_destroy(keyboard); |
| 4840 |
} |
| 4841 |
END_TEST |
| 4842 |
|
| 4843 |
START_TEST(touchpad_dwt_enable_during_touch) |
| 4844 |
{ |
| 4845 |
struct litest_device *touchpad = litest_current_device(); |
| 4846 |
struct litest_device *keyboard; |
| 4847 |
struct libinput *li = touchpad->libinput; |
| 4848 |
|
| 4849 |
if (!has_disable_while_typing(touchpad)) |
| 4850 |
return LITEST_NOT_APPLICABLE; |
| 4851 |
|
| 4852 |
disable_dwt(touchpad); |
| 4853 |
|
| 4854 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 4855 |
litest_disable_tap(touchpad->libinput_device); |
| 4856 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 4857 |
litest_drain_events(li); |
| 4858 |
|
| 4859 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4860 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4861 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4862 |
|
| 4863 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4864 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 4865 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 4866 |
|
| 4867 |
enable_dwt(touchpad); |
| 4868 |
|
| 4869 |
/* touch already down -> still sends events */ |
| 4870 |
litest_touch_move_to(touchpad, 0, 70, 50, 50, 70, 10); |
| 4871 |
litest_touch_up(touchpad, 0); |
| 4872 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 4873 |
|
| 4874 |
litest_device_destroy(keyboard); |
| 4875 |
} |
| 4876 |
END_TEST |
| 4877 |
|
| 4878 |
START_TEST(touchpad_dwt_enable_before_touch) |
| 4879 |
{ |
| 4880 |
struct litest_device *touchpad = litest_current_device(); |
| 4881 |
struct litest_device *keyboard; |
| 4882 |
struct libinput *li = touchpad->libinput; |
| 4883 |
|
| 4884 |
if (!has_disable_while_typing(touchpad)) |
| 4885 |
return LITEST_NOT_APPLICABLE; |
| 4886 |
|
| 4887 |
disable_dwt(touchpad); |
| 4888 |
|
| 4889 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 4890 |
litest_disable_tap(touchpad->libinput_device); |
| 4891 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 4892 |
litest_drain_events(li); |
| 4893 |
|
| 4894 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4895 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4896 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4897 |
|
| 4898 |
enable_dwt(touchpad); |
| 4899 |
litest_dispatch(li); |
| 4900 |
|
| 4901 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4902 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 4903 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 4904 |
|
| 4905 |
litest_device_destroy(keyboard); |
| 4906 |
} |
| 4907 |
END_TEST |
| 4908 |
|
| 4909 |
START_TEST(touchpad_dwt_enable_during_tap) |
| 4910 |
{ |
| 4911 |
struct litest_device *touchpad = litest_current_device(); |
| 4912 |
struct litest_device *keyboard; |
| 4913 |
struct libinput *li = touchpad->libinput; |
| 4914 |
|
| 4915 |
if (!has_disable_while_typing(touchpad)) |
| 4916 |
return LITEST_NOT_APPLICABLE; |
| 4917 |
|
| 4918 |
litest_enable_tap(touchpad->libinput_device); |
| 4919 |
disable_dwt(touchpad); |
| 4920 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 4921 |
|
| 4922 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 4923 |
litest_drain_events(li); |
| 4924 |
|
| 4925 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4926 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4927 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 4928 |
|
| 4929 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4930 |
litest_dispatch(li); |
| 4931 |
enable_dwt(touchpad); |
| 4932 |
litest_dispatch(li); |
| 4933 |
litest_touch_up(touchpad, 0); |
| 4934 |
litest_timeout_tap(li); |
| 4935 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_BUTTON); |
| 4936 |
|
| 4937 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4938 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 4939 |
litest_touch_up(touchpad, 0); |
| 4940 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 4941 |
|
| 4942 |
litest_device_destroy(keyboard); |
| 4943 |
} |
| 4944 |
END_TEST |
| 4945 |
|
| 4946 |
START_TEST(touchpad_dwt_remove_kbd_while_active) |
| 4947 |
{ |
| 4948 |
struct litest_device *touchpad = litest_current_device(); |
| 4949 |
struct litest_device *keyboard; |
| 4950 |
struct libinput *li = touchpad->libinput; |
| 4951 |
|
| 4952 |
if (!has_disable_while_typing(touchpad)) |
| 4953 |
return LITEST_NOT_APPLICABLE; |
| 4954 |
|
| 4955 |
litest_enable_tap(touchpad->libinput_device); |
| 4956 |
enable_dwt(touchpad); |
| 4957 |
litest_disable_hold_gestures(touchpad->libinput_device); |
| 4958 |
|
| 4959 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 4960 |
litest_drain_events(li); |
| 4961 |
|
| 4962 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4963 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4964 |
litest_dispatch(li); |
| 4965 |
|
| 4966 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4967 |
litest_dispatch(li); |
| 4968 |
|
| 4969 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 4970 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 4971 |
litest_drain_events(li); |
| 4972 |
|
| 4973 |
litest_device_destroy(keyboard); |
| 4974 |
litest_drain_events(li); |
| 4975 |
|
| 4976 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 4977 |
litest_touch_up(touchpad, 0); |
| 4978 |
litest_assert_empty_queue(li); |
| 4979 |
|
| 4980 |
litest_touch_down(touchpad, 0, 50, 50); |
| 4981 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 4982 |
litest_touch_up(touchpad, 0); |
| 4983 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 4984 |
} |
| 4985 |
END_TEST |
| 4986 |
|
| 4987 |
START_TEST(touchpad_dwt_apple) |
| 4988 |
{ |
| 4989 |
struct litest_device *touchpad = litest_current_device(); |
| 4990 |
struct litest_device *apple_keyboard; |
| 4991 |
struct libinput *li = touchpad->libinput; |
| 4992 |
|
| 4993 |
litest_assert(has_disable_while_typing(touchpad)); |
| 4994 |
|
| 4995 |
apple_keyboard = litest_add_device(li, LITEST_APPLE_KEYBOARD); |
| 4996 |
litest_drain_events(li); |
| 4997 |
|
| 4998 |
litest_keyboard_key(apple_keyboard, KEY_A, true); |
| 4999 |
litest_keyboard_key(apple_keyboard, KEY_A, false); |
| 5000 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 5001 |
|
| 5002 |
litest_touch_down(touchpad, 0, 50, 50); |
| 5003 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 5004 |
litest_touch_up(touchpad, 0); |
| 5005 |
litest_dispatch(li); |
| 5006 |
litest_assert_empty_queue(li); |
| 5007 |
|
| 5008 |
litest_device_destroy(apple_keyboard); |
| 5009 |
} |
| 5010 |
END_TEST |
| 5011 |
|
| 5012 |
START_TEST(touchpad_dwt_acer_hawaii) |
| 5013 |
{ |
| 5014 |
struct litest_device *touchpad = litest_current_device(); |
| 5015 |
struct litest_device *hawaii_keyboard; |
| 5016 |
struct libinput *li = touchpad->libinput; |
| 5017 |
|
| 5018 |
litest_assert(has_disable_while_typing(touchpad)); |
| 5019 |
|
| 5020 |
hawaii_keyboard = litest_add_device(li, LITEST_ACER_HAWAII_KEYBOARD); |
| 5021 |
litest_drain_events(li); |
| 5022 |
|
| 5023 |
litest_keyboard_key(hawaii_keyboard, KEY_A, true); |
| 5024 |
litest_keyboard_key(hawaii_keyboard, KEY_A, false); |
| 5025 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 5026 |
|
| 5027 |
litest_touch_down(touchpad, 0, 50, 50); |
| 5028 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 5029 |
litest_touch_up(touchpad, 0); |
| 5030 |
litest_dispatch(li); |
| 5031 |
litest_assert_empty_queue(li); |
| 5032 |
|
| 5033 |
litest_device_destroy(hawaii_keyboard); |
| 5034 |
} |
| 5035 |
END_TEST |
| 5036 |
|
| 5037 |
START_TEST(touchpad_dwt_generic_usbcombo) |
| 5038 |
{ |
| 5039 |
struct litest_device *touchpad = litest_current_device(); |
| 5040 |
struct litest_device *keyboard, *generic_keyboard; |
| 5041 |
struct libinput *li = touchpad->libinput; |
| 5042 |
|
| 5043 |
litest_assert(has_disable_while_typing(touchpad)); |
| 5044 |
|
| 5045 |
/* Only the generic keyboard can trigger DWT */ |
| 5046 |
keyboard = litest_add_device(li, LITEST_KEYBOARD); |
| 5047 |
litest_drain_events(li); |
| 5048 |
|
| 5049 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 5050 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 5051 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 5052 |
|
| 5053 |
litest_touch_down(touchpad, 0, 50, 50); |
| 5054 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 5055 |
litest_touch_up(touchpad, 0); |
| 5056 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 5057 |
|
| 5058 |
generic_keyboard = litest_add_device(li, LITEST_GENERIC_USBCOMBO_KEYBOARD); |
| 5059 |
litest_drain_events(li); |
| 5060 |
|
| 5061 |
litest_keyboard_key(generic_keyboard, KEY_A, true); |
| 5062 |
litest_keyboard_key(generic_keyboard, KEY_A, false); |
| 5063 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_KEYBOARD_KEY); |
| 5064 |
|
| 5065 |
litest_touch_down(touchpad, 0, 50, 50); |
| 5066 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 5067 |
litest_touch_up(touchpad, 0); |
| 5068 |
litest_dispatch(li); |
| 5069 |
litest_assert_empty_queue(li); |
| 5070 |
|
| 5071 |
litest_device_destroy(keyboard); |
| 5072 |
litest_device_destroy(generic_keyboard); |
| 5073 |
} |
| 5074 |
END_TEST |
| 5075 |
|
| 5076 |
START_TEST(touchpad_dwt_multiple_keyboards) |
| 5077 |
{ |
| 5078 |
struct litest_device *touchpad = litest_current_device(); |
| 5079 |
struct litest_device *k1, *k2; |
| 5080 |
struct libinput *li = touchpad->libinput; |
| 5081 |
|
| 5082 |
litest_assert(has_disable_while_typing(touchpad)); |
| 5083 |
|
| 5084 |
enable_dwt(touchpad); |
| 5085 |
|
| 5086 |
k1 = litest_add_device(li, LITEST_KEYBOARD); |
| 5087 |
k2 = litest_add_device(li, LITEST_KEYBOARD); |
| 5088 |
|
| 5089 |
litest_keyboard_key(k1, KEY_A, true); |
| 5090 |
litest_keyboard_key(k1, KEY_A, false); |
| 5091 |
litest_drain_events(li); |
| 5092 |
|
| 5093 |
litest_touch_down(touchpad, 0, 50, 50); |
| 5094 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 5095 |
litest_touch_up(touchpad, 0); |
| 5096 |
litest_assert_empty_queue(li); |
| 5097 |
|
| 5098 |
litest_timeout_dwt_short(li); |
| 5099 |
|
| 5100 |
litest_keyboard_key(k2, KEY_A, true); |
| 5101 |
litest_keyboard_key(k2, KEY_A, false); |
| 5102 |
litest_drain_events(li); |
| 5103 |
|
| 5104 |
litest_touch_down(touchpad, 0, 50, 50); |
| 5105 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 5106 |
litest_touch_up(touchpad, 0); |
| 5107 |
litest_assert_empty_queue(li); |
| 5108 |
|
| 5109 |
litest_timeout_dwt_short(li); |
| 5110 |
|
| 5111 |
litest_device_destroy(k1); |
| 5112 |
litest_device_destroy(k2); |
| 5113 |
} |
| 5114 |
END_TEST |
| 5115 |
|
| 5116 |
START_TEST(touchpad_dwt_remove_before_keyboard) |
| 5117 |
{ |
| 5118 |
struct litest_device *keyboard = litest_current_device(); |
| 5119 |
struct litest_device *touchpad; |
| 5120 |
struct libinput *li = keyboard->libinput; |
| 5121 |
|
| 5122 |
touchpad = litest_add_device(li, LITEST_SYNAPTICS_RMI4); |
| 5123 |
litest_assert(has_disable_while_typing(touchpad)); |
| 5124 |
|
| 5125 |
litest_dispatch(li); |
| 5126 |
|
| 5127 |
/* remove the touchpad before the keyboard. |
| 5128 |
* this test can fail in valgrind only */ |
| 5129 |
litest_device_destroy(touchpad); |
| 5130 |
} |
| 5131 |
END_TEST |
| 5132 |
|
| 5133 |
START_TEST(touchpad_dwt_multiple_keyboards_bothkeys) |
| 5134 |
{ |
| 5135 |
struct litest_device *touchpad = litest_current_device(); |
| 5136 |
struct litest_device *k1, *k2; |
| 5137 |
struct libinput *li = touchpad->libinput; |
| 5138 |
|
| 5139 |
litest_assert(has_disable_while_typing(touchpad)); |
| 5140 |
|
| 5141 |
enable_dwt(touchpad); |
| 5142 |
|
| 5143 |
k1 = litest_add_device(li, LITEST_KEYBOARD); |
| 5144 |
k2 = litest_add_device(li, LITEST_KEYBOARD); |
| 5145 |
|
| 5146 |
litest_keyboard_key(k1, KEY_A, true); |
| 5147 |
litest_keyboard_key(k1, KEY_A, false); |
| 5148 |
litest_keyboard_key(k2, KEY_B, true); |
| 5149 |
litest_keyboard_key(k2, KEY_B, false); |
| 5150 |
litest_drain_events(li); |
| 5151 |
|
| 5152 |
litest_touch_down(touchpad, 0, 50, 50); |
| 5153 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 5154 |
litest_touch_up(touchpad, 0); |
| 5155 |
litest_assert_empty_queue(li); |
| 5156 |
|
| 5157 |
litest_device_destroy(k1); |
| 5158 |
litest_device_destroy(k2); |
| 5159 |
} |
| 5160 |
END_TEST |
| 5161 |
|
| 5162 |
START_TEST(touchpad_dwt_multiple_keyboards_bothkeys_modifier) |
| 5163 |
{ |
| 5164 |
struct litest_device *touchpad = litest_current_device(); |
| 5165 |
struct litest_device *k1, *k2; |
| 5166 |
struct libinput *li = touchpad->libinput; |
| 5167 |
|
| 5168 |
litest_assert(has_disable_while_typing(touchpad)); |
| 5169 |
|
| 5170 |
enable_dwt(touchpad); |
| 5171 |
|
| 5172 |
k1 = litest_add_device(li, LITEST_KEYBOARD); |
| 5173 |
k2 = litest_add_device(li, LITEST_KEYBOARD); |
| 5174 |
|
| 5175 |
litest_keyboard_key(k1, KEY_RIGHTCTRL, true); |
| 5176 |
litest_keyboard_key(k1, KEY_RIGHTCTRL, false); |
| 5177 |
litest_keyboard_key(k2, KEY_B, true); |
| 5178 |
litest_keyboard_key(k2, KEY_B, false); |
| 5179 |
litest_drain_events(li); |
| 5180 |
|
| 5181 |
/* If the keyboard is a single physical device, the above should |
| 5182 |
* trigger the modifier behavior for dwt. But libinput views it as |
| 5183 |
* two separate devices and this is such a niche case that it |
| 5184 |
* doesn't matter. So we test for the easy behavior: |
| 5185 |
* ctrl+B across two devices is *not* a dwt modifier combo |
| 5186 |
*/ |
| 5187 |
litest_touch_down(touchpad, 0, 50, 50); |
| 5188 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 5189 |
litest_touch_up(touchpad, 0); |
| 5190 |
litest_assert_empty_queue(li); |
| 5191 |
|
| 5192 |
litest_device_destroy(k1); |
| 5193 |
litest_device_destroy(k2); |
| 5194 |
} |
| 5195 |
END_TEST |
| 5196 |
|
| 5197 |
START_TEST(touchpad_dwt_multiple_keyboards_remove) |
| 5198 |
{ |
| 5199 |
struct litest_device *touchpad = litest_current_device(); |
| 5200 |
struct litest_device *keyboards[2]; |
| 5201 |
struct libinput *li = touchpad->libinput; |
| 5202 |
int which = litest_test_param_get_i32(test_env->params, "which"); |
| 5203 |
struct litest_device *removed, *remained; |
| 5204 |
|
| 5205 |
litest_assert_int_le(which, 1); |
| 5206 |
|
| 5207 |
litest_assert(has_disable_while_typing(touchpad)); |
| 5208 |
|
| 5209 |
enable_dwt(touchpad); |
| 5210 |
|
| 5211 |
keyboards[0] = litest_add_device(li, LITEST_KEYBOARD); |
| 5212 |
keyboards[1] = litest_add_device(li, LITEST_KEYBOARD); |
| 5213 |
|
| 5214 |
litest_keyboard_key(keyboards[0], KEY_A, true); |
| 5215 |
litest_keyboard_key(keyboards[0], KEY_A, false); |
| 5216 |
litest_keyboard_key(keyboards[1], KEY_B, true); |
| 5217 |
litest_keyboard_key(keyboards[1], KEY_B, false); |
| 5218 |
litest_drain_events(li); |
| 5219 |
|
| 5220 |
litest_timeout_dwt_short(li); |
| 5221 |
|
| 5222 |
removed = keyboards[which % 2]; |
| 5223 |
remained = keyboards[(which + 1) % 2]; |
| 5224 |
|
| 5225 |
litest_device_destroy(removed); |
| 5226 |
litest_keyboard_key(remained, KEY_C, true); |
| 5227 |
litest_keyboard_key(remained, KEY_C, false); |
| 5228 |
litest_drain_events(li); |
| 5229 |
|
| 5230 |
litest_touch_down(touchpad, 0, 50, 50); |
| 5231 |
litest_touch_move_to(touchpad, 0, 50, 50, 70, 50, 10); |
| 5232 |
litest_touch_up(touchpad, 0); |
| 5233 |
litest_assert_empty_queue(li); |
| 5234 |
|
| 5235 |
litest_device_destroy(remained); |
| 5236 |
} |
| 5237 |
END_TEST |
| 5238 |
|
| 5239 |
static int |
| 5240 |
has_thumb_detect(struct litest_device *dev) |
| 5241 |
{ |
| 5242 |
double w, h; |
| 5243 |
|
| 5244 |
if (libinput_device_get_size(dev->libinput_device, &w, &h) != 0) |
| 5245 |
return 0; |
| 5246 |
|
| 5247 |
return h >= 50.0; |
| 5248 |
} |
| 5249 |
|
| 5250 |
START_TEST(touchpad_thumb_lower_area_movement) |
| 5251 |
{ |
| 5252 |
struct litest_device *dev = litest_current_device(); |
| 5253 |
struct libinput *li = dev->libinput; |
| 5254 |
|
| 5255 |
if (!has_thumb_detect(dev)) |
| 5256 |
return LITEST_NOT_APPLICABLE; |
| 5257 |
|
| 5258 |
litest_disable_tap(dev->libinput_device); |
| 5259 |
litest_disable_hold_gestures(dev->libinput_device); |
| 5260 |
litest_drain_events(li); |
| 5261 |
|
| 5262 |
/* Thumb below lower line - slow movement - no events */ |
| 5263 |
litest_touch_down(dev, 0, 50, 99); |
| 5264 |
litest_touch_move_to(dev, 0, 55, 99, 60, 99, 50); |
| 5265 |
litest_assert_empty_queue(li); |
| 5266 |
|
| 5267 |
/* Thumb below lower line - fast movement - events */ |
| 5268 |
litest_touch_move_to(dev, 0, 60, 99, 90, 99, 30); |
| 5269 |
litest_touch_up(dev, 0); |
| 5270 |
|
| 5271 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 5272 |
} |
| 5273 |
END_TEST |
| 5274 |
|
| 5275 |
START_TEST(touchpad_thumb_lower_area_movement_rethumb) |
| 5276 |
{ |
| 5277 |
struct litest_device *dev = litest_current_device(); |
| 5278 |
struct libinput *li = dev->libinput; |
| 5279 |
|
| 5280 |
if (!has_thumb_detect(dev)) |
| 5281 |
return LITEST_NOT_APPLICABLE; |
| 5282 |
|
| 5283 |
litest_disable_tap(dev->libinput_device); |
| 5284 |
litest_disable_hold_gestures(dev->libinput_device); |
| 5285 |
litest_drain_events(li); |
| 5286 |
|
| 5287 |
/* Thumb below lower line - fast movement - events */ |
| 5288 |
litest_touch_down(dev, 0, 50, 99); |
| 5289 |
litest_touch_move_to(dev, 0, 50, 99, 90, 99, 30); |
| 5290 |
litest_drain_events(li); |
| 5291 |
|
| 5292 |
/* slow movement after being a non-touch - still events */ |
| 5293 |
litest_touch_move_to(dev, 0, 90, 99, 60, 99, 50); |
| 5294 |
litest_touch_up(dev, 0); |
| 5295 |
|
| 5296 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 5297 |
} |
| 5298 |
END_TEST |
| 5299 |
|
| 5300 |
START_TEST(touchpad_thumb_speed_empty_slots) |
| 5301 |
{ |
| 5302 |
struct litest_device *dev = litest_current_device(); |
| 5303 |
struct libinput *li = dev->libinput; |
| 5304 |
|
| 5305 |
litest_disable_tap(dev->libinput_device); |
| 5306 |
litest_enable_2fg_scroll(dev); |
| 5307 |
litest_disable_hold_gestures(dev->libinput_device); |
| 5308 |
|
| 5309 |
if (libevdev_get_num_slots(dev->evdev) < 3) |
| 5310 |
return LITEST_NOT_APPLICABLE; |
| 5311 |
|
| 5312 |
litest_drain_events(li); |
| 5313 |
|
| 5314 |
/* exceed the speed movement threshold in slot 0, then lift the |
| 5315 |
* finger */ |
| 5316 |
litest_touch_down(dev, 0, 50, 20); |
| 5317 |
litest_touch_move_to(dev, 0, 50, 20, 70, 99, 15); |
| 5318 |
litest_touch_up(dev, 0); |
| 5319 |
|
| 5320 |
litest_drain_events(li); |
| 5321 |
|
| 5322 |
/* now scroll in slots 1 and 2, this should be a normal scroll event |
| 5323 |
* despite slot 0 exceeding the speed threshold earlier */ |
| 5324 |
litest_touch_down(dev, 1, 50, 50); |
| 5325 |
litest_touch_down(dev, 2, 55, 50); |
| 5326 |
litest_dispatch(li); |
| 5327 |
for (int i = 0, y = 50; i < 10; i++, y++) { |
| 5328 |
litest_touch_move_to(dev, 1, 50, y, 50, y + 1, 1); |
| 5329 |
litest_touch_move_to(dev, 2, 55, y, 55, y + 1, 1); |
| 5330 |
} |
| 5331 |
litest_dispatch(li); |
| 5332 |
litest_touch_up(dev, 1); |
| 5333 |
litest_touch_up(dev, 2); |
| 5334 |
litest_dispatch(li); |
| 5335 |
litest_assert_scroll(li, |
| 5336 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 5337 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, |
| 5338 |
2); |
| 5339 |
} |
| 5340 |
END_TEST |
| 5341 |
|
| 5342 |
START_TEST(touchpad_thumb_area_clickfinger) |
| 5343 |
{ |
| 5344 |
struct litest_device *dev = litest_current_device(); |
| 5345 |
struct libinput *li = dev->libinput; |
| 5346 |
struct libinput_event *event; |
| 5347 |
|
| 5348 |
if (!has_thumb_detect(dev)) |
| 5349 |
return LITEST_NOT_APPLICABLE; |
| 5350 |
|
| 5351 |
litest_disable_tap(dev->libinput_device); |
| 5352 |
litest_disable_hold_gestures(dev->libinput_device); |
| 5353 |
|
| 5354 |
libinput_device_config_click_set_method( |
| 5355 |
dev->libinput_device, |
| 5356 |
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); |
| 5357 |
|
| 5358 |
litest_drain_events(li); |
| 5359 |
|
| 5360 |
litest_touch_down(dev, 0, 50, 99); /* thumb */ |
| 5361 |
litest_dispatch(li); |
| 5362 |
litest_touch_down(dev, 1, 60, 50); |
| 5363 |
litest_dispatch(li); |
| 5364 |
litest_button_click(dev, BTN_LEFT, true); |
| 5365 |
|
| 5366 |
litest_dispatch(li); |
| 5367 |
event = libinput_get_event(li); |
| 5368 |
litest_is_button_event(event, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 5369 |
libinput_event_destroy(event); |
| 5370 |
|
| 5371 |
litest_assert_empty_queue(li); |
| 5372 |
|
| 5373 |
litest_button_click(dev, BTN_LEFT, false); |
| 5374 |
litest_touch_up(dev, 0); |
| 5375 |
litest_touch_up(dev, 1); |
| 5376 |
|
| 5377 |
litest_drain_events(li); |
| 5378 |
|
| 5379 |
litest_touch_down(dev, 1, 60, 99); /* thumb */ |
| 5380 |
litest_dispatch(li); |
| 5381 |
litest_touch_down(dev, 0, 50, 50); |
| 5382 |
litest_dispatch(li); |
| 5383 |
litest_button_click(dev, BTN_LEFT, true); |
| 5384 |
|
| 5385 |
litest_dispatch(li); |
| 5386 |
event = libinput_get_event(li); |
| 5387 |
litest_is_button_event(event, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 5388 |
libinput_event_destroy(event); |
| 5389 |
|
| 5390 |
litest_assert_empty_queue(li); |
| 5391 |
} |
| 5392 |
END_TEST |
| 5393 |
|
| 5394 |
START_TEST(touchpad_thumb_area_btnarea) |
| 5395 |
{ |
| 5396 |
struct litest_device *dev = litest_current_device(); |
| 5397 |
struct libinput *li = dev->libinput; |
| 5398 |
struct libinput_event *event; |
| 5399 |
|
| 5400 |
if (!has_thumb_detect(dev)) |
| 5401 |
return LITEST_NOT_APPLICABLE; |
| 5402 |
|
| 5403 |
litest_disable_tap(dev->libinput_device); |
| 5404 |
litest_disable_hold_gestures(dev->libinput_device); |
| 5405 |
|
| 5406 |
libinput_device_config_click_set_method( |
| 5407 |
dev->libinput_device, |
| 5408 |
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS); |
| 5409 |
|
| 5410 |
litest_drain_events(li); |
| 5411 |
|
| 5412 |
litest_touch_down(dev, 0, 90, 99); /* thumb */ |
| 5413 |
litest_dispatch(li); |
| 5414 |
litest_button_click(dev, BTN_LEFT, true); |
| 5415 |
|
| 5416 |
/* button areas work as usual with a thumb */ |
| 5417 |
|
| 5418 |
litest_dispatch(li); |
| 5419 |
event = libinput_get_event(li); |
| 5420 |
litest_is_button_event(event, BTN_RIGHT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 5421 |
libinput_event_destroy(event); |
| 5422 |
|
| 5423 |
litest_assert_empty_queue(li); |
| 5424 |
} |
| 5425 |
END_TEST |
| 5426 |
|
| 5427 |
START_TEST(touchpad_thumb_no_doublethumb) |
| 5428 |
{ |
| 5429 |
struct litest_device *dev = litest_current_device(); |
| 5430 |
struct libinput *li = dev->libinput; |
| 5431 |
|
| 5432 |
litest_disable_tap(dev->libinput_device); |
| 5433 |
litest_enable_clickfinger(dev); |
| 5434 |
litest_disable_hold_gestures(dev->libinput_device); |
| 5435 |
|
| 5436 |
if (!has_thumb_detect(dev)) |
| 5437 |
return LITEST_NOT_APPLICABLE; |
| 5438 |
|
| 5439 |
litest_drain_events(li); |
| 5440 |
|
| 5441 |
/* two touches in thumb area but we can't have two thumbs */ |
| 5442 |
litest_touch_down(dev, 0, 50, 99); |
| 5443 |
/* random sleep interval. we don't have a thumb timer, but let's not |
| 5444 |
* put both touches down and move them immediately because that |
| 5445 |
* should always be a scroll event anyway. Go with a delay in |
| 5446 |
* between to make it more likely that this is really testing thumb |
| 5447 |
* detection. |
| 5448 |
*/ |
| 5449 |
msleep(200); |
| 5450 |
litest_dispatch(li); |
| 5451 |
litest_touch_down(dev, 1, 70, 99); |
| 5452 |
litest_dispatch(li); |
| 5453 |
|
| 5454 |
litest_touch_move_two_touches(dev, 50, 99, 70, 99, 0, -20, 10); |
| 5455 |
litest_touch_up(dev, 0); |
| 5456 |
litest_touch_up(dev, 1); |
| 5457 |
|
| 5458 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 5459 |
} |
| 5460 |
END_TEST |
| 5461 |
|
| 5462 |
START_TEST(touchpad_tool_tripletap_touch_count) |
| 5463 |
{ |
| 5464 |
struct litest_device *dev = litest_current_device(); |
| 5465 |
struct libinput *li = dev->libinput; |
| 5466 |
struct libinput_event *event; |
| 5467 |
|
| 5468 |
/* Synaptics touchpads sometimes end one touch point while |
| 5469 |
* simultaneously setting BTN_TOOL_TRIPLETAP. |
| 5470 |
* https://bugs.freedesktop.org/show_bug.cgi?id=91352 |
| 5471 |
*/ |
| 5472 |
litest_drain_events(li); |
| 5473 |
litest_enable_clickfinger(dev); |
| 5474 |
|
| 5475 |
/* touch 1 down */ |
| 5476 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); |
| 5477 |
litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, 1); |
| 5478 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 1200); |
| 5479 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 3200); |
| 5480 |
litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 78); |
| 5481 |
litest_event(dev, EV_ABS, ABS_X, 1200); |
| 5482 |
litest_event(dev, EV_ABS, ABS_Y, 3200); |
| 5483 |
litest_event(dev, EV_ABS, ABS_PRESSURE, 78); |
| 5484 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); |
| 5485 |
litest_event(dev, EV_KEY, BTN_TOUCH, 1); |
| 5486 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 5487 |
litest_dispatch(li); |
| 5488 |
msleep(2); |
| 5489 |
|
| 5490 |
/* touch 2 down */ |
| 5491 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); |
| 5492 |
litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, 1); |
| 5493 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 3500); |
| 5494 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 3500); |
| 5495 |
litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 73); |
| 5496 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); |
| 5497 |
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); |
| 5498 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 5499 |
litest_dispatch(li); |
| 5500 |
msleep(2); |
| 5501 |
|
| 5502 |
/* touch 3 down, coordinate jump + ends slot 1 */ |
| 5503 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); |
| 5504 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 4000); |
| 5505 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 4000); |
| 5506 |
litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 78); |
| 5507 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); |
| 5508 |
litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); |
| 5509 |
litest_event(dev, EV_ABS, ABS_X, 4000); |
| 5510 |
litest_event(dev, EV_ABS, ABS_Y, 4000); |
| 5511 |
litest_event(dev, EV_ABS, ABS_PRESSURE, 78); |
| 5512 |
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); |
| 5513 |
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); |
| 5514 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 5515 |
litest_dispatch(li); |
| 5516 |
msleep(2); |
| 5517 |
|
| 5518 |
/* slot 2 reactivated */ |
| 5519 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); |
| 5520 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 4000); |
| 5521 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 4000); |
| 5522 |
litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 78); |
| 5523 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); |
| 5524 |
litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, 3); |
| 5525 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 3500); |
| 5526 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 3500); |
| 5527 |
litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 73); |
| 5528 |
litest_event(dev, EV_ABS, ABS_X, 4000); |
| 5529 |
litest_event(dev, EV_ABS, ABS_Y, 4000); |
| 5530 |
litest_event(dev, EV_ABS, ABS_PRESSURE, 78); |
| 5531 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 5532 |
litest_dispatch(li); |
| 5533 |
msleep(2); |
| 5534 |
|
| 5535 |
/* now a click should trigger middle click */ |
| 5536 |
litest_event(dev, EV_KEY, BTN_LEFT, 1); |
| 5537 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 5538 |
litest_dispatch(li); |
| 5539 |
litest_event(dev, EV_KEY, BTN_LEFT, 0); |
| 5540 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 5541 |
litest_dispatch(li); |
| 5542 |
|
| 5543 |
litest_wait_for_event(li); |
| 5544 |
event = libinput_get_event(li); |
| 5545 |
litest_is_button_event(event, BTN_MIDDLE, LIBINPUT_BUTTON_STATE_PRESSED); |
| 5546 |
libinput_event_destroy(event); |
| 5547 |
event = libinput_get_event(li); |
| 5548 |
litest_is_button_event(event, BTN_MIDDLE, LIBINPUT_BUTTON_STATE_RELEASED); |
| 5549 |
libinput_event_destroy(event); |
| 5550 |
|
| 5551 |
/* release everything */ |
| 5552 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); |
| 5553 |
litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); |
| 5554 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); |
| 5555 |
litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); |
| 5556 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); |
| 5557 |
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); |
| 5558 |
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); |
| 5559 |
litest_event(dev, EV_KEY, BTN_TOUCH, 0); |
| 5560 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 5561 |
} |
| 5562 |
END_TEST |
| 5563 |
|
| 5564 |
START_TEST(touchpad_tool_tripletap_touch_count_late) |
| 5565 |
{ |
| 5566 |
struct litest_device *dev = litest_current_device(); |
| 5567 |
struct libinput *li = dev->libinput; |
| 5568 |
struct libinput_event *event; |
| 5569 |
|
| 5570 |
/* Synaptics touchpads sometimes end one touch point after |
| 5571 |
* setting BTN_TOOL_TRIPLETAP. |
| 5572 |
* https://gitlab.freedesktop.org/libinput/libinput/issues/99 |
| 5573 |
*/ |
| 5574 |
litest_drain_events(li); |
| 5575 |
litest_enable_clickfinger(dev); |
| 5576 |
|
| 5577 |
/* touch 1 down */ |
| 5578 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); |
| 5579 |
litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, 1); |
| 5580 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 2200); |
| 5581 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 3200); |
| 5582 |
litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 78); |
| 5583 |
litest_event(dev, EV_ABS, ABS_X, 2200); |
| 5584 |
litest_event(dev, EV_ABS, ABS_Y, 3200); |
| 5585 |
litest_event(dev, EV_ABS, ABS_PRESSURE, 78); |
| 5586 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); |
| 5587 |
litest_event(dev, EV_KEY, BTN_TOUCH, 1); |
| 5588 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 5589 |
litest_dispatch(li); |
| 5590 |
msleep(10); |
| 5591 |
|
| 5592 |
/* touch 2 and TRIPLETAP down */ |
| 5593 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); |
| 5594 |
litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, 1); |
| 5595 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 3500); |
| 5596 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 3500); |
| 5597 |
litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 73); |
| 5598 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); |
| 5599 |
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); |
| 5600 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 5601 |
litest_dispatch(li); |
| 5602 |
msleep(10); |
| 5603 |
|
| 5604 |
/* touch 2 up, coordinate jump + ends slot 1, TRIPLETAP stays */ |
| 5605 |
litest_disable_log_handler(li); |
| 5606 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); |
| 5607 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 4000); |
| 5608 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 4000); |
| 5609 |
litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 78); |
| 5610 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); |
| 5611 |
litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); |
| 5612 |
litest_event(dev, EV_ABS, ABS_X, 4000); |
| 5613 |
litest_event(dev, EV_ABS, ABS_Y, 4000); |
| 5614 |
litest_event(dev, EV_ABS, ABS_PRESSURE, 78); |
| 5615 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 5616 |
litest_dispatch(li); |
| 5617 |
msleep(10); |
| 5618 |
|
| 5619 |
/* slot 2 reactivated */ |
| 5620 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); |
| 5621 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 4000); |
| 5622 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 4000); |
| 5623 |
litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 78); |
| 5624 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 1); |
| 5625 |
litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, 3); |
| 5626 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 3500); |
| 5627 |
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 3500); |
| 5628 |
litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 73); |
| 5629 |
litest_event(dev, EV_ABS, ABS_X, 4000); |
| 5630 |
litest_event(dev, EV_ABS, ABS_Y, 4000); |
| 5631 |
litest_event(dev, EV_ABS, ABS_PRESSURE, 78); |
| 5632 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 5633 |
litest_dispatch(li); |
| 5634 |
msleep(10); |
| 5635 |
litest_restore_log_handler(li); |
| 5636 |
|
| 5637 |
/* now a click should trigger middle click */ |
| 5638 |
litest_event(dev, EV_KEY, BTN_LEFT, 1); |
| 5639 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 5640 |
litest_dispatch(li); |
| 5641 |
litest_event(dev, EV_KEY, BTN_LEFT, 0); |
| 5642 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 5643 |
litest_dispatch(li); |
| 5644 |
|
| 5645 |
litest_wait_for_event(li); |
| 5646 |
event = libinput_get_event(li); |
| 5647 |
litest_is_button_event(event, BTN_MIDDLE, LIBINPUT_BUTTON_STATE_PRESSED); |
| 5648 |
libinput_event_destroy(event); |
| 5649 |
event = libinput_get_event(li); |
| 5650 |
litest_is_button_event(event, BTN_MIDDLE, LIBINPUT_BUTTON_STATE_RELEASED); |
| 5651 |
libinput_event_destroy(event); |
| 5652 |
|
| 5653 |
/* release everything */ |
| 5654 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); |
| 5655 |
litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); |
| 5656 |
litest_event(dev, EV_ABS, ABS_MT_SLOT, 0); |
| 5657 |
litest_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); |
| 5658 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); |
| 5659 |
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); |
| 5660 |
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); |
| 5661 |
litest_event(dev, EV_KEY, BTN_TOUCH, 0); |
| 5662 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 5663 |
} |
| 5664 |
END_TEST |
| 5665 |
|
| 5666 |
START_TEST(touchpad_slot_swap) |
| 5667 |
{ |
| 5668 |
struct litest_device *dev = litest_current_device(); |
| 5669 |
struct libinput *li = dev->libinput; |
| 5670 |
struct libinput_event *event; |
| 5671 |
int first, second; |
| 5672 |
|
| 5673 |
/* Synaptics touchpads sometimes end the wrong touchpoint on finger |
| 5674 |
* up, causing the remaining slot to continue with the other slot's |
| 5675 |
* coordinates. |
| 5676 |
* https://bugs.freedesktop.org/show_bug.cgi?id=91352 |
| 5677 |
*/ |
| 5678 |
litest_drain_events(li); |
| 5679 |
|
| 5680 |
for (first = 0; first <= 1; first++) { |
| 5681 |
const double start[2][2] = { { 50, 50 }, { 60, 60 } }; |
| 5682 |
second = 1 - first; |
| 5683 |
|
| 5684 |
litest_touch_down(dev, 0, start[0][0], start[0][1]); |
| 5685 |
litest_dispatch(li); |
| 5686 |
litest_touch_down(dev, 1, start[1][0], start[1][1]); |
| 5687 |
litest_dispatch(li); |
| 5688 |
|
| 5689 |
litest_touch_move_two_touches(dev, |
| 5690 |
start[first][0], |
| 5691 |
start[first][1], |
| 5692 |
start[second][0], |
| 5693 |
start[second][1], |
| 5694 |
30, |
| 5695 |
30, |
| 5696 |
10); |
| 5697 |
litest_drain_events(li); |
| 5698 |
|
| 5699 |
/* release touch 0, continue other slot with 0's coords */ |
| 5700 |
litest_push_event_frame(dev); |
| 5701 |
litest_touch_up(dev, first); |
| 5702 |
litest_touch_move(dev, |
| 5703 |
second, |
| 5704 |
start[second][0] + 30, |
| 5705 |
start[second][1] + 30.1); |
| 5706 |
litest_pop_event_frame(dev); |
| 5707 |
litest_dispatch(li); |
| 5708 |
/* If a gesture was detected, we need to go past the gesture |
| 5709 |
* timeout to trigger events. So let's move a bit first to |
| 5710 |
* make sure it looks continuous, then wait, then move again |
| 5711 |
* to make sure we trigger events */ |
| 5712 |
litest_touch_move_to(dev, |
| 5713 |
second, |
| 5714 |
start[first][0] + 30, |
| 5715 |
start[first][1] + 30, |
| 5716 |
50, |
| 5717 |
21, |
| 5718 |
10); |
| 5719 |
litest_dispatch(li); |
| 5720 |
litest_timeout_gesture(li); |
| 5721 |
litest_dispatch(li); |
| 5722 |
/* drain a potential scroll stop */ |
| 5723 |
litest_drain_events(li); |
| 5724 |
litest_touch_move_to(dev, second, 50, 21, 50, 11, 20); |
| 5725 |
litest_dispatch(li); |
| 5726 |
event = libinput_get_event(li); |
| 5727 |
do { |
| 5728 |
struct libinput_event_pointer *ptrev; |
| 5729 |
|
| 5730 |
ptrev = litest_is_motion_event(event); |
| 5731 |
litest_assert_double_eq(libinput_event_pointer_get_dx(ptrev), |
| 5732 |
0.0); |
| 5733 |
litest_assert_double_lt(libinput_event_pointer_get_dy(ptrev), |
| 5734 |
1.0); |
| 5735 |
|
| 5736 |
libinput_event_destroy(event); |
| 5737 |
event = libinput_get_event(li); |
| 5738 |
} while (event); |
| 5739 |
litest_assert_empty_queue(li); |
| 5740 |
|
| 5741 |
litest_touch_up(dev, second); |
| 5742 |
} |
| 5743 |
} |
| 5744 |
END_TEST |
| 5745 |
|
| 5746 |
START_TEST(touchpad_finger_always_down) |
| 5747 |
{ |
| 5748 |
struct litest_device *dev = litest_current_device(); |
| 5749 |
|
| 5750 |
/* Set BTN_TOOL_FINGER before a new context is initialized */ |
| 5751 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 1); |
| 5752 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 5753 |
|
| 5754 |
_litest_context_destroy_ struct libinput *li = litest_create_context(); |
| 5755 |
libinput_path_add_device(li, libevdev_uinput_get_devnode(dev->uinput)); |
| 5756 |
litest_drain_events(li); |
| 5757 |
|
| 5758 |
litest_touch_down(dev, 0, 50, 50); |
| 5759 |
litest_dispatch(li); |
| 5760 |
litest_touch_move_to(dev, 0, 50, 50, 70, 50, 10); |
| 5761 |
|
| 5762 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 5763 |
} |
| 5764 |
END_TEST |
| 5765 |
|
| 5766 |
START_TEST(touchpad_time_usec) |
| 5767 |
{ |
| 5768 |
struct litest_device *dev = litest_current_device(); |
| 5769 |
struct libinput *li = dev->libinput; |
| 5770 |
struct libinput_event *event; |
| 5771 |
|
| 5772 |
litest_disable_tap(dev->libinput_device); |
| 5773 |
litest_disable_hold_gestures(dev->libinput_device); |
| 5774 |
litest_drain_events(li); |
| 5775 |
|
| 5776 |
litest_touch_down(dev, 0, 50, 50); |
| 5777 |
litest_touch_move_to(dev, 0, 50, 50, 80, 50, 20); |
| 5778 |
litest_touch_up(dev, 0); |
| 5779 |
|
| 5780 |
litest_dispatch(li); |
| 5781 |
|
| 5782 |
event = libinput_get_event(li); |
| 5783 |
litest_assert_notnull(event); |
| 5784 |
|
| 5785 |
while (event) { |
| 5786 |
struct libinput_event_pointer *ptrev; |
| 5787 |
uint64_t utime; |
| 5788 |
|
| 5789 |
ptrev = litest_is_motion_event(event); |
| 5790 |
utime = libinput_event_pointer_get_time_usec(ptrev); |
| 5791 |
|
| 5792 |
litest_assert_int_eq(libinput_event_pointer_get_time(ptrev), |
| 5793 |
(uint32_t)(utime / 1000)); |
| 5794 |
libinput_event_destroy(event); |
| 5795 |
event = libinput_get_event(li); |
| 5796 |
} |
| 5797 |
} |
| 5798 |
END_TEST |
| 5799 |
|
| 5800 |
START_TEST(touchpad_jump_finger_motion) |
| 5801 |
{ |
| 5802 |
struct litest_device *dev = litest_current_device(); |
| 5803 |
struct libinput *li = dev->libinput; |
| 5804 |
struct libinput_event *event; |
| 5805 |
|
| 5806 |
litest_touch_down(dev, 0, 20, 30); |
| 5807 |
litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10); |
| 5808 |
litest_drain_events(li); |
| 5809 |
|
| 5810 |
/* this test uses a specific test device to trigger a >20mm jump to |
| 5811 |
* test jumps. These numbers may not work on any other device */ |
| 5812 |
litest_disable_log_handler(li); |
| 5813 |
litest_touch_move_to(dev, 0, 90, 30, 20, 80, 1); |
| 5814 |
litest_assert_empty_queue(li); |
| 5815 |
litest_restore_log_handler(li); |
| 5816 |
|
| 5817 |
litest_touch_move_to(dev, 0, 20, 80, 21, 81, 10); |
| 5818 |
litest_touch_up(dev, 0); |
| 5819 |
|
| 5820 |
/* expect lots of little events, no big jump */ |
| 5821 |
litest_dispatch(li); |
| 5822 |
event = libinput_get_event(li); |
| 5823 |
do { |
| 5824 |
struct libinput_event_pointer *ptrev; |
| 5825 |
double dx, dy; |
| 5826 |
|
| 5827 |
ptrev = litest_is_motion_event(event); |
| 5828 |
dx = libinput_event_pointer_get_dx(ptrev); |
| 5829 |
dy = libinput_event_pointer_get_dy(ptrev); |
| 5830 |
litest_assert_int_lt(abs((int)dx), 20); |
| 5831 |
litest_assert_int_lt(abs((int)dy), 20); |
| 5832 |
|
| 5833 |
libinput_event_destroy(event); |
| 5834 |
event = libinput_get_event(li); |
| 5835 |
} while (event != NULL); |
| 5836 |
} |
| 5837 |
END_TEST |
| 5838 |
|
| 5839 |
START_TEST(touchpad_jump_delta) |
| 5840 |
{ |
| 5841 |
struct litest_device *dev = litest_current_device(); |
| 5842 |
struct libinput *li = dev->libinput; |
| 5843 |
struct libinput_event *event; |
| 5844 |
|
| 5845 |
litest_touch_down(dev, 0, 20, 30); |
| 5846 |
litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10); |
| 5847 |
litest_drain_events(li); |
| 5848 |
|
| 5849 |
/* this test uses a specific test device to trigger a >7mm but <20mm |
| 5850 |
* jump to test the delta jumps. These numbers may not work on any |
| 5851 |
* other device */ |
| 5852 |
litest_disable_log_handler(li); |
| 5853 |
litest_touch_move(dev, 0, 90, 88); |
| 5854 |
litest_assert_empty_queue(li); |
| 5855 |
litest_restore_log_handler(li); |
| 5856 |
|
| 5857 |
litest_touch_move_to(dev, 0, 90, 88, 91, 89, 10); |
| 5858 |
litest_touch_up(dev, 0); |
| 5859 |
|
| 5860 |
/* expect lots of little events, no big jump */ |
| 5861 |
litest_dispatch(li); |
| 5862 |
event = libinput_get_event(li); |
| 5863 |
do { |
| 5864 |
struct libinput_event_pointer *ptrev; |
| 5865 |
double dx, dy; |
| 5866 |
|
| 5867 |
ptrev = litest_is_motion_event(event); |
| 5868 |
dx = libinput_event_pointer_get_dx(ptrev); |
| 5869 |
dy = libinput_event_pointer_get_dy(ptrev); |
| 5870 |
litest_assert_int_lt(abs((int)dx), 20); |
| 5871 |
litest_assert_int_lt(abs((int)dy), 20); |
| 5872 |
|
| 5873 |
libinput_event_destroy(event); |
| 5874 |
event = libinput_get_event(li); |
| 5875 |
} while (event != NULL); |
| 5876 |
} |
| 5877 |
END_TEST |
| 5878 |
|
| 5879 |
START_TEST(touchpad_disabled_on_mouse) |
| 5880 |
{ |
| 5881 |
struct litest_device *dev = litest_current_device(); |
| 5882 |
struct litest_device *mouse; |
| 5883 |
struct libinput *li = dev->libinput; |
| 5884 |
enum libinput_config_status status; |
| 5885 |
bool suspend = litest_test_param_get_bool(test_env->params, "suspend"); |
| 5886 |
|
| 5887 |
litest_drain_events(li); |
| 5888 |
litest_disable_hold_gestures(dev->libinput_device); |
| 5889 |
|
| 5890 |
status = libinput_device_config_send_events_set_mode( |
| 5891 |
dev->libinput_device, |
| 5892 |
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE); |
| 5893 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 5894 |
|
| 5895 |
litest_touch_down(dev, 0, 20, 30); |
| 5896 |
litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10); |
| 5897 |
litest_touch_up(dev, 0); |
| 5898 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 5899 |
|
| 5900 |
mouse = litest_add_device(li, LITEST_MOUSE); |
| 5901 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_ADDED); |
| 5902 |
|
| 5903 |
/* Mouse hasn't sent events yet */ |
| 5904 |
litest_touch_down(dev, 0, 20, 30); |
| 5905 |
litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10); |
| 5906 |
litest_touch_up(dev, 0); |
| 5907 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 5908 |
|
| 5909 |
/* Now send the events */ |
| 5910 |
litest_event(mouse, EV_REL, REL_X, -1); |
| 5911 |
litest_event(mouse, EV_REL, REL_Y, 1); |
| 5912 |
litest_event(mouse, EV_SYN, SYN_REPORT, 0); |
| 5913 |
litest_drain_events(li); |
| 5914 |
|
| 5915 |
litest_touch_down(dev, 0, 20, 30); |
| 5916 |
litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10); |
| 5917 |
litest_touch_up(dev, 0); |
| 5918 |
litest_assert_empty_queue(li); |
| 5919 |
|
| 5920 |
if (suspend) { |
| 5921 |
/* Disable external mouse -> expect touchpad events */ |
| 5922 |
status = libinput_device_config_send_events_set_mode( |
| 5923 |
mouse->libinput_device, |
| 5924 |
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); |
| 5925 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 5926 |
|
| 5927 |
litest_touch_down(dev, 0, 20, 30); |
| 5928 |
litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10); |
| 5929 |
litest_touch_up(dev, 0); |
| 5930 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 5931 |
} |
| 5932 |
|
| 5933 |
litest_device_destroy(mouse); |
| 5934 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_REMOVED); |
| 5935 |
|
| 5936 |
litest_touch_down(dev, 0, 20, 30); |
| 5937 |
litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10); |
| 5938 |
litest_touch_up(dev, 0); |
| 5939 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 5940 |
} |
| 5941 |
END_TEST |
| 5942 |
|
| 5943 |
START_TEST(touchpad_disabled_double_mouse) |
| 5944 |
{ |
| 5945 |
struct litest_device *dev = litest_current_device(); |
| 5946 |
struct litest_device *nonsending_mouse, *sending_mouse; |
| 5947 |
struct libinput *li = dev->libinput; |
| 5948 |
enum libinput_config_status status; |
| 5949 |
bool suspend_nonsending = |
| 5950 |
litest_test_param_get_bool(test_env->params, "suspend-nonsending"); |
| 5951 |
int32_t remove = litest_test_param_get_i32(test_env->params, "remove"); |
| 5952 |
|
| 5953 |
litest_drain_events(li); |
| 5954 |
litest_disable_hold_gestures(dev->libinput_device); |
| 5955 |
|
| 5956 |
status = libinput_device_config_send_events_set_mode( |
| 5957 |
dev->libinput_device, |
| 5958 |
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE); |
| 5959 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 5960 |
|
| 5961 |
litest_touch_down(dev, 0, 20, 30); |
| 5962 |
litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10); |
| 5963 |
litest_touch_up(dev, 0); |
| 5964 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 5965 |
|
| 5966 |
nonsending_mouse = litest_add_device(li, LITEST_MOUSE); |
| 5967 |
sending_mouse = litest_add_device(li, LITEST_MOUSE_LOW_DPI); |
| 5968 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_ADDED); |
| 5969 |
|
| 5970 |
/* Mouse hasn't sent events yet */ |
| 5971 |
litest_touch_down(dev, 0, 20, 30); |
| 5972 |
litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10); |
| 5973 |
litest_touch_up(dev, 0); |
| 5974 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 5975 |
|
| 5976 |
/* Now send the events */ |
| 5977 |
litest_event(sending_mouse, EV_REL, REL_X, -1); |
| 5978 |
litest_event(sending_mouse, EV_REL, REL_Y, 1); |
| 5979 |
litest_event(sending_mouse, EV_SYN, SYN_REPORT, 0); |
| 5980 |
litest_drain_events(li); |
| 5981 |
|
| 5982 |
if (suspend_nonsending) { |
| 5983 |
/* Disable one external mouse -> don't expect touchpad events */ |
| 5984 |
status = libinput_device_config_send_events_set_mode( |
| 5985 |
nonsending_mouse->libinput_device, |
| 5986 |
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED); |
| 5987 |
litest_assert_enum_eq(status, LIBINPUT_CONFIG_STATUS_SUCCESS); |
| 5988 |
} |
| 5989 |
|
| 5990 |
litest_touch_down(dev, 0, 20, 30); |
| 5991 |
litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10); |
| 5992 |
litest_touch_up(dev, 0); |
| 5993 |
litest_assert_empty_queue(li); |
| 5994 |
|
| 5995 |
switch (remove) { |
| 5996 |
case 1: |
| 5997 |
litest_device_destroy(steal(&nonsending_mouse)); |
| 5998 |
break; |
| 5999 |
case 2: |
| 6000 |
litest_device_destroy(steal(&sending_mouse)); |
| 6001 |
break; |
| 6002 |
} |
| 6003 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_REMOVED); |
| 6004 |
|
| 6005 |
litest_touch_down(dev, 0, 20, 30); |
| 6006 |
litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10); |
| 6007 |
litest_touch_up(dev, 0); |
| 6008 |
|
| 6009 |
/* Removing the only mouse that sent events should resume our touchpad */ |
| 6010 |
switch (remove) { |
| 6011 |
case 1: |
| 6012 |
litest_assert_empty_queue(li); |
| 6013 |
break; |
| 6014 |
case 2: |
| 6015 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 6016 |
break; |
| 6017 |
} |
| 6018 |
|
| 6019 |
if (sending_mouse) |
| 6020 |
litest_device_destroy(steal(&sending_mouse)); |
| 6021 |
if (nonsending_mouse) |
| 6022 |
litest_device_destroy(steal(&nonsending_mouse)); |
| 6023 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_DEVICE_REMOVED); |
| 6024 |
|
| 6025 |
litest_touch_down(dev, 0, 20, 30); |
| 6026 |
litest_touch_move_to(dev, 0, 20, 30, 90, 30, 10); |
| 6027 |
litest_touch_up(dev, 0); |
| 6028 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 6029 |
} |
| 6030 |
END_TEST |
| 6031 |
|
| 6032 |
static inline bool |
| 6033 |
touchpad_has_pressure(struct litest_device *dev) |
| 6034 |
{ |
| 6035 |
struct libevdev *evdev = dev->evdev; |
| 6036 |
|
| 6037 |
if (dev->which == LITEST_SYNAPTICS_PRESSUREPAD) |
| 6038 |
return false; |
| 6039 |
|
| 6040 |
if (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_PRESSURE)) |
| 6041 |
return libevdev_get_abs_resolution(evdev, ABS_MT_PRESSURE) == 0; |
| 6042 |
|
| 6043 |
if (libevdev_has_event_code(evdev, EV_ABS, ABS_PRESSURE) && |
| 6044 |
!libevdev_has_event_code(evdev, EV_ABS, ABS_MT_SLOT)) |
| 6045 |
return true; |
| 6046 |
|
| 6047 |
return false; |
| 6048 |
} |
| 6049 |
|
| 6050 |
START_TEST(touchpad_pressure) |
| 6051 |
{ |
| 6052 |
struct litest_device *dev = litest_current_device(); |
| 6053 |
struct libinput *li = dev->libinput; |
| 6054 |
struct axis_replacement axes[] = { |
| 6055 |
{ ABS_MT_PRESSURE, 1 }, |
| 6056 |
{ ABS_PRESSURE, 1 }, |
| 6057 |
{ -1, 0 }, |
| 6058 |
}; |
| 6059 |
double pressure; /* in percent */ |
| 6060 |
double threshold = 12.0; |
| 6061 |
|
| 6062 |
if (!touchpad_has_pressure(dev)) |
| 6063 |
return LITEST_NOT_APPLICABLE; |
| 6064 |
|
| 6065 |
litest_drain_events(li); |
| 6066 |
|
| 6067 |
for (pressure = 1; pressure <= threshold + 1; pressure++) { |
| 6068 |
litest_axis_set_value(axes, ABS_MT_PRESSURE, pressure); |
| 6069 |
litest_axis_set_value(axes, ABS_PRESSURE, pressure); |
| 6070 |
litest_touch_down_extended(dev, 0, 50, 50, axes); |
| 6071 |
litest_touch_move_to_extended(dev, 0, 50, 50, 80, 80, axes, 10); |
| 6072 |
litest_touch_up(dev, 0); |
| 6073 |
if (pressure < threshold) |
| 6074 |
litest_assert_empty_queue(li); |
| 6075 |
else |
| 6076 |
litest_assert_only_typed_events(li, |
| 6077 |
LIBINPUT_EVENT_POINTER_MOTION); |
| 6078 |
} |
| 6079 |
} |
| 6080 |
END_TEST |
| 6081 |
|
| 6082 |
START_TEST(touchpad_pressure_2fg) |
| 6083 |
{ |
| 6084 |
struct litest_device *dev = litest_current_device(); |
| 6085 |
struct libinput *li = dev->libinput; |
| 6086 |
struct axis_replacement axes[] = { |
| 6087 |
{ ABS_MT_PRESSURE, 5 }, |
| 6088 |
{ ABS_PRESSURE, 5 }, |
| 6089 |
{ -1, 0 }, |
| 6090 |
}; |
| 6091 |
|
| 6092 |
if (!touchpad_has_pressure(dev)) |
| 6093 |
return LITEST_NOT_APPLICABLE; |
| 6094 |
|
| 6095 |
litest_drain_events(li); |
| 6096 |
|
| 6097 |
litest_touch_down(dev, 0, 30, 50); |
| 6098 |
litest_touch_down_extended(dev, 1, 50, 50, axes); |
| 6099 |
litest_dispatch(li); |
| 6100 |
litest_touch_move_to(dev, 0, 30, 50, 80, 80, 10); |
| 6101 |
litest_dispatch(li); |
| 6102 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 6103 |
litest_touch_move_to_extended(dev, 1, 50, 50, 80, 80, axes, 10); |
| 6104 |
litest_assert_empty_queue(li); |
| 6105 |
litest_touch_move_to(dev, 0, 80, 80, 20, 50, 10); |
| 6106 |
litest_touch_move_to_extended(dev, 1, 80, 80, 50, 50, axes, 10); |
| 6107 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 6108 |
} |
| 6109 |
END_TEST |
| 6110 |
|
| 6111 |
START_TEST(touchpad_pressure_2fg_st) |
| 6112 |
{ |
| 6113 |
struct litest_device *dev = litest_current_device(); |
| 6114 |
struct libinput *li = dev->libinput; |
| 6115 |
struct axis_replacement axes[] = { |
| 6116 |
{ ABS_MT_PRESSURE, 5 }, |
| 6117 |
{ ABS_PRESSURE, 5 }, |
| 6118 |
{ -1, 0 }, |
| 6119 |
}; |
| 6120 |
|
| 6121 |
if (!touchpad_has_pressure(dev)) |
| 6122 |
return LITEST_NOT_APPLICABLE; |
| 6123 |
|
| 6124 |
/* This is a bit of a weird test. We expect two fingers to be down as |
| 6125 |
* soon as doubletap is set, regardless of pressure. But we don't |
| 6126 |
* have 2fg scrolling on st devices and 2 fingers down on a touchpad |
| 6127 |
* without 2fg scrolling simply does not generate events. But that's |
| 6128 |
* the same result as if the fingers were ignored because of |
| 6129 |
* pressure and we cannot know the difference. |
| 6130 |
* So this test only keeps your CPU warm, not much else. |
| 6131 |
*/ |
| 6132 |
litest_drain_events(li); |
| 6133 |
|
| 6134 |
litest_touch_down_extended(dev, 0, 50, 50, axes); |
| 6135 |
litest_dispatch(li); |
| 6136 |
litest_event(dev, EV_KEY, BTN_TOOL_FINGER, 0); |
| 6137 |
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); |
| 6138 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 6139 |
litest_dispatch(li); |
| 6140 |
litest_touch_move_to_extended(dev, 0, 50, 50, 80, 80, axes, 10); |
| 6141 |
litest_assert_empty_queue(li); |
| 6142 |
} |
| 6143 |
END_TEST |
| 6144 |
|
| 6145 |
START_TEST(touchpad_pressure_tap) |
| 6146 |
{ |
| 6147 |
struct litest_device *dev = litest_current_device(); |
| 6148 |
struct libinput *li = dev->libinput; |
| 6149 |
struct axis_replacement axes[] = { |
| 6150 |
{ ABS_MT_PRESSURE, 5 }, |
| 6151 |
{ ABS_PRESSURE, 5 }, |
| 6152 |
{ -1, 0 }, |
| 6153 |
}; |
| 6154 |
|
| 6155 |
if (!touchpad_has_pressure(dev)) |
| 6156 |
return LITEST_NOT_APPLICABLE; |
| 6157 |
|
| 6158 |
litest_enable_tap(dev->libinput_device); |
| 6159 |
litest_disable_hold_gestures(dev->libinput_device); |
| 6160 |
litest_drain_events(li); |
| 6161 |
|
| 6162 |
litest_touch_down_extended(dev, 0, 50, 50, axes); |
| 6163 |
litest_dispatch(li); |
| 6164 |
litest_touch_up(dev, 0); |
| 6165 |
litest_assert_empty_queue(li); |
| 6166 |
} |
| 6167 |
END_TEST |
| 6168 |
|
| 6169 |
START_TEST(touchpad_pressure_tap_2fg) |
| 6170 |
{ |
| 6171 |
struct litest_device *dev = litest_current_device(); |
| 6172 |
struct libinput *li = dev->libinput; |
| 6173 |
struct axis_replacement axes[] = { |
| 6174 |
{ ABS_MT_PRESSURE, 5 }, |
| 6175 |
{ ABS_PRESSURE, 5 }, |
| 6176 |
{ -1, 0 }, |
| 6177 |
}; |
| 6178 |
|
| 6179 |
if (!touchpad_has_pressure(dev)) |
| 6180 |
return LITEST_NOT_APPLICABLE; |
| 6181 |
|
| 6182 |
litest_enable_tap(dev->libinput_device); |
| 6183 |
litest_disable_hold_gestures(dev->libinput_device); |
| 6184 |
litest_drain_events(li); |
| 6185 |
|
| 6186 |
/* tap but too light */ |
| 6187 |
litest_touch_down_extended(dev, 0, 40, 50, axes); |
| 6188 |
litest_touch_down_extended(dev, 1, 50, 50, axes); |
| 6189 |
litest_dispatch(li); |
| 6190 |
litest_touch_up(dev, 0); |
| 6191 |
litest_touch_up(dev, 1); |
| 6192 |
litest_assert_empty_queue(li); |
| 6193 |
} |
| 6194 |
END_TEST |
| 6195 |
|
| 6196 |
START_TEST(touchpad_pressure_tap_2fg_1fg_light) |
| 6197 |
{ |
| 6198 |
struct litest_device *dev = litest_current_device(); |
| 6199 |
struct libinput *li = dev->libinput; |
| 6200 |
struct libinput_event *event; |
| 6201 |
struct axis_replacement axes[] = { |
| 6202 |
{ ABS_MT_PRESSURE, 5 }, |
| 6203 |
{ ABS_PRESSURE, 5 }, |
| 6204 |
{ -1, 0 }, |
| 6205 |
}; |
| 6206 |
|
| 6207 |
if (!touchpad_has_pressure(dev)) |
| 6208 |
return LITEST_NOT_APPLICABLE; |
| 6209 |
|
| 6210 |
litest_enable_tap(dev->libinput_device); |
| 6211 |
litest_disable_hold_gestures(dev->libinput_device); |
| 6212 |
litest_drain_events(li); |
| 6213 |
|
| 6214 |
/* double-tap with one finger too light */ |
| 6215 |
litest_touch_down(dev, 0, 40, 50); |
| 6216 |
litest_touch_down_extended(dev, 1, 50, 50, axes); |
| 6217 |
litest_dispatch(li); |
| 6218 |
litest_touch_up(dev, 0); |
| 6219 |
litest_touch_up(dev, 1); |
| 6220 |
litest_dispatch(li); |
| 6221 |
|
| 6222 |
event = libinput_get_event(li); |
| 6223 |
litest_is_button_event(event, BTN_LEFT, LIBINPUT_BUTTON_STATE_PRESSED); |
| 6224 |
libinput_event_destroy(event); |
| 6225 |
|
| 6226 |
litest_timeout_tap(li); |
| 6227 |
|
| 6228 |
event = libinput_get_event(li); |
| 6229 |
litest_is_button_event(event, BTN_LEFT, LIBINPUT_BUTTON_STATE_RELEASED); |
| 6230 |
libinput_event_destroy(event); |
| 6231 |
} |
| 6232 |
END_TEST |
| 6233 |
|
| 6234 |
START_TEST(touchpad_pressure_btntool) |
| 6235 |
{ |
| 6236 |
struct litest_device *dev = litest_current_device(); |
| 6237 |
struct libinput *li = dev->libinput; |
| 6238 |
struct axis_replacement axes[] = { |
| 6239 |
{ ABS_MT_PRESSURE, 5 }, |
| 6240 |
{ ABS_PRESSURE, 5 }, |
| 6241 |
{ -1, 0 }, |
| 6242 |
}; |
| 6243 |
|
| 6244 |
/* we only have tripletap, can't test 4 slots because nothing will |
| 6245 |
* happen */ |
| 6246 |
if (libevdev_get_num_slots(dev->evdev) != 2) |
| 6247 |
return LITEST_NOT_APPLICABLE; |
| 6248 |
|
| 6249 |
if (!touchpad_has_pressure(dev)) |
| 6250 |
return LITEST_NOT_APPLICABLE; |
| 6251 |
|
| 6252 |
litest_enable_tap(dev->libinput_device); |
| 6253 |
litest_disable_hold_gestures(dev->libinput_device); |
| 6254 |
litest_drain_events(li); |
| 6255 |
|
| 6256 |
/* Two light touches down, doesn't count */ |
| 6257 |
litest_touch_down_extended(dev, 0, 40, 50, axes); |
| 6258 |
litest_touch_down_extended(dev, 1, 45, 50, axes); |
| 6259 |
litest_dispatch(li); |
| 6260 |
litest_assert_empty_queue(li); |
| 6261 |
|
| 6262 |
/* Tripletap but since no finger is logically down, it doesn't count */ |
| 6263 |
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); |
| 6264 |
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); |
| 6265 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 6266 |
litest_assert_empty_queue(li); |
| 6267 |
|
| 6268 |
/* back to two fingers */ |
| 6269 |
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); |
| 6270 |
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); |
| 6271 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 6272 |
litest_dispatch(li); |
| 6273 |
|
| 6274 |
/* make one finger real */ |
| 6275 |
litest_touch_move(dev, 0, 40, 50); |
| 6276 |
litest_drain_events(li); |
| 6277 |
|
| 6278 |
/* tripletap should now be 3 fingers tap */ |
| 6279 |
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0); |
| 6280 |
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1); |
| 6281 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 6282 |
litest_dispatch(li); |
| 6283 |
|
| 6284 |
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 1); |
| 6285 |
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 0); |
| 6286 |
litest_event(dev, EV_SYN, SYN_REPORT, 0); |
| 6287 |
|
| 6288 |
litest_timeout_tap(li); |
| 6289 |
|
| 6290 |
litest_assert_button_event(li, BTN_MIDDLE, LIBINPUT_BUTTON_STATE_PRESSED); |
| 6291 |
litest_assert_button_event(li, BTN_MIDDLE, LIBINPUT_BUTTON_STATE_RELEASED); |
| 6292 |
} |
| 6293 |
END_TEST |
| 6294 |
|
| 6295 |
START_TEST(touchpad_pressure_semi_mt_2fg_goes_light) |
| 6296 |
{ |
| 6297 |
struct litest_device *dev = litest_current_device(); |
| 6298 |
struct libinput *li = dev->libinput; |
| 6299 |
struct axis_replacement axes[] = { |
| 6300 |
{ ABS_PRESSURE, 2 }, |
| 6301 |
{ -1, 0 }, |
| 6302 |
}; |
| 6303 |
|
| 6304 |
litest_enable_2fg_scroll(dev); |
| 6305 |
litest_drain_events(li); |
| 6306 |
|
| 6307 |
litest_touch_down(dev, 0, 40, 50); |
| 6308 |
litest_touch_down(dev, 1, 60, 50); |
| 6309 |
litest_touch_move_two_touches(dev, 40, 50, 60, 50, 0, -20, 10); |
| 6310 |
|
| 6311 |
/* This should trigger a scroll end event */ |
| 6312 |
litest_push_event_frame(dev); |
| 6313 |
litest_touch_move_extended(dev, 0, 40, 31, axes); |
| 6314 |
litest_touch_move_extended(dev, 1, 60, 31, axes); |
| 6315 |
litest_pop_event_frame(dev); |
| 6316 |
litest_dispatch(li); |
| 6317 |
|
| 6318 |
litest_assert_scroll(li, |
| 6319 |
LIBINPUT_EVENT_POINTER_SCROLL_FINGER, |
| 6320 |
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL, |
| 6321 |
0); |
| 6322 |
|
| 6323 |
litest_push_event_frame(dev); |
| 6324 |
litest_touch_move_extended(dev, 0, 40, 35, axes); |
| 6325 |
litest_touch_move_extended(dev, 1, 60, 35, axes); |
| 6326 |
litest_pop_event_frame(dev); |
| 6327 |
|
| 6328 |
litest_push_event_frame(dev); |
| 6329 |
litest_touch_move_extended(dev, 0, 40, 40, axes); |
| 6330 |
litest_touch_move_extended(dev, 1, 60, 40, axes); |
| 6331 |
litest_pop_event_frame(dev); |
| 6332 |
litest_dispatch(li); |
| 6333 |
litest_assert_empty_queue(li); |
| 6334 |
} |
| 6335 |
END_TEST |
| 6336 |
|
| 6337 |
START_TEST(touchpad_touch_size) |
| 6338 |
{ |
| 6339 |
struct litest_device *dev = litest_current_device(); |
| 6340 |
struct libinput *li = dev->libinput; |
| 6341 |
struct axis_replacement axes[] = { |
| 6342 |
{ ABS_MT_TOUCH_MAJOR, 0 }, |
| 6343 |
{ ABS_MT_TOUCH_MINOR, 0 }, |
| 6344 |
{ ABS_MT_ORIENTATION, 0 }, |
| 6345 |
{ -1, 0 }, |
| 6346 |
}; |
| 6347 |
|
| 6348 |
if (!touchpad_has_touch_size(dev)) |
| 6349 |
return LITEST_NOT_APPLICABLE; |
| 6350 |
|
| 6351 |
litest_drain_events(li); |
| 6352 |
|
| 6353 |
litest_axis_set_value(axes, ABS_MT_TOUCH_MAJOR, 1); |
| 6354 |
litest_axis_set_value(axes, ABS_MT_TOUCH_MINOR, 1); |
| 6355 |
litest_touch_down_extended(dev, 0, 50, 50, axes); |
| 6356 |
litest_touch_move_to_extended(dev, 0, 50, 50, 80, 80, axes, 10); |
| 6357 |
litest_touch_up(dev, 0); |
| 6358 |
litest_assert_empty_queue(li); |
| 6359 |
|
| 6360 |
litest_axis_set_value(axes, ABS_MT_TOUCH_MAJOR, 15); |
| 6361 |
litest_axis_set_value(axes, ABS_MT_TOUCH_MINOR, 15); |
| 6362 |
litest_touch_down_extended(dev, 0, 50, 50, axes); |
| 6363 |
litest_touch_move_to_extended(dev, 0, 50, 50, 80, 80, axes, 10); |
| 6364 |
litest_touch_up(dev, 0); |
| 6365 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 6366 |
} |
| 6367 |
END_TEST |
| 6368 |
|
| 6369 |
START_TEST(touchpad_touch_size_2fg) |
| 6370 |
{ |
| 6371 |
struct litest_device *dev = litest_current_device(); |
| 6372 |
struct libinput *li = dev->libinput; |
| 6373 |
struct axis_replacement axes[] = { |
| 6374 |
{ ABS_MT_TOUCH_MAJOR, 0 }, |
| 6375 |
{ ABS_MT_TOUCH_MINOR, 0 }, |
| 6376 |
{ ABS_MT_ORIENTATION, 0 }, |
| 6377 |
{ -1, 0 }, |
| 6378 |
}; |
| 6379 |
|
| 6380 |
if (!touchpad_has_touch_size(dev)) |
| 6381 |
return LITEST_NOT_APPLICABLE; |
| 6382 |
|
| 6383 |
litest_drain_events(li); |
| 6384 |
litest_axis_set_value(axes, ABS_MT_TOUCH_MAJOR, 15); |
| 6385 |
litest_axis_set_value(axes, ABS_MT_TOUCH_MINOR, 15); |
| 6386 |
litest_touch_down_extended(dev, 0, 50, 50, axes); |
| 6387 |
litest_touch_move_to_extended(dev, 0, 50, 50, 80, 80, axes, 10); |
| 6388 |
|
| 6389 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 6390 |
|
| 6391 |
litest_axis_set_value(axes, ABS_MT_TOUCH_MAJOR, 1); |
| 6392 |
litest_axis_set_value(axes, ABS_MT_TOUCH_MINOR, 1); |
| 6393 |
litest_touch_down_extended(dev, 1, 70, 70, axes); |
| 6394 |
litest_touch_move_to_extended(dev, 1, 70, 70, 80, 90, axes, 10); |
| 6395 |
litest_assert_empty_queue(li); |
| 6396 |
|
| 6397 |
litest_axis_set_value(axes, ABS_MT_TOUCH_MAJOR, 15); |
| 6398 |
litest_axis_set_value(axes, ABS_MT_TOUCH_MINOR, 15); |
| 6399 |
litest_touch_move_to_extended(dev, 0, 80, 80, 50, 50, axes, 10); |
| 6400 |
|
| 6401 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 6402 |
|
| 6403 |
litest_touch_up(dev, 1); |
| 6404 |
litest_touch_up(dev, 0); |
| 6405 |
} |
| 6406 |
END_TEST |
| 6407 |
|
| 6408 |
START_TEST(touchpad_palm_detect_touch_size) |
| 6409 |
{ |
| 6410 |
struct litest_device *dev = litest_current_device(); |
| 6411 |
struct libinput *li = dev->libinput; |
| 6412 |
struct axis_replacement axes[] = { |
| 6413 |
{ ABS_MT_TOUCH_MAJOR, 0 }, |
| 6414 |
{ ABS_MT_TOUCH_MINOR, 0 }, |
| 6415 |
{ -1, 0 }, |
| 6416 |
}; |
| 6417 |
|
| 6418 |
if (!touchpad_has_touch_size(dev) || litest_touchpad_is_external(dev)) |
| 6419 |
return LITEST_NOT_APPLICABLE; |
| 6420 |
|
| 6421 |
litest_drain_events(li); |
| 6422 |
|
| 6423 |
/* apply insufficient pressure */ |
| 6424 |
litest_axis_set_value(axes, ABS_MT_TOUCH_MAJOR, 30); |
| 6425 |
litest_axis_set_value(axes, ABS_MT_TOUCH_MINOR, 30); |
| 6426 |
litest_touch_down_extended(dev, 0, 50, 50, axes); |
| 6427 |
litest_touch_move_to_extended(dev, 0, 50, 50, 80, 80, axes, 10); |
| 6428 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 6429 |
|
| 6430 |
/* apply sufficient pressure */ |
| 6431 |
litest_axis_set_value_unchecked(axes, ABS_MT_TOUCH_MAJOR, 90); |
| 6432 |
litest_axis_set_value(axes, ABS_MT_TOUCH_MINOR, 90); |
| 6433 |
litest_touch_move_to_extended(dev, 0, 80, 80, 50, 50, axes, 10); |
| 6434 |
litest_assert_empty_queue(li); |
| 6435 |
} |
| 6436 |
END_TEST |
| 6437 |
|
| 6438 |
START_TEST(touchpad_palm_detect_touch_size_late) |
| 6439 |
{ |
| 6440 |
struct litest_device *dev = litest_current_device(); |
| 6441 |
struct libinput *li = dev->libinput; |
| 6442 |
struct axis_replacement axes[] = { |
| 6443 |
{ ABS_MT_TOUCH_MAJOR, 0 }, |
| 6444 |
{ ABS_MT_TOUCH_MINOR, 0 }, |
| 6445 |
{ -1, 0 }, |
| 6446 |
}; |
| 6447 |
|
| 6448 |
if (!touchpad_has_touch_size(dev) || litest_touchpad_is_external(dev)) |
| 6449 |
return LITEST_NOT_APPLICABLE; |
| 6450 |
|
| 6451 |
litest_drain_events(li); |
| 6452 |
|
| 6453 |
/* apply insufficient pressure */ |
| 6454 |
litest_axis_set_value(axes, ABS_MT_TOUCH_MAJOR, 30); |
| 6455 |
litest_axis_set_value(axes, ABS_MT_TOUCH_MINOR, 30); |
| 6456 |
litest_touch_down(dev, 0, 50, 50); |
| 6457 |
litest_touch_move_to(dev, 0, 50, 70, 80, 90, 10); |
| 6458 |
litest_drain_events(li); |
| 6459 |
litest_dispatch(li); |
| 6460 |
litest_touch_move_to_extended(dev, 0, 80, 90, 50, 20, axes, 10); |
| 6461 |
litest_touch_up(dev, 0); |
| 6462 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 6463 |
|
| 6464 |
/* apply sufficient pressure */ |
| 6465 |
litest_axis_set_value_unchecked(axes, ABS_MT_TOUCH_MAJOR, 90); |
| 6466 |
litest_axis_set_value(axes, ABS_MT_TOUCH_MINOR, 90); |
| 6467 |
litest_touch_down(dev, 0, 50, 50); |
| 6468 |
litest_touch_move_to(dev, 0, 50, 70, 80, 90, 10); |
| 6469 |
litest_drain_events(li); |
| 6470 |
litest_dispatch(li); |
| 6471 |
litest_touch_move_to_extended(dev, 0, 80, 90, 50, 20, axes, 10); |
| 6472 |
litest_touch_up(dev, 0); |
| 6473 |
litest_assert_empty_queue(li); |
| 6474 |
} |
| 6475 |
END_TEST |
| 6476 |
|
| 6477 |
START_TEST(touchpad_palm_detect_touch_size_keep_palm) |
| 6478 |
{ |
| 6479 |
struct litest_device *dev = litest_current_device(); |
| 6480 |
struct libinput *li = dev->libinput; |
| 6481 |
struct axis_replacement axes[] = { |
| 6482 |
{ ABS_MT_TOUCH_MAJOR, 0 }, |
| 6483 |
{ ABS_MT_TOUCH_MINOR, 0 }, |
| 6484 |
{ -1, 0 }, |
| 6485 |
}; |
| 6486 |
|
| 6487 |
if (!touchpad_has_touch_size(dev) || litest_touchpad_is_external(dev)) |
| 6488 |
return LITEST_NOT_APPLICABLE; |
| 6489 |
|
| 6490 |
litest_drain_events(li); |
| 6491 |
|
| 6492 |
/* apply insufficient pressure */ |
| 6493 |
litest_axis_set_value(axes, ABS_MT_TOUCH_MAJOR, 30); |
| 6494 |
litest_axis_set_value(axes, ABS_MT_TOUCH_MINOR, 30); |
| 6495 |
litest_touch_down(dev, 0, 80, 90); |
| 6496 |
litest_touch_move_to_extended(dev, 0, 80, 90, 50, 20, axes, 10); |
| 6497 |
litest_touch_move_to(dev, 0, 50, 20, 80, 90, 10); |
| 6498 |
litest_touch_up(dev, 0); |
| 6499 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 6500 |
|
| 6501 |
/* apply sufficient pressure */ |
| 6502 |
litest_axis_set_value_unchecked(axes, ABS_MT_TOUCH_MAJOR, 90); |
| 6503 |
litest_axis_set_value(axes, ABS_MT_TOUCH_MINOR, 90); |
| 6504 |
litest_touch_down(dev, 0, 80, 90); |
| 6505 |
litest_touch_move_to_extended(dev, 0, 80, 90, 50, 20, axes, 10); |
| 6506 |
litest_touch_move_to(dev, 0, 50, 20, 80, 90, 10); |
| 6507 |
litest_touch_up(dev, 0); |
| 6508 |
litest_assert_empty_queue(li); |
| 6509 |
} |
| 6510 |
END_TEST |
| 6511 |
|
| 6512 |
START_TEST(touchpad_palm_detect_touch_size_after_edge) |
| 6513 |
{ |
| 6514 |
struct litest_device *dev = litest_current_device(); |
| 6515 |
struct libinput *li = dev->libinput; |
| 6516 |
struct axis_replacement axes[] = { |
| 6517 |
{ ABS_MT_TOUCH_MAJOR, 0 }, |
| 6518 |
{ ABS_MT_TOUCH_MINOR, 0 }, |
| 6519 |
{ -1, 0 }, |
| 6520 |
}; |
| 6521 |
|
| 6522 |
if (!touchpad_has_touch_size(dev) || litest_touchpad_is_external(dev) || |
| 6523 |
!litest_has_palm_detect_size(dev) || !litest_has_2fg_scroll(dev)) |
| 6524 |
return LITEST_NOT_APPLICABLE; |
| 6525 |
|
| 6526 |
litest_enable_2fg_scroll(dev); |
| 6527 |
litest_drain_events(li); |
| 6528 |
|
| 6529 |
/* apply sufficient pressure */ |
| 6530 |
litest_axis_set_value_unchecked(axes, ABS_MT_TOUCH_MAJOR, 90); |
| 6531 |
litest_axis_set_value(axes, ABS_MT_TOUCH_MINOR, 90); |
| 6532 |
litest_touch_down(dev, 0, 99, 50); |
| 6533 |
litest_touch_move_to_extended(dev, 0, 99, 50, 20, 50, axes, 20); |
| 6534 |
litest_touch_up(dev, 0); |
| 6535 |
litest_dispatch(li); |
| 6536 |
|
| 6537 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 6538 |
} |
| 6539 |
END_TEST |
| 6540 |
|
| 6541 |
START_TEST(touchpad_palm_detect_touch_size_after_dwt) |
| 6542 |
{ |
| 6543 |
struct litest_device *touchpad = litest_current_device(); |
| 6544 |
struct litest_device *keyboard; |
| 6545 |
struct libinput *li = touchpad->libinput; |
| 6546 |
struct axis_replacement axes[] = { |
| 6547 |
{ ABS_MT_TOUCH_MAJOR, 0 }, |
| 6548 |
{ ABS_MT_TOUCH_MINOR, 0 }, |
| 6549 |
{ -1, 0 }, |
| 6550 |
}; |
| 6551 |
|
| 6552 |
if (!touchpad_has_touch_size(touchpad) || litest_touchpad_is_external(touchpad)) |
| 6553 |
return LITEST_NOT_APPLICABLE; |
| 6554 |
|
| 6555 |
keyboard = dwt_init_paired_keyboard(li, touchpad); |
| 6556 |
litest_drain_events(li); |
| 6557 |
|
| 6558 |
litest_keyboard_key(keyboard, KEY_A, true); |
| 6559 |
litest_keyboard_key(keyboard, KEY_A, false); |
| 6560 |
litest_drain_events(li); |
| 6561 |
|
| 6562 |
/* apply sufficient pressure */ |
| 6563 |
litest_axis_set_value(axes, ABS_MT_TOUCH_MAJOR, 90); |
| 6564 |
litest_axis_set_value(axes, ABS_MT_TOUCH_MINOR, 90); |
| 6565 |
|
| 6566 |
/* within dwt timeout, dwt blocks events */ |
| 6567 |
litest_touch_down(touchpad, 0, 50, 50); |
| 6568 |
litest_touch_move_to_extended(touchpad, 0, 50, 50, 20, 50, axes, 20); |
| 6569 |
litest_assert_empty_queue(li); |
| 6570 |
|
| 6571 |
litest_timeout_dwt_short(li); |
| 6572 |
litest_dispatch(li); |
| 6573 |
litest_assert_empty_queue(li); |
| 6574 |
|
| 6575 |
/* after dwt timeout, pressure blocks events */ |
| 6576 |
litest_touch_move_to_extended(touchpad, 0, 20, 50, 50, 50, axes, 20); |
| 6577 |
litest_touch_up(touchpad, 0); |
| 6578 |
|
| 6579 |
litest_assert_empty_queue(li); |
| 6580 |
|
| 6581 |
litest_device_destroy(keyboard); |
| 6582 |
} |
| 6583 |
END_TEST |
| 6584 |
|
| 6585 |
START_TEST(touchpad_speed_ignore_finger) |
| 6586 |
{ |
| 6587 |
struct litest_device *dev = litest_current_device(); |
| 6588 |
struct libinput *li = dev->libinput; |
| 6589 |
|
| 6590 |
if (!has_thumb_detect(dev)) |
| 6591 |
return LITEST_NOT_APPLICABLE; |
| 6592 |
|
| 6593 |
if (litest_has_clickfinger(dev)) |
| 6594 |
litest_enable_clickfinger(dev); |
| 6595 |
|
| 6596 |
litest_drain_events(li); |
| 6597 |
|
| 6598 |
litest_touch_down(dev, 0, 20, 20); |
| 6599 |
litest_touch_move_to(dev, 0, 20, 20, 85, 80, 20); |
| 6600 |
litest_touch_down(dev, 1, 20, 80); |
| 6601 |
litest_touch_move_two_touches(dev, 85, 80, 20, 80, -20, -20, 10); |
| 6602 |
litest_dispatch(li); |
| 6603 |
|
| 6604 |
litest_touch_up(dev, 0); |
| 6605 |
litest_touch_up(dev, 1); |
| 6606 |
|
| 6607 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 6608 |
} |
| 6609 |
END_TEST |
| 6610 |
|
| 6611 |
START_TEST(touchpad_speed_allow_nearby_finger) |
| 6612 |
{ |
| 6613 |
struct litest_device *dev = litest_current_device(); |
| 6614 |
struct libinput *li = dev->libinput; |
| 6615 |
|
| 6616 |
if (!has_thumb_detect(dev)) |
| 6617 |
return LITEST_NOT_APPLICABLE; |
| 6618 |
|
| 6619 |
if (!litest_has_2fg_scroll(dev)) |
| 6620 |
return LITEST_NOT_APPLICABLE; |
| 6621 |
|
| 6622 |
if (litest_has_clickfinger(dev)) |
| 6623 |
litest_enable_clickfinger(dev); |
| 6624 |
|
| 6625 |
litest_enable_2fg_scroll(dev); |
| 6626 |
|
| 6627 |
litest_drain_events(li); |
| 6628 |
|
| 6629 |
litest_touch_down(dev, 0, 20, 20); |
| 6630 |
litest_touch_move_to(dev, 0, 20, 20, 80, 80, 20); |
| 6631 |
litest_drain_events(li); |
| 6632 |
litest_touch_down(dev, 1, 79, 80); |
| 6633 |
litest_touch_move_two_touches(dev, 80, 80, 79, 80, -20, -20, 10); |
| 6634 |
litest_dispatch(li); |
| 6635 |
|
| 6636 |
litest_touch_up(dev, 0); |
| 6637 |
litest_touch_up(dev, 1); |
| 6638 |
|
| 6639 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 6640 |
} |
| 6641 |
END_TEST |
| 6642 |
|
| 6643 |
START_TEST(touchpad_speed_ignore_finger_edgescroll) |
| 6644 |
{ |
| 6645 |
struct litest_device *dev = litest_current_device(); |
| 6646 |
struct libinput *li = dev->libinput; |
| 6647 |
|
| 6648 |
if (!has_thumb_detect(dev)) |
| 6649 |
return LITEST_NOT_APPLICABLE; |
| 6650 |
|
| 6651 |
litest_enable_edge_scroll(dev); |
| 6652 |
if (litest_has_clickfinger(dev)) |
| 6653 |
litest_enable_clickfinger(dev); |
| 6654 |
|
| 6655 |
litest_drain_events(li); |
| 6656 |
|
| 6657 |
litest_touch_down(dev, 0, 20, 20); |
| 6658 |
litest_touch_move_to(dev, 0, 20, 20, 60, 80, 20); |
| 6659 |
litest_drain_events(li); |
| 6660 |
litest_touch_down(dev, 1, 59, 80); |
| 6661 |
litest_touch_move_two_touches(dev, 60, 80, 59, 80, -20, -20, 10); |
| 6662 |
litest_dispatch(li); |
| 6663 |
|
| 6664 |
litest_touch_up(dev, 0); |
| 6665 |
litest_dispatch(li); |
| 6666 |
litest_touch_up(dev, 1); |
| 6667 |
|
| 6668 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 6669 |
} |
| 6670 |
END_TEST |
| 6671 |
|
| 6672 |
START_TEST(touchpad_speed_ignore_hovering_finger) |
| 6673 |
{ |
| 6674 |
struct litest_device *dev = litest_current_device(); |
| 6675 |
struct libinput *li = dev->libinput; |
| 6676 |
struct axis_replacement axes[] = { |
| 6677 |
{ ABS_MT_TOUCH_MAJOR, 1 }, |
| 6678 |
{ ABS_MT_TOUCH_MINOR, 1 }, |
| 6679 |
{ -1, 0 }, |
| 6680 |
}; |
| 6681 |
|
| 6682 |
if (!has_thumb_detect(dev)) |
| 6683 |
return LITEST_NOT_APPLICABLE; |
| 6684 |
|
| 6685 |
litest_drain_events(li); |
| 6686 |
|
| 6687 |
/* first finger down but below touch size. we use slot 2 because |
| 6688 |
* it's easier this way for litest */ |
| 6689 |
litest_touch_down_extended(dev, 2, 20, 20, axes); |
| 6690 |
litest_touch_move_to_extended(dev, 2, 20, 20, 60, 80, axes, 20); |
| 6691 |
litest_drain_events(li); |
| 6692 |
|
| 6693 |
/* second, third finger down withn same frame */ |
| 6694 |
litest_push_event_frame(dev); |
| 6695 |
litest_touch_down(dev, 0, 59, 70); |
| 6696 |
litest_touch_down(dev, 1, 65, 70); |
| 6697 |
litest_pop_event_frame(dev); |
| 6698 |
|
| 6699 |
litest_touch_move_two_touches(dev, 59, 70, 65, 70, 0, 30, 10); |
| 6700 |
litest_dispatch(li); |
| 6701 |
|
| 6702 |
litest_touch_up(dev, 2); |
| 6703 |
litest_dispatch(li); |
| 6704 |
litest_touch_up(dev, 1); |
| 6705 |
litest_touch_up(dev, 0); |
| 6706 |
|
| 6707 |
litest_assert_only_axis_events(li, LIBINPUT_EVENT_POINTER_SCROLL_FINGER); |
| 6708 |
} |
| 6709 |
END_TEST |
| 6710 |
|
| 6711 |
enum suspend { |
| 6712 |
SUSPEND_EXT_MOUSE = 1, |
| 6713 |
SUSPEND_SENDEVENTS, |
| 6714 |
SUSPEND_LID, |
| 6715 |
SUSPEND_TABLETMODE, |
| 6716 |
SUSPEND_COUNT, |
| 6717 |
}; |
| 6718 |
|
| 6719 |
static void |
| 6720 |
assert_touchpad_moves(struct litest_device *tp) |
| 6721 |
{ |
| 6722 |
struct libinput *li = tp->libinput; |
| 6723 |
|
| 6724 |
litest_touch_down(tp, 0, 50, 50); |
| 6725 |
litest_touch_move_to(tp, 0, 50, 50, 60, 80, 20); |
| 6726 |
litest_touch_up(tp, 0); |
| 6727 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 6728 |
} |
| 6729 |
|
| 6730 |
static void |
| 6731 |
assert_touchpad_does_not_move(struct litest_device *tp) |
| 6732 |
{ |
| 6733 |
struct libinput *li = tp->libinput; |
| 6734 |
|
| 6735 |
litest_touch_down(tp, 0, 20, 20); |
| 6736 |
litest_touch_move_to(tp, 0, 20, 20, 60, 80, 20); |
| 6737 |
litest_touch_up(tp, 0); |
| 6738 |
litest_assert_empty_queue(li); |
| 6739 |
} |
| 6740 |
|
| 6741 |
START_TEST(touchpad_suspend_abba) |
| 6742 |
{ |
| 6743 |
struct litest_device *tp = litest_current_device(); |
| 6744 |
struct litest_device *lid, *tabletmode, *extmouse; |
| 6745 |
struct libinput *li = tp->libinput; |
| 6746 |
enum suspend first = litest_test_param_get_i32(test_env->params, "mode"); |
| 6747 |
|
| 6748 |
if (first == SUSPEND_EXT_MOUSE && litest_touchpad_is_external(tp)) |
| 6749 |
return LITEST_NOT_APPLICABLE; |
| 6750 |
|
| 6751 |
lid = litest_add_device(li, LITEST_LID_SWITCH); |
| 6752 |
tabletmode = litest_add_device(li, LITEST_THINKPAD_EXTRABUTTONS); |
| 6753 |
extmouse = litest_add_device(li, LITEST_MOUSE); |
| 6754 |
|
| 6755 |
litest_grab_device(lid); |
| 6756 |
litest_grab_device(tabletmode); |
| 6757 |
|
| 6758 |
litest_disable_tap(tp->libinput_device); |
| 6759 |
litest_disable_hold_gestures(tp->libinput_device); |
| 6760 |
|
| 6761 |
/* ABBA test for touchpad internal suspend: |
| 6762 |
* reason A on |
| 6763 |
* reason B on |
| 6764 |
* reason B off |
| 6765 |
* reason A off |
| 6766 |
*/ |
| 6767 |
for (enum suspend other = SUSPEND_EXT_MOUSE; other < SUSPEND_COUNT; other++) { |
| 6768 |
if (other == first) |
| 6769 |
continue; |
| 6770 |
|
| 6771 |
if (other == SUSPEND_EXT_MOUSE && litest_touchpad_is_external(tp)) |
| 6772 |
goto out; |
| 6773 |
|
| 6774 |
/* That transition is tested elsewhere and has a different |
| 6775 |
* behavior */ |
| 6776 |
if ((other == SUSPEND_SENDEVENTS && first == SUSPEND_EXT_MOUSE) || |
| 6777 |
(first == SUSPEND_SENDEVENTS && other == SUSPEND_EXT_MOUSE)) |
| 6778 |
continue; |
| 6779 |
|
| 6780 |
litest_drain_events(li); |
| 6781 |
assert_touchpad_moves(tp); |
| 6782 |
|
| 6783 |
/* First reason for suspend: on */ |
| 6784 |
switch (first) { |
| 6785 |
case SUSPEND_EXT_MOUSE: |
| 6786 |
litest_sendevents_ext_mouse(tp); |
| 6787 |
break; |
| 6788 |
case SUSPEND_TABLETMODE: |
| 6789 |
litest_switch_action(tabletmode, |
| 6790 |
LIBINPUT_SWITCH_TABLET_MODE, |
| 6791 |
LIBINPUT_SWITCH_STATE_ON); |
| 6792 |
break; |
| 6793 |
case SUSPEND_LID: |
| 6794 |
litest_switch_action(lid, |
| 6795 |
LIBINPUT_SWITCH_LID, |
| 6796 |
LIBINPUT_SWITCH_STATE_ON); |
| 6797 |
break; |
| 6798 |
case SUSPEND_SENDEVENTS: |
| 6799 |
litest_sendevents_off(tp); |
| 6800 |
break; |
| 6801 |
default: |
| 6802 |
litest_abort_msg("Unexpected suspend option"); |
| 6803 |
} |
| 6804 |
|
| 6805 |
litest_drain_events(li); |
| 6806 |
|
| 6807 |
assert_touchpad_does_not_move(tp); |
| 6808 |
|
| 6809 |
/* Second reason to suspend: on/off while first reason remains */ |
| 6810 |
switch (other) { |
| 6811 |
case SUSPEND_EXT_MOUSE: |
| 6812 |
litest_sendevents_ext_mouse(tp); |
| 6813 |
litest_sendevents_on(tp); |
| 6814 |
break; |
| 6815 |
case SUSPEND_LID: |
| 6816 |
litest_switch_action(lid, |
| 6817 |
LIBINPUT_SWITCH_LID, |
| 6818 |
LIBINPUT_SWITCH_STATE_ON); |
| 6819 |
litest_drain_events(li); |
| 6820 |
litest_switch_action(lid, |
| 6821 |
LIBINPUT_SWITCH_LID, |
| 6822 |
LIBINPUT_SWITCH_STATE_OFF); |
| 6823 |
litest_drain_events(li); |
| 6824 |
break; |
| 6825 |
case SUSPEND_TABLETMODE: |
| 6826 |
litest_switch_action(tabletmode, |
| 6827 |
LIBINPUT_SWITCH_TABLET_MODE, |
| 6828 |
LIBINPUT_SWITCH_STATE_ON); |
| 6829 |
litest_drain_events(li); |
| 6830 |
litest_switch_action(tabletmode, |
| 6831 |
LIBINPUT_SWITCH_TABLET_MODE, |
| 6832 |
LIBINPUT_SWITCH_STATE_OFF); |
| 6833 |
litest_drain_events(li); |
| 6834 |
break; |
| 6835 |
case SUSPEND_SENDEVENTS: |
| 6836 |
litest_sendevents_off(tp); |
| 6837 |
litest_sendevents_on(tp); |
| 6838 |
break; |
| 6839 |
default: |
| 6840 |
litest_abort_msg("Unexpected suspend option"); |
| 6841 |
} |
| 6842 |
|
| 6843 |
assert_touchpad_does_not_move(tp); |
| 6844 |
|
| 6845 |
/* First reason for suspend: off */ |
| 6846 |
switch (first) { |
| 6847 |
case SUSPEND_EXT_MOUSE: |
| 6848 |
litest_sendevents_on(tp); |
| 6849 |
break; |
| 6850 |
case SUSPEND_TABLETMODE: |
| 6851 |
litest_switch_action(tabletmode, |
| 6852 |
LIBINPUT_SWITCH_TABLET_MODE, |
| 6853 |
LIBINPUT_SWITCH_STATE_OFF); |
| 6854 |
break; |
| 6855 |
case SUSPEND_LID: |
| 6856 |
litest_switch_action(lid, |
| 6857 |
LIBINPUT_SWITCH_LID, |
| 6858 |
LIBINPUT_SWITCH_STATE_OFF); |
| 6859 |
break; |
| 6860 |
case SUSPEND_SENDEVENTS: |
| 6861 |
litest_sendevents_on(tp); |
| 6862 |
break; |
| 6863 |
default: |
| 6864 |
litest_abort_msg("Unexpected suspend option"); |
| 6865 |
} |
| 6866 |
|
| 6867 |
litest_drain_events(li); |
| 6868 |
assert_touchpad_moves(tp); |
| 6869 |
} |
| 6870 |
|
| 6871 |
out: |
| 6872 |
litest_ungrab_device(lid); |
| 6873 |
litest_ungrab_device(tabletmode); |
| 6874 |
litest_device_destroy(lid); |
| 6875 |
litest_device_destroy(tabletmode); |
| 6876 |
litest_device_destroy(extmouse); |
| 6877 |
} |
| 6878 |
END_TEST |
| 6879 |
|
| 6880 |
START_TEST(touchpad_suspend_abab) |
| 6881 |
{ |
| 6882 |
struct litest_device *tp = litest_current_device(); |
| 6883 |
struct litest_device *lid, *tabletmode, *extmouse; |
| 6884 |
struct libinput *li = tp->libinput; |
| 6885 |
enum suspend first = litest_test_param_get_i32(test_env->params, "mode"); |
| 6886 |
|
| 6887 |
if (first == SUSPEND_EXT_MOUSE && litest_touchpad_is_external(tp)) |
| 6888 |
return LITEST_NOT_APPLICABLE; |
| 6889 |
|
| 6890 |
lid = litest_add_device(li, LITEST_LID_SWITCH); |
| 6891 |
tabletmode = litest_add_device(li, LITEST_THINKPAD_EXTRABUTTONS); |
| 6892 |
extmouse = litest_add_device(li, LITEST_MOUSE); |
| 6893 |
litest_grab_device(lid); |
| 6894 |
litest_grab_device(tabletmode); |
| 6895 |
|
| 6896 |
litest_disable_tap(tp->libinput_device); |
| 6897 |
litest_disable_hold_gestures(tp->libinput_device); |
| 6898 |
|
| 6899 |
/* ABAB test for touchpad internal suspend: |
| 6900 |
* reason A on |
| 6901 |
* reason B on |
| 6902 |
* reason A off |
| 6903 |
* reason B off |
| 6904 |
*/ |
| 6905 |
for (enum suspend other = SUSPEND_EXT_MOUSE; other < SUSPEND_COUNT; other++) { |
| 6906 |
if (other == first) |
| 6907 |
continue; |
| 6908 |
|
| 6909 |
if (other == SUSPEND_EXT_MOUSE && litest_touchpad_is_external(tp)) |
| 6910 |
goto out; |
| 6911 |
|
| 6912 |
/* That transition is tested elsewhere and has a different |
| 6913 |
* behavior */ |
| 6914 |
if ((other == SUSPEND_SENDEVENTS && first == SUSPEND_EXT_MOUSE) || |
| 6915 |
(first == SUSPEND_SENDEVENTS && other == SUSPEND_EXT_MOUSE)) |
| 6916 |
continue; |
| 6917 |
|
| 6918 |
litest_drain_events(li); |
| 6919 |
assert_touchpad_moves(tp); |
| 6920 |
|
| 6921 |
/* First reason for suspend: on */ |
| 6922 |
switch (first) { |
| 6923 |
case SUSPEND_EXT_MOUSE: |
| 6924 |
litest_sendevents_ext_mouse(tp); |
| 6925 |
break; |
| 6926 |
case SUSPEND_TABLETMODE: |
| 6927 |
litest_switch_action(tabletmode, |
| 6928 |
LIBINPUT_SWITCH_TABLET_MODE, |
| 6929 |
LIBINPUT_SWITCH_STATE_ON); |
| 6930 |
break; |
| 6931 |
case SUSPEND_LID: |
| 6932 |
litest_switch_action(lid, |
| 6933 |
LIBINPUT_SWITCH_LID, |
| 6934 |
LIBINPUT_SWITCH_STATE_ON); |
| 6935 |
break; |
| 6936 |
case SUSPEND_SENDEVENTS: |
| 6937 |
litest_sendevents_off(tp); |
| 6938 |
break; |
| 6939 |
default: |
| 6940 |
litest_abort_msg("Unexpected suspend option"); |
| 6941 |
} |
| 6942 |
|
| 6943 |
litest_drain_events(li); |
| 6944 |
|
| 6945 |
assert_touchpad_does_not_move(tp); |
| 6946 |
|
| 6947 |
/* Second reason to suspend: on */ |
| 6948 |
switch (other) { |
| 6949 |
case SUSPEND_EXT_MOUSE: |
| 6950 |
litest_sendevents_ext_mouse(tp); |
| 6951 |
break; |
| 6952 |
case SUSPEND_LID: |
| 6953 |
litest_switch_action(lid, |
| 6954 |
LIBINPUT_SWITCH_LID, |
| 6955 |
LIBINPUT_SWITCH_STATE_ON); |
| 6956 |
litest_drain_events(li); |
| 6957 |
break; |
| 6958 |
case SUSPEND_TABLETMODE: |
| 6959 |
litest_switch_action(tabletmode, |
| 6960 |
LIBINPUT_SWITCH_TABLET_MODE, |
| 6961 |
LIBINPUT_SWITCH_STATE_ON); |
| 6962 |
litest_drain_events(li); |
| 6963 |
break; |
| 6964 |
case SUSPEND_SENDEVENTS: |
| 6965 |
litest_sendevents_off(tp); |
| 6966 |
break; |
| 6967 |
default: |
| 6968 |
litest_abort_msg("Unexpected suspend option"); |
| 6969 |
} |
| 6970 |
|
| 6971 |
assert_touchpad_does_not_move(tp); |
| 6972 |
|
| 6973 |
/* First reason for suspend: off */ |
| 6974 |
switch (first) { |
| 6975 |
case SUSPEND_EXT_MOUSE: |
| 6976 |
litest_sendevents_on(tp); |
| 6977 |
break; |
| 6978 |
case SUSPEND_TABLETMODE: |
| 6979 |
litest_switch_action(tabletmode, |
| 6980 |
LIBINPUT_SWITCH_TABLET_MODE, |
| 6981 |
LIBINPUT_SWITCH_STATE_OFF); |
| 6982 |
break; |
| 6983 |
case SUSPEND_LID: |
| 6984 |
litest_switch_action(lid, |
| 6985 |
LIBINPUT_SWITCH_LID, |
| 6986 |
LIBINPUT_SWITCH_STATE_OFF); |
| 6987 |
break; |
| 6988 |
case SUSPEND_SENDEVENTS: |
| 6989 |
litest_sendevents_on(tp); |
| 6990 |
break; |
| 6991 |
default: |
| 6992 |
litest_abort_msg("Unexpected suspend option"); |
| 6993 |
} |
| 6994 |
|
| 6995 |
litest_drain_events(li); |
| 6996 |
assert_touchpad_does_not_move(tp); |
| 6997 |
|
| 6998 |
/* Second reason to suspend: off */ |
| 6999 |
switch (other) { |
| 7000 |
case SUSPEND_EXT_MOUSE: |
| 7001 |
litest_sendevents_on(tp); |
| 7002 |
break; |
| 7003 |
case SUSPEND_LID: |
| 7004 |
litest_switch_action(lid, |
| 7005 |
LIBINPUT_SWITCH_LID, |
| 7006 |
LIBINPUT_SWITCH_STATE_OFF); |
| 7007 |
litest_drain_events(li); |
| 7008 |
break; |
| 7009 |
case SUSPEND_TABLETMODE: |
| 7010 |
litest_switch_action(tabletmode, |
| 7011 |
LIBINPUT_SWITCH_TABLET_MODE, |
| 7012 |
LIBINPUT_SWITCH_STATE_OFF); |
| 7013 |
litest_drain_events(li); |
| 7014 |
break; |
| 7015 |
case SUSPEND_SENDEVENTS: |
| 7016 |
litest_sendevents_on(tp); |
| 7017 |
break; |
| 7018 |
default: |
| 7019 |
litest_abort_msg("Unexpected suspend option"); |
| 7020 |
} |
| 7021 |
|
| 7022 |
litest_drain_events(li); |
| 7023 |
assert_touchpad_moves(tp); |
| 7024 |
} |
| 7025 |
|
| 7026 |
out: |
| 7027 |
litest_ungrab_device(lid); |
| 7028 |
litest_ungrab_device(tabletmode); |
| 7029 |
litest_device_destroy(lid); |
| 7030 |
litest_device_destroy(tabletmode); |
| 7031 |
litest_device_destroy(extmouse); |
| 7032 |
} |
| 7033 |
END_TEST |
| 7034 |
|
| 7035 |
START_TEST(touchpad_end_start_touch) |
| 7036 |
{ |
| 7037 |
struct litest_device *dev = litest_current_device(); |
| 7038 |
struct libinput *li = dev->libinput; |
| 7039 |
|
| 7040 |
litest_enable_tap(dev->libinput_device); |
| 7041 |
litest_disable_hold_gestures(dev->libinput_device); |
| 7042 |
litest_drain_events(li); |
| 7043 |
|
| 7044 |
litest_touch_down(dev, 0, 50, 50); |
| 7045 |
litest_touch_move(dev, 0, 50.1, 50.1); |
| 7046 |
litest_dispatch(li); |
| 7047 |
|
| 7048 |
litest_push_event_frame(dev); |
| 7049 |
litest_touch_up(dev, 0); |
| 7050 |
litest_touch_down(dev, 0, 50.2, 50.2); |
| 7051 |
litest_pop_event_frame(dev); |
| 7052 |
|
| 7053 |
litest_disable_log_handler(li); |
| 7054 |
litest_dispatch(li); |
| 7055 |
litest_restore_log_handler(li); |
| 7056 |
|
| 7057 |
litest_assert_empty_queue(li); |
| 7058 |
|
| 7059 |
litest_timeout_tap(li); |
| 7060 |
|
| 7061 |
litest_touch_move_to(dev, 0, 50.2, 50.2, 50, 70, 10); |
| 7062 |
litest_touch_up(dev, 0); |
| 7063 |
|
| 7064 |
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION); |
| 7065 |
} |
| 7066 |
END_TEST |
| 7067 |
|
| 7068 |
START_TEST(touchpad_fuzz) |
| 7069 |
{ |
| 7070 |
struct litest_device *dev = litest_current_device(); |
| 7071 |
struct libevdev *evdev = dev->evdev; |
| 7072 |
|
| 7073 |
/* We expect our udev callout to always set this to 0 */ |
| 7074 |
litest_assert_int_eq(libevdev_get_abs_fuzz(evdev, ABS_X), 0); |
| 7075 |
litest_assert_int_eq(libevdev_get_abs_fuzz(evdev, ABS_Y), 0); |
| 7076 |
|
| 7077 |
if (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X)) |
| 7078 |
litest_assert_int_eq(libevdev_get_abs_fuzz(evdev, ABS_MT_POSITION_X), |
| 7079 |
0); |
| 7080 |
if (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_Y)) |
| 7081 |
litest_assert_int_eq(libevdev_get_abs_fuzz(evdev, ABS_MT_POSITION_Y), |
| 7082 |
0); |
| 7083 |
} |
| 7084 |
END_TEST |
| 7085 |
|
| 7086 |
TEST_COLLECTION(touchpad) |
| 7087 |
{ |
| 7088 |
/* clang-format off */ |
| 7089 |
litest_add(touchpad_1fg_motion, LITEST_TOUCHPAD, LITEST_ANY); |
| 7090 |
litest_add(touchpad_2fg_no_motion, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7091 |
|
| 7092 |
litest_add(touchpad_2fg_scroll, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); |
| 7093 |
litest_add(touchpad_2fg_scroll_initially_diagonal, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); |
| 7094 |
litest_add(touchpad_2fg_scroll_axis_lock, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); |
| 7095 |
litest_add(touchpad_2fg_scroll_axis_lock_switch, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); |
| 7096 |
|
| 7097 |
litest_add(touchpad_2fg_scroll_slow_distance, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7098 |
litest_add(touchpad_2fg_scroll_return_to_motion, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7099 |
litest_add(touchpad_2fg_scroll_source, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7100 |
litest_add(touchpad_2fg_scroll_semi_mt, LITEST_SEMI_MT, LITEST_SINGLE_TOUCH); |
| 7101 |
litest_add(touchpad_2fg_scroll_from_btnareas, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7102 |
litest_add(touchpad_scroll_natural_defaults, LITEST_TOUCHPAD, LITEST_ANY); |
| 7103 |
litest_add(touchpad_scroll_natural_enable_config, LITEST_TOUCHPAD, LITEST_ANY); |
| 7104 |
litest_add(touchpad_scroll_natural_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7105 |
litest_add(touchpad_scroll_natural_edge, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7106 |
litest_add(touchpad_scroll_defaults, LITEST_TOUCHPAD, LITEST_ANY); |
| 7107 |
litest_add(touchpad_edge_scroll_vert, LITEST_TOUCHPAD, LITEST_ANY); |
| 7108 |
litest_add(touchpad_edge_scroll_horiz, LITEST_TOUCHPAD, LITEST_CLICKPAD); |
| 7109 |
litest_add(touchpad_edge_scroll_horiz_clickpad, LITEST_CLICKPAD, LITEST_ANY); |
| 7110 |
litest_add(touchpad_edge_scroll_no_horiz, LITEST_TOUCHPAD, LITEST_CLICKPAD); |
| 7111 |
litest_add(touchpad_edge_scroll_no_motion, LITEST_TOUCHPAD, LITEST_ANY); |
| 7112 |
litest_add(touchpad_edge_scroll_no_edge_after_motion, LITEST_TOUCHPAD, LITEST_ANY); |
| 7113 |
litest_add(touchpad_edge_scroll_timeout, LITEST_TOUCHPAD, LITEST_ANY); |
| 7114 |
litest_add(touchpad_edge_scroll_source, LITEST_TOUCHPAD, LITEST_ANY); |
| 7115 |
litest_add(touchpad_edge_scroll_no_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7116 |
litest_add(touchpad_edge_scroll_into_buttonareas, LITEST_CLICKPAD, LITEST_ANY); |
| 7117 |
litest_add(touchpad_edge_scroll_within_buttonareas, LITEST_CLICKPAD, LITEST_ANY); |
| 7118 |
litest_add(touchpad_edge_scroll_buttonareas_click_stops_scroll, LITEST_CLICKPAD, LITEST_ANY); |
| 7119 |
litest_add(touchpad_edge_scroll_clickfinger_click_stops_scroll, LITEST_CLICKPAD, LITEST_ANY); |
| 7120 |
litest_add(touchpad_edge_scroll_into_area, LITEST_TOUCHPAD, LITEST_ANY); |
| 7121 |
|
| 7122 |
litest_add(touchpad_left_handed, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD); |
| 7123 |
litest_add_for_device(touchpad_left_handed_appletouch, LITEST_APPLETOUCH); |
| 7124 |
litest_add(touchpad_left_handed_clickpad, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); |
| 7125 |
litest_add(touchpad_left_handed_clickfinger, LITEST_APPLE_CLICKPAD, LITEST_ANY); |
| 7126 |
litest_add(touchpad_left_handed_tapping, LITEST_TOUCHPAD, LITEST_ANY); |
| 7127 |
litest_add(touchpad_left_handed_tapping_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7128 |
litest_add(touchpad_left_handed_delayed, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD); |
| 7129 |
litest_add(touchpad_left_handed_clickpad_delayed, LITEST_CLICKPAD, LITEST_APPLE_CLICKPAD); |
| 7130 |
litest_add(touchpad_left_handed_rotation, LITEST_TOUCHPAD, LITEST_ANY); |
| 7131 |
|
| 7132 |
/* Semi-MT hover tests aren't generic, they only work on this device and |
| 7133 |
* ignore the semi-mt capability (it doesn't matter for the tests) */ |
| 7134 |
litest_add_for_device(touchpad_semi_mt_hover_noevent, LITEST_SYNAPTICS_HOVER_SEMI_MT); |
| 7135 |
litest_add_for_device(touchpad_semi_mt_hover_down, LITEST_SYNAPTICS_HOVER_SEMI_MT); |
| 7136 |
litest_add_for_device(touchpad_semi_mt_hover_down_up, LITEST_SYNAPTICS_HOVER_SEMI_MT); |
| 7137 |
litest_add_for_device(touchpad_semi_mt_hover_down_hover_down, LITEST_SYNAPTICS_HOVER_SEMI_MT); |
| 7138 |
litest_add_for_device(touchpad_semi_mt_hover_2fg_noevent, LITEST_SYNAPTICS_HOVER_SEMI_MT); |
| 7139 |
litest_add_for_device(touchpad_semi_mt_hover_2fg_1fg_down, LITEST_SYNAPTICS_HOVER_SEMI_MT); |
| 7140 |
litest_add_for_device(touchpad_semi_mt_hover_2fg_up, LITEST_SYNAPTICS_HOVER_SEMI_MT); |
| 7141 |
|
| 7142 |
litest_add(touchpad_hover_noevent, LITEST_TOUCHPAD|LITEST_HOVER, LITEST_ANY); |
| 7143 |
litest_add(touchpad_hover_down, LITEST_TOUCHPAD|LITEST_HOVER, LITEST_ANY); |
| 7144 |
litest_add(touchpad_hover_down_up, LITEST_TOUCHPAD|LITEST_HOVER, LITEST_ANY); |
| 7145 |
litest_add(touchpad_hover_down_hover_down, LITEST_TOUCHPAD|LITEST_HOVER, LITEST_ANY); |
| 7146 |
litest_add(touchpad_hover_2fg_noevent, LITEST_TOUCHPAD|LITEST_HOVER, LITEST_ANY); |
| 7147 |
litest_add(touchpad_hover_2fg_1fg_down, LITEST_TOUCHPAD|LITEST_HOVER, LITEST_ANY); |
| 7148 |
litest_add(touchpad_hover_1fg_tap, LITEST_TOUCHPAD|LITEST_HOVER, LITEST_ANY); |
| 7149 |
|
| 7150 |
litest_add_for_device(touchpad_trackpoint_buttons, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS); |
| 7151 |
litest_add_for_device(touchpad_trackpoint_mb_scroll, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS); |
| 7152 |
litest_add_for_device(touchpad_trackpoint_mb_click, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS); |
| 7153 |
litest_add_for_device(touchpad_trackpoint_buttons_softbuttons, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS); |
| 7154 |
litest_add_for_device(touchpad_trackpoint_buttons_2fg_scroll, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS); |
| 7155 |
litest_add_for_device(touchpad_trackpoint_no_trackpoint, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS); |
| 7156 |
|
| 7157 |
litest_with_parameters(params, "axis", 'I', 2, litest_named_i32(ABS_X), litest_named_i32(ABS_Y)) { |
| 7158 |
litest_add_parametrized(touchpad_initial_state, LITEST_TOUCHPAD, LITEST_ANY, params); |
| 7159 |
} |
| 7160 |
|
| 7161 |
litest_with_parameters(params, "fingers", 'i', 5, 1, 2, 3, 4, 5) { |
| 7162 |
litest_add_parametrized(touchpad_fingers_down_before_init, LITEST_TOUCHPAD, LITEST_ANY, params); |
| 7163 |
} |
| 7164 |
litest_add(touchpad_state_after_syn_dropped_2fg_change, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7165 |
|
| 7166 |
litest_add(touchpad_thumb_lower_area_movement, LITEST_CLICKPAD, LITEST_ANY); |
| 7167 |
litest_add(touchpad_thumb_lower_area_movement_rethumb, LITEST_CLICKPAD, LITEST_ANY); |
| 7168 |
litest_add(touchpad_thumb_speed_empty_slots, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7169 |
litest_add(touchpad_thumb_area_clickfinger, LITEST_CLICKPAD, LITEST_ANY); |
| 7170 |
litest_add(touchpad_thumb_area_btnarea, LITEST_CLICKPAD, LITEST_ANY); |
| 7171 |
litest_add(touchpad_thumb_no_doublethumb, LITEST_CLICKPAD, LITEST_ANY); |
| 7172 |
|
| 7173 |
litest_add_for_device(touchpad_tool_tripletap_touch_count, LITEST_SYNAPTICS_TOPBUTTONPAD); |
| 7174 |
litest_add_for_device(touchpad_tool_tripletap_touch_count_late, LITEST_SYNAPTICS_TOPBUTTONPAD); |
| 7175 |
litest_add_for_device(touchpad_slot_swap, LITEST_SYNAPTICS_TOPBUTTONPAD); |
| 7176 |
litest_add_for_device(touchpad_finger_always_down, LITEST_SYNAPTICS_TOPBUTTONPAD); |
| 7177 |
|
| 7178 |
litest_add(touchpad_time_usec, LITEST_TOUCHPAD, LITEST_ANY); |
| 7179 |
|
| 7180 |
litest_add_for_device(touchpad_jump_finger_motion, LITEST_SYNAPTICS_CLICKPAD_X220); |
| 7181 |
litest_add_for_device(touchpad_jump_delta, LITEST_SYNAPTICS_CLICKPAD_X220); |
| 7182 |
|
| 7183 |
litest_with_parameters(params, "suspend", 'b') { |
| 7184 |
litest_add_parametrized_for_device(touchpad_disabled_on_mouse, LITEST_SYNAPTICS_CLICKPAD_X220, params); |
| 7185 |
} |
| 7186 |
|
| 7187 |
litest_with_parameters(params, |
| 7188 |
"suspend-nonsending", 'b', |
| 7189 |
"remove", 'I', 2, litest_named_i32(2, "sending-mouse"), |
| 7190 |
litest_named_i32(1, "nonsending-mouse")) { |
| 7191 |
litest_add_parametrized_for_device(touchpad_disabled_double_mouse, LITEST_SYNAPTICS_CLICKPAD_X220, params); |
| 7192 |
} |
| 7193 |
|
| 7194 |
litest_add(touchpad_pressure, LITEST_TOUCHPAD, LITEST_ANY); |
| 7195 |
litest_add(touchpad_pressure_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7196 |
litest_add(touchpad_pressure_2fg_st, LITEST_TOUCHPAD|LITEST_SINGLE_TOUCH, LITEST_ANY); |
| 7197 |
litest_add(touchpad_pressure_tap, LITEST_TOUCHPAD, LITEST_ANY); |
| 7198 |
litest_add(touchpad_pressure_tap_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7199 |
litest_add(touchpad_pressure_tap_2fg_1fg_light, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7200 |
litest_add(touchpad_pressure_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7201 |
litest_add(touchpad_pressure_semi_mt_2fg_goes_light, LITEST_SEMI_MT, LITEST_ANY); |
| 7202 |
|
| 7203 |
litest_add(touchpad_touch_size, LITEST_APPLE_CLICKPAD, LITEST_ANY); |
| 7204 |
litest_add(touchpad_touch_size_2fg, LITEST_APPLE_CLICKPAD, LITEST_ANY); |
| 7205 |
|
| 7206 |
litest_add(touchpad_speed_ignore_finger, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); |
| 7207 |
litest_add(touchpad_speed_allow_nearby_finger, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); |
| 7208 |
litest_add(touchpad_speed_ignore_finger_edgescroll, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT); |
| 7209 |
litest_add_for_device(touchpad_speed_ignore_hovering_finger, LITEST_BCM5974); |
| 7210 |
|
| 7211 |
litest_with_parameters(params, "mode", 'I', 4, litest_named_i32(SUSPEND_EXT_MOUSE, "external_mouse"), |
| 7212 |
litest_named_i32(SUSPEND_SENDEVENTS, "sendevents"), |
| 7213 |
litest_named_i32(SUSPEND_LID, "lid"), |
| 7214 |
litest_named_i32(SUSPEND_TABLETMODE, "tabletmode")) { |
| 7215 |
litest_add_parametrized(touchpad_suspend_abba, LITEST_TOUCHPAD, LITEST_ANY, params); |
| 7216 |
litest_add_parametrized(touchpad_suspend_abab, LITEST_TOUCHPAD, LITEST_ANY, params); |
| 7217 |
} |
| 7218 |
|
| 7219 |
/* Happens on the "Wacom Intuos Pro M Finger" but our test device |
| 7220 |
* has the same properties */ |
| 7221 |
litest_add_for_device(touchpad_end_start_touch, LITEST_WACOM_INTUOS5_FINGER); |
| 7222 |
|
| 7223 |
litest_add(touchpad_fuzz, LITEST_TOUCHPAD, LITEST_ANY); |
| 7224 |
/* clang-format on */ |
| 7225 |
} |
| 7226 |
|
| 7227 |
TEST_COLLECTION(touchpad_dwt) |
| 7228 |
{ |
| 7229 |
/* clang-format off */ |
| 7230 |
litest_add(touchpad_dwt_single_key, LITEST_TOUCHPAD, LITEST_ANY); |
| 7231 |
|
| 7232 |
litest_add_for_device(touchpad_dwt_ext_and_int_keyboard, LITEST_SYNAPTICS_I2C); |
| 7233 |
litest_add(touchpad_dwt_enable_touch, LITEST_TOUCHPAD, LITEST_ANY); |
| 7234 |
litest_add(touchpad_dwt_touch_hold, LITEST_TOUCHPAD, LITEST_ANY); |
| 7235 |
litest_add(touchpad_dwt_key_hold, LITEST_TOUCHPAD, LITEST_ANY); |
| 7236 |
litest_add(touchpad_dwt_key_hold_timeout, LITEST_TOUCHPAD, LITEST_ANY); |
| 7237 |
litest_add(touchpad_dwt_key_hold_timeout_existing_touch, LITEST_TOUCHPAD, LITEST_ANY); |
| 7238 |
litest_add(touchpad_dwt_key_hold_timeout_existing_touch_cornercase, LITEST_TOUCHPAD, LITEST_ANY); |
| 7239 |
litest_with_parameters(params, "timeout", 'u', 4, 0, 120, 300, 900) { |
| 7240 |
litest_add_parametrized(touchpad_dwt_type, LITEST_TOUCHPAD, LITEST_ANY, params); |
| 7241 |
} |
| 7242 |
litest_add(touchpad_dwt_type_short_timeout, LITEST_TOUCHPAD, LITEST_ANY); |
| 7243 |
litest_add(touchpad_dwt_shift_combo_triggers_dwt, LITEST_TOUCHPAD, LITEST_ANY); |
| 7244 |
litest_add(touchpad_dwt_modifier_no_dwt, LITEST_TOUCHPAD, LITEST_ANY); |
| 7245 |
litest_add(touchpad_dwt_modifier_combo_no_dwt, LITEST_TOUCHPAD, LITEST_ANY); |
| 7246 |
litest_add(touchpad_dwt_modifier_combo_dwt_after, LITEST_TOUCHPAD, LITEST_ANY); |
| 7247 |
litest_add(touchpad_dwt_modifier_combo_dwt_remains, LITEST_TOUCHPAD, LITEST_ANY); |
| 7248 |
litest_add(touchpad_dwt_fkeys_no_dwt, LITEST_TOUCHPAD, LITEST_ANY); |
| 7249 |
litest_add(touchpad_dwt_tap, LITEST_TOUCHPAD, LITEST_ANY); |
| 7250 |
litest_add(touchpad_dwt_tap_drag, LITEST_TOUCHPAD, LITEST_ANY); |
| 7251 |
litest_add(touchpad_dwt_click, LITEST_TOUCHPAD, LITEST_ANY); |
| 7252 |
litest_add(touchpad_dwt_edge_scroll, LITEST_TOUCHPAD, LITEST_CLICKPAD); |
| 7253 |
litest_add(touchpad_dwt_edge_scroll_interrupt, LITEST_TOUCHPAD, LITEST_CLICKPAD); |
| 7254 |
litest_add(touchpad_dwt_config_default_timeout, LITEST_TOUCHPAD, LITEST_ANY); |
| 7255 |
litest_add(touchpad_dwt_config_default_on, LITEST_TOUCHPAD, LITEST_ANY); |
| 7256 |
litest_add(touchpad_dwt_config_default_off, LITEST_ANY, LITEST_TOUCHPAD); |
| 7257 |
litest_add(touchpad_dwt_disabled, LITEST_TOUCHPAD, LITEST_ANY); |
| 7258 |
litest_add(touchpad_dwt_disable_during_touch, LITEST_TOUCHPAD, LITEST_ANY); |
| 7259 |
litest_add(touchpad_dwt_disable_before_touch, LITEST_TOUCHPAD, LITEST_ANY); |
| 7260 |
litest_add(touchpad_dwt_disable_during_key_release, LITEST_TOUCHPAD, LITEST_ANY); |
| 7261 |
litest_add(touchpad_dwt_disable_during_key_hold, LITEST_TOUCHPAD, LITEST_ANY); |
| 7262 |
litest_add(touchpad_dwt_enable_during_touch, LITEST_TOUCHPAD, LITEST_ANY); |
| 7263 |
litest_add(touchpad_dwt_enable_before_touch, LITEST_TOUCHPAD, LITEST_ANY); |
| 7264 |
litest_add(touchpad_dwt_enable_during_tap, LITEST_TOUCHPAD, LITEST_ANY); |
| 7265 |
litest_add(touchpad_dwt_remove_kbd_while_active, LITEST_TOUCHPAD, LITEST_ANY); |
| 7266 |
litest_add(touchpad_dwtp_config_default_timeout, LITEST_TOUCHPAD, LITEST_ANY); |
| 7267 |
litest_add(touchpad_dwtp_config_default_on, LITEST_TOUCHPAD, LITEST_ANY); |
| 7268 |
litest_add(touchpad_dwtp_config_default_off, LITEST_ANY, LITEST_TOUCHPAD); |
| 7269 |
litest_add_for_device(touchpad_dwt_apple, LITEST_BCM5974); |
| 7270 |
litest_add_for_device(touchpad_dwt_acer_hawaii, LITEST_ACER_HAWAII_TOUCHPAD); |
| 7271 |
litest_add_for_device(touchpad_dwt_generic_usbcombo, LITEST_GENERIC_USBCOMBO_TOUCHPAD); |
| 7272 |
litest_add_for_device(touchpad_dwt_multiple_keyboards, LITEST_SYNAPTICS_I2C); |
| 7273 |
litest_add_for_device(touchpad_dwt_multiple_keyboards_bothkeys, LITEST_SYNAPTICS_I2C); |
| 7274 |
litest_add_for_device(touchpad_dwt_multiple_keyboards_bothkeys_modifier, LITEST_SYNAPTICS_I2C); |
| 7275 |
litest_with_parameters(params, "which", 'I', 2, litest_named_i32(0, "first"), litest_named_i32(1, "second")) { |
| 7276 |
litest_add_parametrized_for_device(touchpad_dwt_multiple_keyboards_remove, LITEST_SYNAPTICS_I2C, params); |
| 7277 |
} |
| 7278 |
litest_add_for_device(touchpad_dwt_remove_before_keyboard, LITEST_KEYBOARD); |
| 7279 |
/* clang-format on */ |
| 7280 |
} |
| 7281 |
|
| 7282 |
TEST_COLLECTION(touchpad_palm) |
| 7283 |
{ |
| 7284 |
/* clang-format off */ |
| 7285 |
litest_add(touchpad_palm_detect_at_edge, LITEST_TOUCHPAD, LITEST_ANY); |
| 7286 |
litest_add(touchpad_palm_detect_at_top, LITEST_TOUCHPAD, LITEST_TOPBUTTONPAD); |
| 7287 |
litest_add(touchpad_palm_detect_at_bottom_corners, LITEST_TOUCHPAD, LITEST_CLICKPAD); |
| 7288 |
litest_add(touchpad_palm_detect_at_top_corners, LITEST_TOUCHPAD, LITEST_TOPBUTTONPAD); |
| 7289 |
litest_add(touchpad_palm_detect_palm_becomes_pointer, LITEST_TOUCHPAD, LITEST_ANY); |
| 7290 |
litest_add(touchpad_palm_detect_top_palm_becomes_pointer, LITEST_TOUCHPAD, LITEST_TOPBUTTONPAD); |
| 7291 |
litest_add(touchpad_palm_detect_palm_stays_palm, LITEST_TOUCHPAD, LITEST_ANY); |
| 7292 |
litest_add(touchpad_palm_detect_top_palm_stays_palm, LITEST_TOUCHPAD, LITEST_TOPBUTTONPAD); |
| 7293 |
litest_add(touchpad_palm_detect_no_palm_moving_into_edges, LITEST_TOUCHPAD, LITEST_ANY); |
| 7294 |
litest_add(touchpad_palm_detect_no_palm_moving_into_top, LITEST_TOUCHPAD, LITEST_TOPBUTTONPAD); |
| 7295 |
litest_add(touchpad_palm_detect_no_tap_top_edge, LITEST_TOUCHPAD, LITEST_TOPBUTTONPAD); |
| 7296 |
litest_add(touchpad_palm_detect_tap_hardbuttons, LITEST_TOUCHPAD, LITEST_CLICKPAD); |
| 7297 |
litest_add(touchpad_palm_detect_tap_softbuttons, LITEST_CLICKPAD, LITEST_ANY); |
| 7298 |
litest_add(touchpad_palm_detect_tap_clickfinger, LITEST_CLICKPAD, LITEST_ANY); |
| 7299 |
litest_add(touchpad_no_palm_detect_at_edge_for_edge_scrolling, LITEST_TOUCHPAD, LITEST_CLICKPAD); |
| 7300 |
litest_add(touchpad_no_palm_detect_2fg_scroll, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7301 |
litest_add(touchpad_palm_detect_both_edges, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7302 |
litest_add(touchpad_palm_detect_tool_palm, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7303 |
litest_add(touchpad_palm_detect_tool_palm_on_off, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7304 |
litest_add(touchpad_palm_detect_tool_palm_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7305 |
litest_add(touchpad_palm_detect_tool_palm_tap_after, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7306 |
|
| 7307 |
litest_add(touchpad_palm_detect_touch_size, LITEST_APPLE_CLICKPAD, LITEST_ANY); |
| 7308 |
litest_add(touchpad_palm_detect_touch_size_late, LITEST_APPLE_CLICKPAD, LITEST_ANY); |
| 7309 |
litest_add(touchpad_palm_detect_touch_size_keep_palm, LITEST_APPLE_CLICKPAD, LITEST_ANY); |
| 7310 |
litest_add(touchpad_palm_detect_touch_size_after_edge, LITEST_APPLE_CLICKPAD, LITEST_ANY); |
| 7311 |
litest_add(touchpad_palm_detect_touch_size_after_dwt, LITEST_APPLE_CLICKPAD, LITEST_ANY); |
| 7312 |
|
| 7313 |
litest_add(touchpad_palm_detect_pressure, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7314 |
litest_add(touchpad_palm_detect_pressure_late_tap, LITEST_CLICKPAD, LITEST_ANY); |
| 7315 |
litest_add(touchpad_palm_detect_pressure_tap_hold, LITEST_CLICKPAD, LITEST_ANY); |
| 7316 |
litest_add(touchpad_palm_detect_pressure_tap_hold_2ndfg, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH); |
| 7317 |
litest_add(touchpad_palm_detect_move_and_tap, LITEST_TOUCHPAD, LITEST_ANY); |
| 7318 |
litest_add(touchpad_palm_detect_pressure_late, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7319 |
litest_add(touchpad_palm_detect_pressure_keep_palm, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7320 |
litest_add(touchpad_palm_detect_pressure_after_edge, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7321 |
litest_add(touchpad_palm_detect_pressure_after_dwt, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH); |
| 7322 |
litest_add_for_device(touchpad_palm_ignore_threshold_zero, LITEST_TOUCHPAD_PALMPRESSURE_ZERO); |
| 7323 |
|
| 7324 |
litest_add(touchpad_palm_clickfinger_pressure, LITEST_CLICKPAD, LITEST_ANY); |
| 7325 |
litest_add(touchpad_palm_clickfinger_pressure_2fg, LITEST_CLICKPAD, LITEST_ANY); |
| 7326 |
litest_add(touchpad_palm_clickfinger_size, LITEST_CLICKPAD, LITEST_ANY); |
| 7327 |
litest_add(touchpad_palm_clickfinger_size_2fg, LITEST_CLICKPAD, LITEST_ANY); |
| 7328 |
/* clang-format on */ |
| 7329 |
} |