2015-07-07 11:52:05 +10:00
|
|
|
/*
|
|
|
|
|
* Copyright © 2015 Red Hat, Inc.
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
|
*
|
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
|
* Software.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#include <check.h>
|
|
|
|
|
#include <libinput.h>
|
2021-03-15 17:23:48 +10:00
|
|
|
#include <valgrind/valgrind.h>
|
2015-07-07 11:52:05 +10:00
|
|
|
|
|
|
|
|
#include "libinput-util.h"
|
|
|
|
|
#include "litest.h"
|
|
|
|
|
|
2019-06-20 14:15:02 +10:00
|
|
|
enum cardinal {
|
|
|
|
|
N, NE, E, SE, S, SW, W, NW, NCARDINALS
|
|
|
|
|
};
|
|
|
|
|
|
2021-05-27 19:20:23 +02:00
|
|
|
enum hold_gesture_behaviour {
|
|
|
|
|
HOLD_GESTURE_IGNORE,
|
|
|
|
|
HOLD_GESTURE_REQUIRE,
|
|
|
|
|
};
|
|
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
static void
|
2021-05-27 19:20:23 +02:00
|
|
|
test_gesture_swipe_3fg(int cardinal, enum hold_gesture_behaviour hold)
|
2015-07-07 11:52:05 +10:00
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_gesture *gevent;
|
|
|
|
|
double dx, dy;
|
|
|
|
|
double dir_x, dir_y;
|
2019-06-20 14:15:02 +10:00
|
|
|
int cardinals[NCARDINALS][2] = {
|
2015-07-07 11:52:05 +10:00
|
|
|
{ 0, 30 },
|
|
|
|
|
{ 30, 30 },
|
|
|
|
|
{ 30, 0 },
|
|
|
|
|
{ 30, -30 },
|
|
|
|
|
{ 0, -30 },
|
|
|
|
|
{ -30, -30 },
|
|
|
|
|
{ -30, 0 },
|
|
|
|
|
{ -30, 30 },
|
|
|
|
|
};
|
|
|
|
|
|
2020-01-09 11:13:18 +10:00
|
|
|
if (litest_slot_count(dev) < 3)
|
2015-07-07 11:52:05 +10:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
dir_x = cardinals[cardinal][0];
|
|
|
|
|
dir_y = cardinals[cardinal][1];
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 40, 40);
|
2016-01-08 11:06:49 +10:00
|
|
|
litest_touch_down(dev, 1, 50, 40);
|
|
|
|
|
litest_touch_down(dev, 2, 60, 40);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-27 19:20:23 +02:00
|
|
|
|
|
|
|
|
if (hold == HOLD_GESTURE_REQUIRE)
|
|
|
|
|
litest_timeout_gesture_hold();
|
|
|
|
|
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_three_touches(dev, 40, 40, 50, 40, 60, 40, dir_x,
|
|
|
|
|
dir_y, 10);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-07 11:52:05 +10:00
|
|
|
|
2021-05-27 19:20:23 +02:00
|
|
|
if (hold == HOLD_GESTURE_REQUIRE) {
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_BEGIN,
|
|
|
|
|
3);
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_END,
|
|
|
|
|
3);
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-07 11:52:05 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN,
|
|
|
|
|
3);
|
|
|
|
|
dx = libinput_event_gesture_get_dx(gevent);
|
|
|
|
|
dy = libinput_event_gesture_get_dy(gevent);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx == 0.0);
|
|
|
|
|
litest_assert(dy == 0.0);
|
2015-07-07 11:52:05 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
while ((event = libinput_get_event(li)) != NULL) {
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE,
|
|
|
|
|
3);
|
|
|
|
|
|
|
|
|
|
dx = libinput_event_gesture_get_dx(gevent);
|
|
|
|
|
dy = libinput_event_gesture_get_dy(gevent);
|
|
|
|
|
if (dir_x == 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx == 0.0);
|
2015-07-07 11:52:05 +10:00
|
|
|
else if (dir_x < 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx < 0.0);
|
2015-07-07 11:52:05 +10:00
|
|
|
else if (dir_x > 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx > 0.0);
|
2015-07-07 11:52:05 +10:00
|
|
|
|
|
|
|
|
if (dir_y == 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy == 0.0);
|
2015-07-07 11:52:05 +10:00
|
|
|
else if (dir_y < 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy < 0.0);
|
2015-07-07 11:52:05 +10:00
|
|
|
else if (dir_y > 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy > 0.0);
|
2015-07-07 11:52:05 +10:00
|
|
|
|
|
|
|
|
dx = libinput_event_gesture_get_dx_unaccelerated(gevent);
|
|
|
|
|
dy = libinput_event_gesture_get_dy_unaccelerated(gevent);
|
|
|
|
|
if (dir_x == 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx == 0.0);
|
2015-07-07 11:52:05 +10:00
|
|
|
else if (dir_x < 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx < 0.0);
|
2015-07-07 11:52:05 +10:00
|
|
|
else if (dir_x > 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx > 0.0);
|
2015-07-07 11:52:05 +10:00
|
|
|
|
|
|
|
|
if (dir_y == 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy == 0.0);
|
2015-07-07 11:52:05 +10:00
|
|
|
else if (dir_y < 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy < 0.0);
|
2015-07-07 11:52:05 +10:00
|
|
|
else if (dir_y > 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy > 0.0);
|
2015-07-07 11:52:05 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
litest_touch_up(dev, 2);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-07 11:52:05 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_SWIPE_END,
|
|
|
|
|
3);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(!libinput_event_gesture_get_cancelled(gevent));
|
2015-07-07 11:52:05 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
2019-09-19 13:56:32 +10:00
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
static void
|
2021-05-27 19:20:23 +02:00
|
|
|
test_gesture_swipe_4fg(int cardinal, enum hold_gesture_behaviour hold)
|
2016-01-07 15:00:53 +10:00
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_gesture *gevent;
|
|
|
|
|
double dx, dy;
|
|
|
|
|
double dir_x, dir_y;
|
2019-06-20 14:15:02 +10:00
|
|
|
int cardinals[NCARDINALS][2] = {
|
2016-01-07 15:00:53 +10:00
|
|
|
{ 0, 3 },
|
|
|
|
|
{ 3, 3 },
|
|
|
|
|
{ 3, 0 },
|
|
|
|
|
{ 3, -3 },
|
|
|
|
|
{ 0, -3 },
|
|
|
|
|
{ -3, -3 },
|
|
|
|
|
{ -3, 0 },
|
|
|
|
|
{ -3, 3 },
|
|
|
|
|
};
|
|
|
|
|
int i;
|
|
|
|
|
|
2020-01-09 11:13:18 +10:00
|
|
|
if (litest_slot_count(dev) < 4)
|
2016-01-07 15:00:53 +10:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
dir_x = cardinals[cardinal][0];
|
|
|
|
|
dir_y = cardinals[cardinal][1];
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 40, 40);
|
|
|
|
|
litest_touch_down(dev, 1, 50, 40);
|
|
|
|
|
litest_touch_down(dev, 2, 60, 40);
|
|
|
|
|
litest_touch_down(dev, 3, 70, 40);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
2021-05-27 19:20:23 +02:00
|
|
|
if (hold == HOLD_GESTURE_REQUIRE)
|
|
|
|
|
litest_timeout_gesture_hold();
|
|
|
|
|
|
2016-01-07 15:00:53 +10:00
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
|
|
|
|
|
dir_x += cardinals[cardinal][0];
|
|
|
|
|
dir_y += cardinals[cardinal][1];
|
|
|
|
|
|
|
|
|
|
litest_touch_move(dev,
|
|
|
|
|
0,
|
|
|
|
|
40 + dir_x,
|
|
|
|
|
40 + dir_y);
|
|
|
|
|
litest_touch_move(dev,
|
|
|
|
|
1,
|
|
|
|
|
50 + dir_x,
|
|
|
|
|
40 + dir_y);
|
|
|
|
|
litest_touch_move(dev,
|
|
|
|
|
2,
|
|
|
|
|
60 + dir_x,
|
|
|
|
|
40 + dir_y);
|
|
|
|
|
litest_touch_move(dev,
|
|
|
|
|
3,
|
|
|
|
|
70 + dir_x,
|
|
|
|
|
40 + dir_y);
|
|
|
|
|
litest_pop_event_frame(dev);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-01-07 15:00:53 +10:00
|
|
|
}
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
2021-05-27 19:20:23 +02:00
|
|
|
if (hold == HOLD_GESTURE_REQUIRE) {
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_BEGIN,
|
|
|
|
|
4);
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_END,
|
|
|
|
|
4);
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-07 15:00:53 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN,
|
|
|
|
|
4);
|
|
|
|
|
dx = libinput_event_gesture_get_dx(gevent);
|
|
|
|
|
dy = libinput_event_gesture_get_dy(gevent);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx == 0.0);
|
|
|
|
|
litest_assert(dy == 0.0);
|
2016-01-07 15:00:53 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
while ((event = libinput_get_event(li)) != NULL) {
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE,
|
|
|
|
|
4);
|
|
|
|
|
|
|
|
|
|
dx = libinput_event_gesture_get_dx(gevent);
|
|
|
|
|
dy = libinput_event_gesture_get_dy(gevent);
|
|
|
|
|
if (dir_x == 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx == 0.0);
|
2016-01-07 15:00:53 +10:00
|
|
|
else if (dir_x < 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx < 0.0);
|
2016-01-07 15:00:53 +10:00
|
|
|
else if (dir_x > 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx > 0.0);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
|
|
|
|
if (dir_y == 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy == 0.0);
|
2016-01-07 15:00:53 +10:00
|
|
|
else if (dir_y < 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy < 0.0);
|
2016-01-07 15:00:53 +10:00
|
|
|
else if (dir_y > 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy > 0.0);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
|
|
|
|
dx = libinput_event_gesture_get_dx_unaccelerated(gevent);
|
|
|
|
|
dy = libinput_event_gesture_get_dy_unaccelerated(gevent);
|
|
|
|
|
if (dir_x == 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx == 0.0);
|
2016-01-07 15:00:53 +10:00
|
|
|
else if (dir_x < 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx < 0.0);
|
2016-01-07 15:00:53 +10:00
|
|
|
else if (dir_x > 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx > 0.0);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
|
|
|
|
if (dir_y == 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy == 0.0);
|
2016-01-07 15:00:53 +10:00
|
|
|
else if (dir_y < 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy < 0.0);
|
2016-01-07 15:00:53 +10:00
|
|
|
else if (dir_y > 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy > 0.0);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
litest_touch_up(dev, 2);
|
|
|
|
|
litest_touch_up(dev, 3);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-01-07 15:00:53 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_SWIPE_END,
|
|
|
|
|
4);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(!libinput_event_gesture_get_cancelled(gevent));
|
2016-01-07 15:00:53 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
static void
|
2021-05-27 19:20:23 +02:00
|
|
|
test_gesture_pinch_2fg(int cardinal, enum hold_gesture_behaviour hold)
|
2016-01-07 15:00:53 +10:00
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_gesture *gevent;
|
|
|
|
|
double dx, dy;
|
|
|
|
|
double dir_x, dir_y;
|
2021-05-27 19:20:11 +02:00
|
|
|
int i;
|
|
|
|
|
double scale, oldscale;
|
|
|
|
|
double angle;
|
2019-06-20 14:15:02 +10:00
|
|
|
int cardinals[NCARDINALS][2] = {
|
2016-01-07 15:00:53 +10:00
|
|
|
{ 0, 30 },
|
|
|
|
|
{ 30, 30 },
|
|
|
|
|
{ 30, 0 },
|
|
|
|
|
{ 30, -30 },
|
|
|
|
|
{ 0, -30 },
|
|
|
|
|
{ -30, -30 },
|
|
|
|
|
{ -30, 0 },
|
|
|
|
|
{ -30, 30 },
|
|
|
|
|
};
|
|
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
if (litest_slot_count(dev) < 2 ||
|
2016-01-07 15:00:53 +10:00
|
|
|
!libinput_device_has_capability(dev->libinput_device,
|
|
|
|
|
LIBINPUT_DEVICE_CAP_GESTURE))
|
|
|
|
|
return;
|
|
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
/* If the device is too small to provide a finger spread wide enough
|
|
|
|
|
* to avoid the scroll bias, skip the test */
|
|
|
|
|
if (cardinal == E || cardinal == W) {
|
|
|
|
|
double w = 0, h = 0;
|
|
|
|
|
libinput_device_get_size(dev->libinput_device, &w, &h);
|
|
|
|
|
/* 0.6 because the code below gives us points like 20/y and
|
|
|
|
|
* 80/y. 45 because the threshold in the code is 40mm */
|
|
|
|
|
if (w * 0.6 < 45)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-07 15:00:53 +10:00
|
|
|
dir_x = cardinals[cardinal][0];
|
|
|
|
|
dir_y = cardinals[cardinal][1];
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
litest_touch_down(dev, 0, 50 + dir_x, 50 + dir_y);
|
|
|
|
|
litest_touch_down(dev, 1, 50 - dir_x, 50 - dir_y);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
2021-05-27 19:20:23 +02:00
|
|
|
if (hold == HOLD_GESTURE_REQUIRE)
|
|
|
|
|
litest_timeout_gesture_hold();
|
|
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
if (dir_x > 0.0)
|
|
|
|
|
dir_x -= 2;
|
|
|
|
|
else if (dir_x < 0.0)
|
|
|
|
|
dir_x += 2;
|
|
|
|
|
if (dir_y > 0.0)
|
|
|
|
|
dir_y -= 2;
|
|
|
|
|
else if (dir_y < 0.0)
|
|
|
|
|
dir_y += 2;
|
|
|
|
|
litest_touch_move(dev,
|
|
|
|
|
0,
|
|
|
|
|
50 + dir_x,
|
|
|
|
|
50 + dir_y);
|
|
|
|
|
litest_touch_move(dev,
|
|
|
|
|
1,
|
|
|
|
|
50 - dir_x,
|
|
|
|
|
50 - dir_y);
|
|
|
|
|
litest_pop_event_frame(dev);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-27 19:20:11 +02:00
|
|
|
}
|
|
|
|
|
|
2021-05-27 19:20:23 +02:00
|
|
|
if (hold == HOLD_GESTURE_REQUIRE) {
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_BEGIN,
|
|
|
|
|
2);
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_END,
|
|
|
|
|
2);
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-07 15:00:53 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
2021-05-27 19:20:11 +02:00
|
|
|
LIBINPUT_EVENT_GESTURE_PINCH_BEGIN,
|
|
|
|
|
2);
|
2016-01-07 15:00:53 +10:00
|
|
|
dx = libinput_event_gesture_get_dx(gevent);
|
|
|
|
|
dy = libinput_event_gesture_get_dy(gevent);
|
2021-05-27 19:20:11 +02:00
|
|
|
scale = libinput_event_gesture_get_scale(gevent);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx == 0.0);
|
|
|
|
|
litest_assert(dy == 0.0);
|
|
|
|
|
litest_assert(scale == 1.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
|
2016-01-07 15:00:53 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
while ((event = libinput_get_event(li)) != NULL) {
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
2021-05-27 19:20:11 +02:00
|
|
|
LIBINPUT_EVENT_GESTURE_PINCH_UPDATE,
|
|
|
|
|
2);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
oldscale = scale;
|
|
|
|
|
scale = libinput_event_gesture_get_scale(gevent);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(scale < oldscale);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
angle = libinput_event_gesture_get_angle_delta(gevent);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert_double_le(fabs(angle), 1.0);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-01-07 15:00:53 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
litest_touch_up(dev, 1);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-01-07 15:00:53 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
2021-05-27 19:20:11 +02:00
|
|
|
LIBINPUT_EVENT_GESTURE_PINCH_END,
|
|
|
|
|
2);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(!libinput_event_gesture_get_cancelled(gevent));
|
2016-01-07 15:00:53 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
static void
|
2021-05-27 19:20:23 +02:00
|
|
|
test_gesture_pinch_3fg(int cardinal, enum hold_gesture_behaviour hold)
|
2015-07-07 11:52:05 +10:00
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_gesture *gevent;
|
|
|
|
|
double dx, dy;
|
|
|
|
|
double dir_x, dir_y;
|
|
|
|
|
int i;
|
|
|
|
|
double scale, oldscale;
|
|
|
|
|
double angle;
|
2019-06-20 14:15:02 +10:00
|
|
|
int cardinals[NCARDINALS][2] = {
|
2015-07-07 11:52:05 +10:00
|
|
|
{ 0, 30 },
|
|
|
|
|
{ 30, 30 },
|
|
|
|
|
{ 30, 0 },
|
|
|
|
|
{ 30, -30 },
|
|
|
|
|
{ 0, -30 },
|
|
|
|
|
{ -30, -30 },
|
|
|
|
|
{ -30, 0 },
|
|
|
|
|
{ -30, 30 },
|
|
|
|
|
};
|
|
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
if (litest_slot_count(dev) < 3)
|
2016-01-07 15:00:53 +10:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
dir_x = cardinals[cardinal][0];
|
|
|
|
|
dir_y = cardinals[cardinal][1];
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 50 + dir_x, 50 + dir_y);
|
|
|
|
|
litest_touch_down(dev, 1, 50 - dir_x, 50 - dir_y);
|
2021-05-27 19:20:11 +02:00
|
|
|
litest_touch_down(dev, 2, 51 - dir_x, 51 - dir_y);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
2021-05-27 19:20:23 +02:00
|
|
|
if (hold == HOLD_GESTURE_REQUIRE)
|
|
|
|
|
litest_timeout_gesture_hold();
|
|
|
|
|
|
2016-01-07 15:00:53 +10:00
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
if (dir_x > 0.0)
|
|
|
|
|
dir_x -= 2;
|
|
|
|
|
else if (dir_x < 0.0)
|
|
|
|
|
dir_x += 2;
|
|
|
|
|
if (dir_y > 0.0)
|
|
|
|
|
dir_y -= 2;
|
|
|
|
|
else if (dir_y < 0.0)
|
|
|
|
|
dir_y += 2;
|
|
|
|
|
litest_touch_move(dev,
|
|
|
|
|
0,
|
|
|
|
|
50 + dir_x,
|
|
|
|
|
50 + dir_y);
|
|
|
|
|
litest_touch_move(dev,
|
|
|
|
|
1,
|
|
|
|
|
50 - dir_x,
|
|
|
|
|
50 - dir_y);
|
2021-05-27 19:20:11 +02:00
|
|
|
litest_touch_move(dev,
|
|
|
|
|
2,
|
|
|
|
|
51 - dir_x,
|
|
|
|
|
51 - dir_y);
|
2016-01-07 15:00:53 +10:00
|
|
|
litest_pop_event_frame(dev);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-01-07 15:00:53 +10:00
|
|
|
}
|
|
|
|
|
|
2021-05-27 19:20:23 +02:00
|
|
|
if (hold == HOLD_GESTURE_REQUIRE) {
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_BEGIN,
|
|
|
|
|
3);
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_END,
|
|
|
|
|
3);
|
|
|
|
|
}
|
2016-01-07 15:00:53 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_PINCH_BEGIN,
|
2021-05-27 19:20:11 +02:00
|
|
|
3);
|
2016-01-07 15:00:53 +10:00
|
|
|
dx = libinput_event_gesture_get_dx(gevent);
|
|
|
|
|
dy = libinput_event_gesture_get_dy(gevent);
|
|
|
|
|
scale = libinput_event_gesture_get_scale(gevent);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx == 0.0);
|
|
|
|
|
litest_assert(dy == 0.0);
|
|
|
|
|
litest_assert(scale == 1.0);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
while ((event = libinput_get_event(li)) != NULL) {
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_PINCH_UPDATE,
|
2021-05-27 19:20:11 +02:00
|
|
|
3);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
|
|
|
|
oldscale = scale;
|
|
|
|
|
scale = libinput_event_gesture_get_scale(gevent);
|
|
|
|
|
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(scale < oldscale);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
|
|
|
|
angle = libinput_event_gesture_get_angle_delta(gevent);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert_double_le(fabs(angle), 1.0);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-01-07 15:00:53 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
litest_touch_up(dev, 1);
|
2021-05-27 19:20:11 +02:00
|
|
|
litest_touch_up(dev, 2);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-01-07 15:00:53 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_PINCH_END,
|
2021-05-27 19:20:11 +02:00
|
|
|
3);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(!libinput_event_gesture_get_cancelled(gevent));
|
2016-01-07 15:00:53 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
static void
|
2021-05-27 19:20:23 +02:00
|
|
|
test_gesture_pinch_4fg(int cardinal, enum hold_gesture_behaviour hold)
|
2016-01-07 15:00:53 +10:00
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_gesture *gevent;
|
|
|
|
|
double dx, dy;
|
|
|
|
|
double dir_x, dir_y;
|
|
|
|
|
int i;
|
|
|
|
|
double scale, oldscale;
|
|
|
|
|
double angle;
|
2019-06-20 14:15:02 +10:00
|
|
|
int cardinals[NCARDINALS][2] = {
|
2016-01-07 15:00:53 +10:00
|
|
|
{ 0, 30 },
|
|
|
|
|
{ 30, 30 },
|
|
|
|
|
{ 30, 0 },
|
|
|
|
|
{ 30, -30 },
|
|
|
|
|
{ 0, -30 },
|
|
|
|
|
{ -30, -30 },
|
|
|
|
|
{ -30, 0 },
|
|
|
|
|
{ -30, 30 },
|
|
|
|
|
};
|
|
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
if (litest_slot_count(dev) < 4)
|
2016-01-07 15:00:53 +10:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
dir_x = cardinals[cardinal][0];
|
|
|
|
|
dir_y = cardinals[cardinal][1];
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 50 + dir_x, 50 + dir_y);
|
|
|
|
|
litest_touch_down(dev, 1, 50 - dir_x, 50 - dir_y);
|
|
|
|
|
litest_touch_down(dev, 2, 51 - dir_x, 51 - dir_y);
|
2021-05-27 19:20:11 +02:00
|
|
|
litest_touch_down(dev, 3, 52 - dir_x, 52 - dir_y);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
2021-05-27 19:20:23 +02:00
|
|
|
if (hold == HOLD_GESTURE_REQUIRE)
|
|
|
|
|
litest_timeout_gesture_hold();
|
|
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
for (i = 0; i < 7; i++) {
|
2016-01-07 15:00:53 +10:00
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
if (dir_x > 0.0)
|
|
|
|
|
dir_x -= 2;
|
|
|
|
|
else if (dir_x < 0.0)
|
|
|
|
|
dir_x += 2;
|
|
|
|
|
if (dir_y > 0.0)
|
|
|
|
|
dir_y -= 2;
|
|
|
|
|
else if (dir_y < 0.0)
|
|
|
|
|
dir_y += 2;
|
|
|
|
|
litest_touch_move(dev,
|
|
|
|
|
0,
|
|
|
|
|
50 + dir_x,
|
|
|
|
|
50 + dir_y);
|
|
|
|
|
litest_touch_move(dev,
|
|
|
|
|
1,
|
|
|
|
|
50 - dir_x,
|
|
|
|
|
50 - dir_y);
|
|
|
|
|
litest_touch_move(dev,
|
|
|
|
|
2,
|
|
|
|
|
51 - dir_x,
|
|
|
|
|
51 - dir_y);
|
2021-05-27 19:20:11 +02:00
|
|
|
litest_touch_move(dev,
|
|
|
|
|
3,
|
|
|
|
|
52 - dir_x,
|
|
|
|
|
52 - dir_y);
|
2016-01-07 15:00:53 +10:00
|
|
|
litest_pop_event_frame(dev);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-01-07 15:00:53 +10:00
|
|
|
}
|
|
|
|
|
|
2021-05-27 19:20:23 +02:00
|
|
|
if (hold == HOLD_GESTURE_REQUIRE) {
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_BEGIN,
|
|
|
|
|
4);
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_END,
|
|
|
|
|
4);
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-07 15:00:53 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_PINCH_BEGIN,
|
2021-05-27 19:20:11 +02:00
|
|
|
4);
|
2016-01-07 15:00:53 +10:00
|
|
|
dx = libinput_event_gesture_get_dx(gevent);
|
|
|
|
|
dy = libinput_event_gesture_get_dy(gevent);
|
|
|
|
|
scale = libinput_event_gesture_get_scale(gevent);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx == 0.0);
|
|
|
|
|
litest_assert(dy == 0.0);
|
|
|
|
|
litest_assert(scale == 1.0);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
while ((event = libinput_get_event(li)) != NULL) {
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_PINCH_UPDATE,
|
2021-05-27 19:20:11 +02:00
|
|
|
4);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
|
|
|
|
oldscale = scale;
|
|
|
|
|
scale = libinput_event_gesture_get_scale(gevent);
|
|
|
|
|
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(scale < oldscale);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
|
|
|
|
angle = libinput_event_gesture_get_angle_delta(gevent);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert_double_le(fabs(angle), 1.0);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-01-07 15:00:53 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
litest_touch_up(dev, 2);
|
2021-05-27 19:20:11 +02:00
|
|
|
litest_touch_up(dev, 3);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-01-07 15:00:53 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_PINCH_END,
|
2021-05-27 19:20:11 +02:00
|
|
|
4);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(!libinput_event_gesture_get_cancelled(gevent));
|
2016-01-07 15:00:53 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
static void
|
2021-05-27 19:20:23 +02:00
|
|
|
test_gesture_spread(int cardinal, enum hold_gesture_behaviour hold)
|
2016-01-07 15:00:53 +10:00
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_gesture *gevent;
|
|
|
|
|
double dx, dy;
|
|
|
|
|
double dir_x, dir_y;
|
|
|
|
|
int i;
|
|
|
|
|
double scale, oldscale;
|
|
|
|
|
double angle;
|
2019-06-20 14:15:02 +10:00
|
|
|
int cardinals[NCARDINALS][2] = {
|
2016-01-07 15:00:53 +10:00
|
|
|
{ 0, 30 },
|
|
|
|
|
{ 30, 30 },
|
|
|
|
|
{ 30, 0 },
|
|
|
|
|
{ 30, -30 },
|
|
|
|
|
{ 0, -30 },
|
|
|
|
|
{ -30, -30 },
|
|
|
|
|
{ -30, 0 },
|
|
|
|
|
{ -30, 30 },
|
|
|
|
|
};
|
|
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
if (litest_slot_count(dev) < 2 ||
|
|
|
|
|
!libinput_device_has_capability(dev->libinput_device,
|
|
|
|
|
LIBINPUT_DEVICE_CAP_GESTURE))
|
2016-01-07 15:00:53 +10:00
|
|
|
return;
|
|
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
/* If the device is too small to provide a finger spread wide enough
|
|
|
|
|
* to avoid the scroll bias, skip the test */
|
|
|
|
|
if (cardinal == E || cardinal == W) {
|
|
|
|
|
double w = 0, h = 0;
|
|
|
|
|
libinput_device_get_size(dev->libinput_device, &w, &h);
|
|
|
|
|
/* 0.6 because the code below gives us points like 20/y and
|
|
|
|
|
* 80/y. 45 because the threshold in the code is 40mm */
|
|
|
|
|
if (w * 0.6 < 45)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-07 15:00:53 +10:00
|
|
|
dir_x = cardinals[cardinal][0];
|
|
|
|
|
dir_y = cardinals[cardinal][1];
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 50 + dir_x, 50 + dir_y);
|
|
|
|
|
litest_touch_down(dev, 1, 50 - dir_x, 50 - dir_y);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
2021-05-27 19:20:23 +02:00
|
|
|
if (hold == HOLD_GESTURE_REQUIRE)
|
|
|
|
|
litest_timeout_gesture_hold();
|
|
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
for (i = 0; i < 15; i++) {
|
2016-01-07 15:00:53 +10:00
|
|
|
litest_push_event_frame(dev);
|
|
|
|
|
if (dir_x > 0.0)
|
2021-05-27 19:20:11 +02:00
|
|
|
dir_x += 1;
|
2016-01-07 15:00:53 +10:00
|
|
|
else if (dir_x < 0.0)
|
2021-05-27 19:20:11 +02:00
|
|
|
dir_x -= 1;
|
2016-01-07 15:00:53 +10:00
|
|
|
if (dir_y > 0.0)
|
2021-05-27 19:20:11 +02:00
|
|
|
dir_y += 1;
|
2016-01-07 15:00:53 +10:00
|
|
|
else if (dir_y < 0.0)
|
2021-05-27 19:20:11 +02:00
|
|
|
dir_y -= 1;
|
2016-01-07 15:00:53 +10:00
|
|
|
litest_touch_move(dev,
|
|
|
|
|
0,
|
|
|
|
|
50 + dir_x,
|
|
|
|
|
50 + dir_y);
|
|
|
|
|
litest_touch_move(dev,
|
|
|
|
|
1,
|
|
|
|
|
50 - dir_x,
|
|
|
|
|
50 - dir_y);
|
|
|
|
|
litest_pop_event_frame(dev);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-01-07 15:00:53 +10:00
|
|
|
}
|
|
|
|
|
|
2021-05-27 19:20:23 +02:00
|
|
|
if (hold == HOLD_GESTURE_REQUIRE) {
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_BEGIN,
|
|
|
|
|
2);
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_END,
|
|
|
|
|
2);
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-07 15:00:53 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_PINCH_BEGIN,
|
2021-05-27 19:20:11 +02:00
|
|
|
2);
|
2016-01-07 15:00:53 +10:00
|
|
|
dx = libinput_event_gesture_get_dx(gevent);
|
|
|
|
|
dy = libinput_event_gesture_get_dy(gevent);
|
|
|
|
|
scale = libinput_event_gesture_get_scale(gevent);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx == 0.0);
|
|
|
|
|
litest_assert(dy == 0.0);
|
|
|
|
|
litest_assert(scale == 1.0);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
while ((event = libinput_get_event(li)) != NULL) {
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_PINCH_UPDATE,
|
2021-05-27 19:20:11 +02:00
|
|
|
2);
|
2016-01-07 15:00:53 +10:00
|
|
|
oldscale = scale;
|
|
|
|
|
scale = libinput_event_gesture_get_scale(gevent);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(scale > oldscale);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
|
|
|
|
angle = libinput_event_gesture_get_angle_delta(gevent);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert_double_le(fabs(angle), 1.0);
|
2016-01-07 15:00:53 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-01-07 15:00:53 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
litest_touch_up(dev, 1);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2016-01-07 15:00:53 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_PINCH_END,
|
2021-05-27 19:20:11 +02:00
|
|
|
2);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(!libinput_event_gesture_get_cancelled(gevent));
|
2016-01-07 15:00:53 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
2021-05-27 19:20:11 +02:00
|
|
|
|
|
|
|
|
static void
|
2021-05-27 19:20:23 +02:00
|
|
|
test_gesture_3fg_buttonarea_scroll(enum hold_gesture_behaviour hold)
|
2021-05-27 19:20:11 +02:00
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
if (litest_slot_count(dev) < 3)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
litest_enable_buttonareas(dev);
|
|
|
|
|
litest_enable_2fg_scroll(dev);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 40, 20);
|
|
|
|
|
litest_touch_down(dev, 1, 30, 20);
|
|
|
|
|
/* third finger in btnarea */
|
|
|
|
|
litest_touch_down(dev, 2, 50, 99);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-27 19:20:23 +02:00
|
|
|
|
|
|
|
|
if (hold == HOLD_GESTURE_REQUIRE)
|
|
|
|
|
litest_timeout_gesture_hold();
|
|
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
litest_touch_move_two_touches(dev, 40, 20, 30, 20, 0, 40, 10);
|
|
|
|
|
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
litest_touch_up(dev, 1);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-27 19:20:23 +02:00
|
|
|
|
|
|
|
|
if (hold == HOLD_GESTURE_REQUIRE) {
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_BEGIN,
|
|
|
|
|
2);
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_END,
|
|
|
|
|
2);
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-22 10:24:54 +10:00
|
|
|
litest_assert_scroll(li,
|
|
|
|
|
LIBINPUT_EVENT_POINTER_SCROLL_FINGER,
|
|
|
|
|
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
|
|
|
|
|
4);
|
2021-05-27 19:20:11 +02:00
|
|
|
}
|
|
|
|
|
|
2021-05-27 19:20:31 +02:00
|
|
|
static void
|
|
|
|
|
test_gesture_hold(int nfingers)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
if (litest_slot_count(dev) < nfingers)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
switch (nfingers) {
|
|
|
|
|
case 4:
|
|
|
|
|
litest_touch_down(dev, 3, 70, 30);
|
2021-07-22 15:00:32 +10:00
|
|
|
_fallthrough_;
|
2021-05-27 19:20:31 +02:00
|
|
|
case 3:
|
|
|
|
|
litest_touch_down(dev, 2, 60, 30);
|
2021-07-22 15:00:32 +10:00
|
|
|
_fallthrough_;
|
2021-05-27 19:20:31 +02:00
|
|
|
case 2:
|
|
|
|
|
litest_touch_down(dev, 1, 50, 30);
|
2021-07-22 15:00:32 +10:00
|
|
|
_fallthrough_;
|
2021-05-27 19:20:31 +02:00
|
|
|
case 1:
|
|
|
|
|
litest_touch_down(dev, 0, 40, 30);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-27 19:20:31 +02:00
|
|
|
litest_timeout_gesture_hold();
|
|
|
|
|
|
|
|
|
|
if (libinput_device_has_capability(dev->libinput_device,
|
|
|
|
|
LIBINPUT_DEVICE_CAP_GESTURE)) {
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_BEGIN,
|
|
|
|
|
nfingers);
|
|
|
|
|
} else {
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (nfingers) {
|
|
|
|
|
case 4:
|
|
|
|
|
litest_touch_up(dev, 3);
|
2021-07-22 15:00:32 +10:00
|
|
|
_fallthrough_;
|
2021-05-27 19:20:31 +02:00
|
|
|
case 3:
|
|
|
|
|
litest_touch_up(dev, 2);
|
2021-07-22 15:00:32 +10:00
|
|
|
_fallthrough_;
|
2021-05-27 19:20:31 +02:00
|
|
|
case 2:
|
|
|
|
|
litest_touch_up(dev, 1);
|
2021-07-22 15:00:32 +10:00
|
|
|
_fallthrough_;
|
2021-05-27 19:20:31 +02:00
|
|
|
case 1:
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-27 19:20:31 +02:00
|
|
|
if (libinput_device_has_capability(dev->libinput_device,
|
|
|
|
|
LIBINPUT_DEVICE_CAP_GESTURE)) {
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_END,
|
|
|
|
|
nfingers);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
test_gesture_hold_cancel(int nfingers)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
int last_finger = (nfingers - 1);
|
|
|
|
|
|
|
|
|
|
if (litest_slot_count(dev) < nfingers)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
switch (nfingers) {
|
|
|
|
|
case 4:
|
|
|
|
|
litest_touch_down(dev, 3, 70, 30);
|
2021-07-22 15:00:32 +10:00
|
|
|
_fallthrough_;
|
2021-05-27 19:20:31 +02:00
|
|
|
case 3:
|
|
|
|
|
litest_touch_down(dev, 2, 60, 30);
|
2021-07-22 15:00:32 +10:00
|
|
|
_fallthrough_;
|
2021-05-27 19:20:31 +02:00
|
|
|
case 2:
|
|
|
|
|
litest_touch_down(dev, 1, 50, 30);
|
2021-07-22 15:00:32 +10:00
|
|
|
_fallthrough_;
|
2021-05-27 19:20:31 +02:00
|
|
|
case 1:
|
|
|
|
|
litest_touch_down(dev, 0, 40, 30);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-27 19:20:31 +02:00
|
|
|
litest_timeout_gesture_hold();
|
|
|
|
|
|
|
|
|
|
litest_touch_up(dev, last_finger);
|
|
|
|
|
|
|
|
|
|
if (libinput_device_has_capability(dev->libinput_device,
|
|
|
|
|
LIBINPUT_DEVICE_CAP_GESTURE)) {
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_BEGIN,
|
|
|
|
|
nfingers);
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_END,
|
|
|
|
|
nfingers);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
START_TEST(gestures_cap)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput_device *device = dev->libinput_device;
|
|
|
|
|
|
|
|
|
|
if (libevdev_has_property(dev->evdev, INPUT_PROP_SEMI_MT))
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(!libinput_device_has_capability(device,
|
2021-05-27 19:20:11 +02:00
|
|
|
LIBINPUT_DEVICE_CAP_GESTURE));
|
|
|
|
|
else
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(libinput_device_has_capability(device,
|
2021-05-27 19:20:11 +02:00
|
|
|
LIBINPUT_DEVICE_CAP_GESTURE));
|
|
|
|
|
}
|
2016-01-07 15:00:53 +10:00
|
|
|
END_TEST
|
|
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
START_TEST(gestures_nocap)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput_device *device = dev->libinput_device;
|
|
|
|
|
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(!libinput_device_has_capability(device,
|
2021-05-27 19:20:11 +02:00
|
|
|
LIBINPUT_DEVICE_CAP_GESTURE));
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_swipe_3fg)
|
|
|
|
|
{
|
|
|
|
|
int cardinal = _i; /* ranged test */
|
2021-05-27 19:20:23 +02:00
|
|
|
test_gesture_swipe_3fg(cardinal, HOLD_GESTURE_IGNORE);
|
2021-05-27 19:20:11 +02:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_swipe_3fg_btntool)
|
2015-07-07 11:52:05 +10:00
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_gesture *gevent;
|
|
|
|
|
double dx, dy;
|
|
|
|
|
int cardinal = _i; /* ranged test */
|
|
|
|
|
double dir_x, dir_y;
|
2019-06-20 14:15:02 +10:00
|
|
|
int cardinals[NCARDINALS][2] = {
|
2016-01-07 14:39:52 +10:00
|
|
|
{ 0, 30 },
|
|
|
|
|
{ 30, 30 },
|
|
|
|
|
{ 30, 0 },
|
|
|
|
|
{ 30, -30 },
|
|
|
|
|
{ 0, -30 },
|
|
|
|
|
{ -30, -30 },
|
|
|
|
|
{ -30, 0 },
|
|
|
|
|
{ -30, 30 },
|
2015-07-07 11:52:05 +10:00
|
|
|
};
|
|
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
if (litest_slot_count(dev) > 2 ||
|
|
|
|
|
!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP) ||
|
2016-01-07 14:39:52 +10:00
|
|
|
!libinput_device_has_capability(dev->libinput_device,
|
|
|
|
|
LIBINPUT_DEVICE_CAP_GESTURE))
|
2015-07-07 11:52:05 +10:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
dir_x = cardinals[cardinal][0];
|
|
|
|
|
dir_y = cardinals[cardinal][1];
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
litest_touch_down(dev, 0, 40, 40);
|
|
|
|
|
litest_touch_down(dev, 1, 50, 40);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-27 19:20:11 +02:00
|
|
|
litest_touch_move_two_touches(dev, 40, 40, 50, 40, dir_x, dir_y, 10);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-07 11:52:05 +10:00
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN,
|
|
|
|
|
3);
|
|
|
|
|
dx = libinput_event_gesture_get_dx(gevent);
|
|
|
|
|
dy = libinput_event_gesture_get_dy(gevent);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx == 0.0);
|
|
|
|
|
litest_assert(dy == 0.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
while ((event = libinput_get_event(li)) != NULL) {
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE,
|
|
|
|
|
3);
|
|
|
|
|
|
|
|
|
|
dx = libinput_event_gesture_get_dx(gevent);
|
|
|
|
|
dy = libinput_event_gesture_get_dy(gevent);
|
|
|
|
|
if (dir_x == 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx == 0.0);
|
2015-07-07 11:52:05 +10:00
|
|
|
else if (dir_x < 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx < 0.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
else if (dir_x > 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx > 0.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
|
|
|
|
|
if (dir_y == 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy == 0.0);
|
2015-07-07 11:52:05 +10:00
|
|
|
else if (dir_y < 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy < 0.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
else if (dir_y > 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy > 0.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
|
|
|
|
|
dx = libinput_event_gesture_get_dx_unaccelerated(gevent);
|
|
|
|
|
dy = libinput_event_gesture_get_dy_unaccelerated(gevent);
|
|
|
|
|
if (dir_x == 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx == 0.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
else if (dir_x < 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx < 0.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
else if (dir_x > 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx > 0.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
|
|
|
|
|
if (dir_y == 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy == 0.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
else if (dir_y < 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy < 0.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
else if (dir_y > 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy > 0.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
2015-07-07 11:52:05 +10:00
|
|
|
}
|
|
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
litest_touch_up(dev, 1);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-07 11:52:05 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
2021-05-27 19:20:11 +02:00
|
|
|
LIBINPUT_EVENT_GESTURE_SWIPE_END,
|
|
|
|
|
3);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(!libinput_event_gesture_get_cancelled(gevent));
|
2021-05-27 19:20:11 +02:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_swipe_3fg_btntool_pinch_like)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_gesture *gevent;
|
|
|
|
|
|
|
|
|
|
if (litest_slot_count(dev) > 2 ||
|
|
|
|
|
!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_TRIPLETAP) ||
|
|
|
|
|
!libinput_device_has_capability(dev->libinput_device,
|
|
|
|
|
LIBINPUT_DEVICE_CAP_GESTURE))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* Technically a pinch position + pinch movement, but expect swipe
|
|
|
|
|
* for nfingers > nslots */
|
|
|
|
|
litest_touch_down(dev, 0, 20, 60);
|
|
|
|
|
litest_touch_down(dev, 1, 50, 20);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-27 19:20:11 +02:00
|
|
|
litest_touch_move_to(dev, 0, 20, 60, 10, 80, 20);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-27 19:20:11 +02:00
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
litest_is_gesture_event(event, LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN, 3);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
while ((event = libinput_get_event(li)) != NULL) {
|
|
|
|
|
litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE,
|
|
|
|
|
3);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
litest_touch_up(dev, 1);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-27 19:20:11 +02:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_SWIPE_END,
|
|
|
|
|
3);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(!libinput_event_gesture_get_cancelled(gevent));
|
2021-05-27 19:20:11 +02:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_swipe_4fg)
|
|
|
|
|
{
|
|
|
|
|
int cardinal = _i; /* ranged test */
|
2021-05-27 19:20:23 +02:00
|
|
|
test_gesture_swipe_4fg(cardinal, HOLD_GESTURE_IGNORE);
|
2021-05-27 19:20:11 +02:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_swipe_4fg_btntool)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_gesture *gevent;
|
|
|
|
|
double dx, dy;
|
|
|
|
|
int cardinal = _i; /* ranged test */
|
|
|
|
|
double dir_x, dir_y;
|
|
|
|
|
int cardinals[NCARDINALS][2] = {
|
|
|
|
|
{ 0, 30 },
|
|
|
|
|
{ 30, 30 },
|
|
|
|
|
{ 30, 0 },
|
|
|
|
|
{ 30, -30 },
|
|
|
|
|
{ 0, -30 },
|
|
|
|
|
{ -30, -30 },
|
|
|
|
|
{ -30, 0 },
|
|
|
|
|
{ -30, 30 },
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (litest_slot_count(dev) > 2 ||
|
|
|
|
|
!libevdev_has_event_code(dev->evdev, EV_KEY, BTN_TOOL_QUADTAP) ||
|
|
|
|
|
!libinput_device_has_capability(dev->libinput_device,
|
|
|
|
|
LIBINPUT_DEVICE_CAP_GESTURE))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
dir_x = cardinals[cardinal][0];
|
|
|
|
|
dir_y = cardinals[cardinal][1];
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 40, 40);
|
|
|
|
|
litest_touch_down(dev, 1, 50, 40);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_QUADTAP, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
|
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-27 19:20:11 +02:00
|
|
|
litest_touch_move_two_touches(dev, 40, 40, 50, 40, dir_x, dir_y, 10);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-27 19:20:11 +02:00
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN,
|
|
|
|
|
4);
|
2015-07-07 11:52:05 +10:00
|
|
|
dx = libinput_event_gesture_get_dx(gevent);
|
|
|
|
|
dy = libinput_event_gesture_get_dy(gevent);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx == 0.0);
|
|
|
|
|
litest_assert(dy == 0.0);
|
2015-07-07 11:52:05 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
|
|
|
|
|
while ((event = libinput_get_event(li)) != NULL) {
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
2021-05-27 19:20:11 +02:00
|
|
|
LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE,
|
|
|
|
|
4);
|
2015-07-07 11:52:05 +10:00
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
dx = libinput_event_gesture_get_dx(gevent);
|
|
|
|
|
dy = libinput_event_gesture_get_dy(gevent);
|
|
|
|
|
if (dir_x == 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx == 0.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
else if (dir_x < 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx < 0.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
else if (dir_x > 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx > 0.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
|
|
|
|
|
if (dir_y == 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy == 0.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
else if (dir_y < 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy < 0.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
else if (dir_y > 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy > 0.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
|
|
|
|
|
dx = libinput_event_gesture_get_dx_unaccelerated(gevent);
|
|
|
|
|
dy = libinput_event_gesture_get_dy_unaccelerated(gevent);
|
|
|
|
|
if (dir_x == 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx == 0.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
else if (dir_x < 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx < 0.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
else if (dir_x > 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dx > 0.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
|
|
|
|
|
if (dir_y == 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy == 0.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
else if (dir_y < 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy < 0.0);
|
2021-05-27 19:20:11 +02:00
|
|
|
else if (dir_y > 0.0)
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(dy > 0.0);
|
2015-07-07 11:52:05 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
litest_touch_up(dev, 1);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-07 11:52:05 +10:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
2021-05-27 19:20:11 +02:00
|
|
|
LIBINPUT_EVENT_GESTURE_SWIPE_END,
|
|
|
|
|
4);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert(!libinput_event_gesture_get_cancelled(gevent));
|
2015-07-07 11:52:05 +10:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2021-05-27 19:20:11 +02:00
|
|
|
START_TEST(gestures_pinch)
|
|
|
|
|
{
|
|
|
|
|
int cardinal = _i; /* ranged test */
|
2021-05-27 19:20:23 +02:00
|
|
|
test_gesture_pinch_2fg(cardinal, HOLD_GESTURE_IGNORE);
|
2021-05-27 19:20:11 +02:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_pinch_3fg)
|
|
|
|
|
{
|
|
|
|
|
int cardinal = _i; /* ranged test */
|
2021-05-27 19:20:23 +02:00
|
|
|
test_gesture_pinch_3fg(cardinal, HOLD_GESTURE_IGNORE);
|
2021-05-27 19:20:11 +02:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_pinch_4fg)
|
|
|
|
|
{
|
|
|
|
|
int cardinal = _i; /* ranged test */
|
2021-05-27 19:20:23 +02:00
|
|
|
test_gesture_pinch_4fg(cardinal, HOLD_GESTURE_IGNORE);
|
2021-05-27 19:20:11 +02:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_spread)
|
|
|
|
|
{
|
|
|
|
|
int cardinal = _i; /* ranged test */
|
2021-05-27 19:20:23 +02:00
|
|
|
test_gesture_spread(cardinal, HOLD_GESTURE_IGNORE);
|
2021-05-27 19:20:11 +02:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2015-07-27 17:51:52 +08:00
|
|
|
START_TEST(gestures_time_usec)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
struct libinput_event_gesture *gevent;
|
2016-04-08 15:51:26 +08:00
|
|
|
uint64_t time_usec;
|
2015-07-27 17:51:52 +08:00
|
|
|
|
2020-01-09 11:13:18 +10:00
|
|
|
if (litest_slot_count(dev) < 3)
|
2015-07-27 17:51:52 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 40, 40);
|
2016-01-08 11:06:49 +10:00
|
|
|
litest_touch_down(dev, 1, 50, 40);
|
|
|
|
|
litest_touch_down(dev, 2, 60, 40);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_three_touches(dev, 40, 40, 50, 40, 60, 40, 0, 30,
|
|
|
|
|
30);
|
2015-07-27 17:51:52 +08:00
|
|
|
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2015-07-27 17:51:52 +08:00
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN,
|
|
|
|
|
3);
|
2016-04-08 15:51:26 +08:00
|
|
|
time_usec = libinput_event_gesture_get_time_usec(gevent);
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert_int_eq(libinput_event_gesture_get_time(gevent),
|
2016-04-08 15:51:26 +08:00
|
|
|
(uint32_t) (time_usec / 1000));
|
2015-07-27 17:51:52 +08:00
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2016-01-29 11:18:35 +10:00
|
|
|
START_TEST(gestures_3fg_buttonarea_scroll)
|
|
|
|
|
{
|
2021-05-27 19:20:23 +02:00
|
|
|
test_gesture_3fg_buttonarea_scroll(HOLD_GESTURE_IGNORE);
|
2016-01-29 11:18:35 +10:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_3fg_buttonarea_scroll_btntool)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
2020-01-09 11:13:18 +10:00
|
|
|
if (litest_slot_count(dev) > 2)
|
2016-01-29 11:18:35 +10:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
litest_enable_buttonareas(dev);
|
|
|
|
|
litest_enable_2fg_scroll(dev);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* first finger in btnarea */
|
|
|
|
|
litest_touch_down(dev, 0, 20, 99);
|
|
|
|
|
litest_touch_down(dev, 1, 30, 20);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_DOUBLETAP, 0);
|
|
|
|
|
litest_event(dev, EV_KEY, BTN_TOOL_TRIPLETAP, 1);
|
|
|
|
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.
Cocinelle spatch files were variants of:
@@
expression A, B, C, D, E, F, G, H, I, J, K;
@@
- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)
The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 09:16:52 +10:00
|
|
|
litest_touch_move_to(dev, 1, 30, 20, 30, 70, 10);
|
2016-01-29 11:18:35 +10:00
|
|
|
|
|
|
|
|
litest_touch_up(dev, 1);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2018-11-22 10:24:54 +10:00
|
|
|
litest_assert_scroll(li,
|
|
|
|
|
LIBINPUT_EVENT_POINTER_SCROLL_FINGER,
|
|
|
|
|
LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
|
|
|
|
|
4);
|
2016-01-29 11:18:35 +10:00
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2021-03-15 17:23:48 +10:00
|
|
|
START_TEST(gestures_swipe_3fg_unaccel)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
struct libinput_event *event;
|
|
|
|
|
double reference_ux = 0, reference_uy = 0;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This magic number is an artifact of the acceleration code.
|
|
|
|
|
* The maximum factor in the touchpad accel profile is 4.8 times the
|
|
|
|
|
* speed setting (1.000875 at default setting 0). The factor
|
|
|
|
|
* applied to the const acceleration is the 0.9 baseline.
|
|
|
|
|
* So our two sets of coordinates are:
|
|
|
|
|
* accel = 4.8 * delta * normalize_magic
|
|
|
|
|
* unaccel = 0.9 * delta * normalize_magic
|
|
|
|
|
*
|
|
|
|
|
* Since delta and the normalization magic are the same for both,
|
|
|
|
|
* our accelerated deltas can be a maximum of 4.8/0.9 bigger than
|
|
|
|
|
* the unaccelerated deltas.
|
|
|
|
|
*
|
|
|
|
|
* If any of the accel methods numbers change, this will have to
|
|
|
|
|
* change here too.
|
|
|
|
|
*/
|
|
|
|
|
const double max_factor = 5.34;
|
|
|
|
|
|
|
|
|
|
if (litest_slot_count(dev) < 3)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
litest_touch_down(dev, 0, 40, 20);
|
|
|
|
|
litest_touch_down(dev, 1, 50, 20);
|
|
|
|
|
litest_touch_down(dev, 2, 60, 20);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-03-15 17:23:48 +10:00
|
|
|
litest_touch_move_three_touches(dev,
|
|
|
|
|
40, 20,
|
|
|
|
|
50, 20,
|
|
|
|
|
60, 20,
|
|
|
|
|
30, 40,
|
|
|
|
|
10);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-03-15 17:23:48 +10:00
|
|
|
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_SWIPE_BEGIN,
|
|
|
|
|
3);
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
event = libinput_get_event(li);
|
|
|
|
|
do {
|
|
|
|
|
struct libinput_event_gesture *gevent;
|
|
|
|
|
double dx, dy;
|
|
|
|
|
double ux, uy;
|
|
|
|
|
|
|
|
|
|
gevent = litest_is_gesture_event(event,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_SWIPE_UPDATE,
|
|
|
|
|
3);
|
|
|
|
|
dx = libinput_event_gesture_get_dx(gevent);
|
|
|
|
|
dy = libinput_event_gesture_get_dy(gevent);
|
|
|
|
|
ux = libinput_event_gesture_get_dx_unaccelerated(gevent);
|
|
|
|
|
uy = libinput_event_gesture_get_dy_unaccelerated(gevent);
|
|
|
|
|
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert_double_ne(ux, 0.0);
|
|
|
|
|
litest_assert_double_ne(uy, 0.0);
|
2021-03-15 17:23:48 +10:00
|
|
|
|
|
|
|
|
if (!reference_ux)
|
|
|
|
|
reference_ux = ux;
|
|
|
|
|
if (!reference_uy)
|
|
|
|
|
reference_uy = uy;
|
|
|
|
|
|
|
|
|
|
/* The unaccelerated delta should be the same for every
|
|
|
|
|
* event, but we have rounding errors since we only control
|
|
|
|
|
* input data as percentage of the touchpad size.
|
|
|
|
|
* so we just eyeball it */
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert_double_gt(ux, reference_ux - 2);
|
|
|
|
|
litest_assert_double_lt(ux, reference_ux + 2);
|
|
|
|
|
litest_assert_double_gt(uy, reference_uy - 2);
|
|
|
|
|
litest_assert_double_lt(uy, reference_uy + 2);
|
2021-03-15 17:23:48 +10:00
|
|
|
|
|
|
|
|
/* All our touchpads are large enough to make this is a fast
|
|
|
|
|
* swipe, we don't expect deceleration, unaccel should
|
|
|
|
|
* always be less than accel delta */
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert_double_lt(ux, dx);
|
|
|
|
|
litest_assert_double_lt(ux, dx);
|
2021-03-15 17:23:48 +10:00
|
|
|
|
|
|
|
|
/* Check our accelerated delta is within the expected
|
|
|
|
|
* maximum. */
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert_double_lt(dx, ux * max_factor);
|
|
|
|
|
litest_assert_double_lt(dy, uy * max_factor);
|
2021-03-15 17:23:48 +10:00
|
|
|
|
|
|
|
|
libinput_event_destroy(event);
|
|
|
|
|
} while ((event = libinput_get_event(li)));
|
|
|
|
|
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
litest_touch_up(dev, 1);
|
|
|
|
|
litest_touch_up(dev, 2);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2021-05-27 19:19:49 +02:00
|
|
|
START_TEST(gestures_hold_config_default_disabled)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput_device *device = dev->libinput_device;
|
|
|
|
|
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert_int_eq(libinput_device_config_gesture_hold_is_available(device),
|
2021-05-27 19:19:49 +02:00
|
|
|
0);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(libinput_device_config_gesture_get_hold_default_enabled(device),
|
2021-05-27 19:19:49 +02:00
|
|
|
LIBINPUT_CONFIG_HOLD_DISABLED);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(libinput_device_config_gesture_get_hold_default_enabled(device),
|
2021-05-27 19:19:49 +02:00
|
|
|
LIBINPUT_CONFIG_HOLD_DISABLED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_hold_config_default_enabled)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput_device *device = dev->libinput_device;
|
|
|
|
|
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert_int_eq(libinput_device_config_gesture_hold_is_available(device),
|
2021-05-27 19:19:49 +02:00
|
|
|
1);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(libinput_device_config_gesture_get_hold_default_enabled(device),
|
2021-05-27 19:19:49 +02:00
|
|
|
LIBINPUT_CONFIG_HOLD_ENABLED);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(libinput_device_config_gesture_get_hold_enabled(device),
|
2021-05-27 19:19:49 +02:00
|
|
|
LIBINPUT_CONFIG_HOLD_ENABLED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_hold_config_set_invalid)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput_device *device = dev->libinput_device;
|
|
|
|
|
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(libinput_device_config_gesture_set_hold_enabled(device, -1),
|
2021-05-27 19:19:49 +02:00
|
|
|
LIBINPUT_CONFIG_STATUS_INVALID);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(libinput_device_config_gesture_set_hold_enabled(device, 2),
|
2021-05-27 19:19:49 +02:00
|
|
|
LIBINPUT_CONFIG_STATUS_INVALID);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_hold_config_is_available)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput_device *device = dev->libinput_device;
|
|
|
|
|
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert_int_eq(libinput_device_config_gesture_hold_is_available(device),
|
2021-05-27 19:19:49 +02:00
|
|
|
1);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(libinput_device_config_gesture_get_hold_enabled(device),
|
2021-05-27 19:19:49 +02:00
|
|
|
LIBINPUT_CONFIG_HOLD_ENABLED);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(libinput_device_config_gesture_set_hold_enabled(device, LIBINPUT_CONFIG_HOLD_DISABLED),
|
2021-05-27 19:19:49 +02:00
|
|
|
LIBINPUT_CONFIG_STATUS_SUCCESS);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(libinput_device_config_gesture_get_hold_enabled(device),
|
2021-05-27 19:19:49 +02:00
|
|
|
LIBINPUT_CONFIG_HOLD_DISABLED);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_hold_config_is_not_available)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput_device *device = dev->libinput_device;
|
|
|
|
|
|
2024-09-16 16:20:26 +10:00
|
|
|
litest_assert_int_eq(libinput_device_config_gesture_hold_is_available(device),
|
2021-05-27 19:19:49 +02:00
|
|
|
0);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(libinput_device_config_gesture_get_hold_enabled(device),
|
2021-05-27 19:19:49 +02:00
|
|
|
LIBINPUT_CONFIG_HOLD_DISABLED);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(libinput_device_config_gesture_set_hold_enabled(device, LIBINPUT_CONFIG_HOLD_ENABLED),
|
2021-05-27 19:19:49 +02:00
|
|
|
LIBINPUT_CONFIG_STATUS_UNSUPPORTED);
|
2024-09-16 16:49:38 +10:00
|
|
|
litest_assert_enum_eq(libinput_device_config_gesture_set_hold_enabled(device, LIBINPUT_CONFIG_HOLD_DISABLED),
|
2021-05-27 19:19:49 +02:00
|
|
|
LIBINPUT_CONFIG_STATUS_SUCCESS);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2021-05-27 19:20:31 +02:00
|
|
|
START_TEST(gestures_hold)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
int nfingers = _i; /* ranged test */
|
|
|
|
|
|
|
|
|
|
litest_disable_tap(dev->libinput_device);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
test_gesture_hold(nfingers);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_hold_tap_enabled)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
int nfingers = _i; /* ranged test */
|
|
|
|
|
|
|
|
|
|
litest_enable_tap(dev->libinput_device);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
test_gesture_hold(nfingers);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_hold_cancel)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
int nfingers = _i; /* ranged test */
|
|
|
|
|
|
|
|
|
|
litest_disable_tap(dev->libinput_device);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
test_gesture_hold_cancel(nfingers);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_hold_cancel_tap_enabled)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
int nfingers = _i; /* ranged test */
|
|
|
|
|
|
|
|
|
|
litest_enable_tap(dev->libinput_device);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
test_gesture_hold_cancel(nfingers);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_hold_then_swipe_3fg)
|
|
|
|
|
{
|
|
|
|
|
int cardinal = _i; /* ranged test */
|
|
|
|
|
test_gesture_swipe_3fg(cardinal, HOLD_GESTURE_REQUIRE);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_hold_then_swipe_4fg)
|
|
|
|
|
{
|
|
|
|
|
int cardinal = _i; /* ranged test */
|
|
|
|
|
test_gesture_swipe_4fg(cardinal, HOLD_GESTURE_REQUIRE);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_hold_then_pinch_2fg)
|
|
|
|
|
{
|
|
|
|
|
int cardinal = _i; /* ranged test */
|
|
|
|
|
test_gesture_pinch_2fg(cardinal, HOLD_GESTURE_REQUIRE);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_hold_then_pinch_3fg)
|
|
|
|
|
{
|
|
|
|
|
int cardinal = _i; /* ranged test */
|
|
|
|
|
test_gesture_pinch_3fg(cardinal, HOLD_GESTURE_REQUIRE);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_hold_then_pinch_4fg)
|
|
|
|
|
{
|
|
|
|
|
int cardinal = _i; /* ranged test */
|
|
|
|
|
test_gesture_pinch_4fg(cardinal, HOLD_GESTURE_REQUIRE);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_hold_then_spread)
|
|
|
|
|
{
|
|
|
|
|
int cardinal = _i; /* ranged test */
|
|
|
|
|
test_gesture_spread(cardinal, HOLD_GESTURE_REQUIRE);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_hold_then_3fg_buttonarea_scroll)
|
|
|
|
|
{
|
|
|
|
|
test_gesture_3fg_buttonarea_scroll(HOLD_GESTURE_REQUIRE);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2021-05-27 19:20:37 +02:00
|
|
|
START_TEST(gestures_hold_once_on_double_tap)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
if (!libinput_device_has_capability(dev->libinput_device,
|
|
|
|
|
LIBINPUT_DEVICE_CAP_GESTURE))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
litest_enable_tap(dev->libinput_device);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
/* First tap, a hold gesture must be generated */
|
|
|
|
|
litest_touch_down(dev, 0, 50, 50);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-27 19:20:37 +02:00
|
|
|
litest_timeout_gesture_quick_hold();
|
|
|
|
|
litest_touch_up(dev, 0);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-27 19:20:37 +02:00
|
|
|
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_BEGIN,
|
|
|
|
|
1);
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_END,
|
|
|
|
|
1);
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT,
|
|
|
|
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT,
|
|
|
|
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
|
|
|
|
|
/* Double tap, don't generate an extra hold gesture */
|
|
|
|
|
litest_touch_down(dev, 0, 50, 50);
|
|
|
|
|
litest_touch_up(dev, 0);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-27 19:20:37 +02:00
|
|
|
litest_timeout_gesture_quick_hold();
|
|
|
|
|
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT,
|
|
|
|
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_button_event(li, BTN_LEFT,
|
|
|
|
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_hold_once_tap_n_drag)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
int nfingers = _i; /* ranged test */
|
|
|
|
|
unsigned int button = 0;
|
|
|
|
|
|
|
|
|
|
if (nfingers > litest_slot_count(dev))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!libinput_device_has_capability(dev->libinput_device,
|
|
|
|
|
LIBINPUT_DEVICE_CAP_GESTURE))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
litest_enable_tap(dev->libinput_device);
|
|
|
|
|
litest_disable_drag_lock(dev->libinput_device);
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
switch (nfingers) {
|
|
|
|
|
case 1:
|
|
|
|
|
button = BTN_LEFT;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
button = BTN_RIGHT;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
button = BTN_MIDDLE;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
abort();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (nfingers) {
|
|
|
|
|
case 3:
|
|
|
|
|
litest_touch_down(dev, 2, 60, 30);
|
2021-07-22 15:00:32 +10:00
|
|
|
_fallthrough_;
|
2021-05-27 19:20:37 +02:00
|
|
|
case 2:
|
|
|
|
|
litest_touch_down(dev, 1, 50, 30);
|
2021-07-22 15:00:32 +10:00
|
|
|
_fallthrough_;
|
2021-05-27 19:20:37 +02:00
|
|
|
case 1:
|
|
|
|
|
litest_touch_down(dev, 0, 40, 30);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-27 19:20:37 +02:00
|
|
|
litest_timeout_gesture_quick_hold();
|
|
|
|
|
|
|
|
|
|
switch (nfingers) {
|
|
|
|
|
case 3:
|
|
|
|
|
litest_touch_up(dev, 2);
|
2021-07-22 15:00:32 +10:00
|
|
|
_fallthrough_;
|
2021-05-27 19:20:37 +02:00
|
|
|
case 2:
|
|
|
|
|
litest_touch_up(dev, 1);
|
2021-07-22 15:00:32 +10:00
|
|
|
_fallthrough_;
|
2021-05-27 19:20:37 +02:00
|
|
|
case 1:
|
|
|
|
|
litest_touch_up(dev, 0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-27 19:20:37 +02:00
|
|
|
|
|
|
|
|
/* "Quick" hold gestures are only generated when using 1 or 2 fingers */
|
|
|
|
|
if (nfingers == 1 || nfingers == 2) {
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_BEGIN,
|
|
|
|
|
nfingers);
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_END,
|
|
|
|
|
nfingers);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Tap and drag, don't generate an extra hold gesture */
|
|
|
|
|
litest_touch_down(dev, 0, 50, 50);
|
|
|
|
|
litest_touch_move_to(dev, 0, 50, 50, 80, 80, 20);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-27 19:20:37 +02:00
|
|
|
|
|
|
|
|
litest_assert_button_event(li, button,
|
|
|
|
|
LIBINPUT_BUTTON_STATE_PRESSED);
|
|
|
|
|
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
|
|
|
|
|
|
|
|
|
|
litest_touch_up(dev, 0);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-27 19:20:37 +02:00
|
|
|
|
|
|
|
|
litest_assert_button_event(li, button,
|
|
|
|
|
LIBINPUT_BUTTON_STATE_RELEASED);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2021-05-31 17:58:39 +02:00
|
|
|
START_TEST(gestures_hold_and_motion_before_timeout)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
if (!libinput_device_has_capability(dev->libinput_device,
|
|
|
|
|
LIBINPUT_DEVICE_CAP_GESTURE))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 50, 50);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-31 17:58:39 +02:00
|
|
|
|
|
|
|
|
litest_touch_move_to(dev, 0, 50, 50, 51, 51, 1);
|
|
|
|
|
litest_touch_move_to(dev, 0, 51, 51, 50, 50, 1);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-31 17:58:39 +02:00
|
|
|
|
|
|
|
|
litest_timeout_gesture_quick_hold();
|
|
|
|
|
|
2024-09-11 16:19:33 +10:00
|
|
|
litest_drain_events_of_type(li, LIBINPUT_EVENT_POINTER_MOTION);
|
2021-05-31 17:58:39 +02:00
|
|
|
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_BEGIN,
|
|
|
|
|
1);
|
|
|
|
|
|
|
|
|
|
litest_touch_up(dev, 0);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-31 17:58:39 +02:00
|
|
|
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_END,
|
|
|
|
|
1);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
|
|
|
|
START_TEST(gestures_hold_and_motion_after_timeout)
|
|
|
|
|
{
|
|
|
|
|
struct litest_device *dev = litest_current_device();
|
|
|
|
|
struct libinput *li = dev->libinput;
|
|
|
|
|
|
|
|
|
|
if (!libinput_device_has_capability(dev->libinput_device,
|
|
|
|
|
LIBINPUT_DEVICE_CAP_GESTURE))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
litest_drain_events(li);
|
|
|
|
|
|
|
|
|
|
litest_touch_down(dev, 0, 50, 50);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-31 17:58:39 +02:00
|
|
|
litest_timeout_gesture_quick_hold();
|
|
|
|
|
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_BEGIN,
|
|
|
|
|
1);
|
|
|
|
|
|
|
|
|
|
litest_touch_move_to(dev, 0, 50, 50, 51, 51, 1);
|
|
|
|
|
litest_touch_move_to(dev, 0, 51, 51, 50, 50, 1);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-31 17:58:39 +02:00
|
|
|
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_MOTION);
|
|
|
|
|
|
|
|
|
|
litest_touch_up(dev, 0);
|
2024-09-13 15:13:38 +10:00
|
|
|
litest_dispatch(li);
|
2021-05-31 17:58:39 +02:00
|
|
|
|
|
|
|
|
litest_assert_gesture_event(li,
|
|
|
|
|
LIBINPUT_EVENT_GESTURE_HOLD_END,
|
|
|
|
|
1);
|
|
|
|
|
litest_assert_empty_queue(li);
|
|
|
|
|
}
|
|
|
|
|
END_TEST
|
|
|
|
|
|
2018-03-21 12:54:10 +10:00
|
|
|
TEST_COLLECTION(gestures)
|
2015-07-07 11:52:05 +10:00
|
|
|
{
|
2019-06-20 14:15:02 +10:00
|
|
|
struct range cardinals = { N, N + NCARDINALS };
|
2021-05-27 19:20:31 +02:00
|
|
|
struct range range_hold = { 1, 5 };
|
2021-05-27 19:20:37 +02:00
|
|
|
struct range range_multifinger_tap = {1, 4};
|
2015-07-07 11:52:05 +10:00
|
|
|
|
2021-02-05 14:51:02 +10:00
|
|
|
litest_add(gestures_cap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
|
|
|
|
litest_add(gestures_nocap, LITEST_ANY, LITEST_TOUCHPAD);
|
|
|
|
|
|
|
|
|
|
litest_add_ranged(gestures_swipe_3fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
|
|
|
|
|
litest_add_ranged(gestures_swipe_3fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
|
|
|
|
|
litest_add(gestures_swipe_3fg_btntool_pinch_like, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
|
|
|
|
litest_add_ranged(gestures_swipe_4fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
|
|
|
|
|
litest_add_ranged(gestures_swipe_4fg_btntool, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
|
|
|
|
|
litest_add_ranged(gestures_pinch, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
|
|
|
|
|
litest_add_ranged(gestures_pinch_3fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
|
|
|
|
|
litest_add_ranged(gestures_pinch_4fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
|
|
|
|
|
litest_add_ranged(gestures_spread, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
|
|
|
|
|
|
|
|
|
|
litest_add(gestures_3fg_buttonarea_scroll, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH);
|
|
|
|
|
litest_add(gestures_3fg_buttonarea_scroll_btntool, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH);
|
|
|
|
|
|
|
|
|
|
litest_add(gestures_time_usec, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
2021-03-15 17:23:48 +10:00
|
|
|
|
2021-05-27 19:19:49 +02:00
|
|
|
litest_add(gestures_hold_config_default_disabled, LITEST_TOUCHPAD|LITEST_SEMI_MT, LITEST_ANY);
|
|
|
|
|
litest_add(gestures_hold_config_default_enabled, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
|
|
|
|
|
litest_add(gestures_hold_config_set_invalid, LITEST_TOUCHPAD, LITEST_ANY);
|
|
|
|
|
litest_add(gestures_hold_config_is_available, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH|LITEST_SEMI_MT);
|
|
|
|
|
litest_add(gestures_hold_config_is_not_available, LITEST_TOUCHPAD|LITEST_SEMI_MT, LITEST_ANY);
|
|
|
|
|
|
2021-05-27 19:20:31 +02:00
|
|
|
litest_add_ranged(gestures_hold, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &range_hold);
|
|
|
|
|
litest_add_ranged(gestures_hold_tap_enabled, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &range_hold);
|
|
|
|
|
litest_add_ranged(gestures_hold_cancel, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &range_hold);
|
|
|
|
|
litest_add_ranged(gestures_hold_cancel_tap_enabled, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &range_hold);
|
|
|
|
|
litest_add_ranged(gestures_hold_then_swipe_3fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
|
|
|
|
|
litest_add_ranged(gestures_hold_then_swipe_4fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
|
|
|
|
|
litest_add_ranged(gestures_hold_then_pinch_2fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
|
|
|
|
|
litest_add_ranged(gestures_hold_then_pinch_3fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
|
|
|
|
|
litest_add_ranged(gestures_hold_then_pinch_4fg, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
|
|
|
|
|
litest_add_ranged(gestures_hold_then_spread, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH, &cardinals);
|
|
|
|
|
litest_add(gestures_hold_then_3fg_buttonarea_scroll, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH);
|
|
|
|
|
|
2021-05-27 19:20:37 +02:00
|
|
|
litest_add(gestures_hold_once_on_double_tap, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
|
|
|
|
litest_add_ranged(gestures_hold_once_tap_n_drag, LITEST_TOUCHPAD, LITEST_ANY, &range_multifinger_tap);
|
|
|
|
|
|
2021-05-31 17:58:39 +02:00
|
|
|
litest_add(gestures_hold_and_motion_before_timeout, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
|
|
|
|
litest_add(gestures_hold_and_motion_after_timeout, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
|
|
|
|
|
2021-03-15 17:23:48 +10:00
|
|
|
/* Timing-sensitive test, valgrind is too slow */
|
|
|
|
|
if (!RUNNING_ON_VALGRIND)
|
|
|
|
|
litest_add(gestures_swipe_3fg_unaccel, LITEST_TOUCHPAD, LITEST_SINGLE_TOUCH);
|
2015-07-07 11:52:05 +10:00
|
|
|
}
|