Commit graph

95 commits

Author SHA1 Message Date
Peter Hutterer
d05363316c test: parse the LITEST_VERBOSE environment variable
--verbose only works when running a specific test, sometimes we need make
check to be more verbose. Set this by default for make check, the log becomes
a lot more expressive that way

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-19 10:49:49 +10:00
Peter Hutterer
b97ad3c174 test: add litest_add_ranged* functionality
litest_add_ranged* takes a range parameter that serves as the lower/upper
boundary for a loop. This enables tests to be run multiple times, avoiding the
timeouts we triggered by having the loops inside (e.g. see 2bf8d035c and
6dd02468).

This just wraps the underlying check framework, the ranged variable is
available as "_i" in the test.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-08 14:08:57 +10:00
Peter Hutterer
fd301dfba2 test: add litest_is_keyboard_event() helper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-07 16:17:50 +10:00
Peter Hutterer
cbfbede748 test: add litest_is_touch_event() helper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-07 14:41:00 +10:00
Peter Hutterer
77eb2d5445 test: add litest_is_motion_event() helper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-07 14:40:59 +10:00
Peter Hutterer
2e38547c79 test: add litest_is_axis_event() helper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-07 14:40:59 +10:00
Peter Hutterer
799ee6c53e test: litest_is_button_event should take an unsigned int
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-07 14:40:59 +10:00
Benjamin Tissoires
0cd36225d7 touchpad: add support for per-finger hovering information
When the device supports true hovering, it reports this
information through ABS_MT_DISTANCE.
When this axis is available, we should rely on it to
(un)hover the touches as BTN_TOUCH is most of the time
unreliable (generated by the mouse emulation in the kernel).

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-07 14:40:53 +10:00
Peter Hutterer
1ea69203ac test: return the right value from open_restricted
fd or negative errno on failure.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-06 11:56:40 +10:00
Peter Hutterer
3844856302 test: move a comment to where it belongs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-06 11:56:40 +10:00
Peter Hutterer
d8ec73aead test: add timeout_tapndrag()
Prep work for the upcoming patch to extend the timeout for tap-and-drag.  And
switch the tests that rely on it over to the new function.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-04 10:22:58 +10:00
Peter Hutterer
a7b2d04e90 evdev: enable button scrolling by default on mice without wheels
If we have a middle button but no wheels, enable on-button scrolling for the
middle button by default. This applies e.g. to the Logitech trackball added as
new test device here.

This makes the separate check for POINTINGSTICK obsolete but I'd rather leave
this in to be more explicit about it.

https://bugs.freedesktop.org/show_bug.cgi?id=90208

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-04-28 17:12:31 +10:00
Peter Hutterer
9191010ac2 test: add the MS Surface Type Cover to the list of devices
Added in d2842893a8 but never added to the list
of devices so none of the tests ran against it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
2015-04-27 13:24:41 +10:00
Peter Hutterer
776bf4938d evdev: accept but disable ABS_MISC and above for min/max == 0
This is sort-of legitimate, so simply disable the axes and continue.
Any real axis we require to have a real range.

https://bugs.freedesktop.org/show_bug.cgi?id=90090

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-04-21 11:36:19 +10:00
Peter Hutterer
88d1a52670 test: add litest_is_button_event
Makes it easier from a caller to check for common things without all the other
boilerplate code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-04-17 12:59:22 +10:00
Peter Hutterer
75f15917a3 evdev: add support for middle button emulation
This is just the required framework, it's not hooked up to anything just yet.
Hooking it up comes as separate commit to better detail why/when a device
supports emulation.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-04-17 12:50:03 +10:00
Peter Hutterer
bd6fd8bb92 test: add a scrollwheel-only device
This currently requires a specific udev rule to tag the device, once the
matching bits are upstream we can drop this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-04-13 11:48:38 +02:00
Peter Hutterer
7ea7746c77 test: add the Razer BlackWidow keyboard device
This device has a couple of axes (fake MT) and a wheel. The device itself
exports 4 nodes, this device is the second node, the most problematic one.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-04-08 11:42:50 +02:00
Peter Hutterer
7f28b714d8 Replace event type check switch statements with a helper macro/function
The helper function now prints an error message if the event type passed is
not allowed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-16 08:07:38 +10:00
Peter Hutterer
44f7446b2a test: abort() for invalid logging priorities
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-16 08:07:37 +10:00
Hans de Goede
a8eb6c84a2 litest: Add a litest_touch_move_two_touches helper function
Currently all the touchpad 2fg tests move the 2 fingers 1 at a time,
causing a finger motion which looks more like a pinch zoom in followed by
a zoom out than an actual 2fg scroll gesture. Add a helper function which
can move 2 fingers at the same time (more or less), and use this where
relevant.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-13 11:28:36 +10:00
Peter Hutterer
1cebdc7a2b touchpad: accumulate the initial scroll edge delta
The previous setting of 10 wasn't 10 mm, it was used against the deltas
normalized to a 1000DPI mouse, i.e. closer to 4mm. It was also also per-event,
so a slow movement or a high-frequency touchpad can struggle to meet the
threshold.

Change the trigger to be ~5 mm from the initial touch down, accumulated until
we either meet the threshold or the timeout expires. The first scroll event
includes the delta since the touch down rather than the most recent delta.
This removes the delay otherwise seen in scrolling and makes the scroll motion
match the finger motion. This accumulated delta only applies when exceeding
the motion threshold, when the timeout triggers the switch to scrolling the
first delta posted is the current delta.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-10 07:09:23 +10:00
Peter Hutterer
aa3d09932f test: add a Wacom Intuos 5 Finger test device
Works as a touchpad but has no buttons.

Minor change to one of the touchpad tests: because the touch area is so big
the slow-scrolling trigger needs to be adjusted.

And because the device is an external device, the "disable on external mouse"
test needs to be adjusted.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-05 13:30:49 +10:00
Peter Hutterer
72cc601007 test: add protocol A touch screen tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-02 12:45:47 +10:00
Hans de Goede
18887f90ee touchpad: Gesture support preparation
Handle everything which is not handled by the tap, (soft)button or edge-scroll
code/statemachines in a unified way. Everything is treated as a X-finger
gesture now, and the action to take on finger movement is decided by
the gesture.finger_count setting. Pointer control now simply is seen as a
1 finger gesture, and 2fg scrolling as a 2fg gesture.

This removed the need for special-casing things like switching back to
pointer mode when lifting a finger in 2fg scrolling mode, and also lays the
groundwork for adding 3+ fg gesture support.

Note that 1 test-case needs to be updated to wait for the finger mode
switching when switching mode while a gesture has already been started.
This is actually an improvement as this stops sending spurious pointer
motion events at the end of 2fg scrolling when not lifting both fingers at
exactly the same time.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-23 10:01:02 +01:00
Peter Hutterer
ed0f0bf494 test: fix Coverity complaints
seat_button_count
seat_key_count ... uninitialized variable

t = zalloc
s = zalloc ... dereferencing potential NULL-pointer

d->ntouches_down... side-effect in assertion

Coverity run against the 0.10.0 tag, see
https://scan.coverity.com/projects/4298

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Christian Hartmann <cornogle@googlemail.com>
2015-02-20 10:03:09 +10:00
Peter Hutterer
4ec2947cc9 test: add per-device udev rule support
Don't rely on a magic version tag, instead let a device define a udev rule and
drop that into the udev runtime directory before the device is created.

There are a couple of caveats with this approach: first, since this changes
system-wide state it may cause issues on the device the test suite is run on.
This can be avoided if the udev rules have filter patterns that ensure only
test devices are affected.

Second, the check test suite aborts but it doesn't run the teardown() function
if a test fails. So far this wasn't a problem since uinput devices disappear
whenever we exit. The rules files will hang around though, so an unchecked
fixture was added to delete all litest-foo.rules files before and after a test
case starts. Unchecked fixtures are run regardless of the exit status of the
test but run in the same address space - i.e. no ck_assert() usage.

Also unchecked fixtures are only run once per test-case, not once per test
function. For us, that means they're only run once per device (we use the
devices as test case), i.e. if a test fails and the udev rule isn't tidied up,
the next test may be unpredictable. This shouldn't matter too much though.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-02-03 10:34:26 +10:00
Peter Hutterer
82bb5841a2 test: add a test device for the Lenovo X1 Carbon 3rd
Notable: sends BTN_0/1/2 instead of the trackpoint

This device currently has the INPUT_PROP_TOPBUTTONPAD property set, kernel
patches [1] and [2] are pending to remove this. This test device already lacks
the property.

[1] https://patchwork.kernel.org/patch/5730371/
[2] https://patchwork.kernel.org/patch/5730451/

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-01-29 14:40:26 +10:00
Peter Hutterer
c411de1078 test: set the input_id->version as well in litest devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-01-28 16:28:01 +10:00
Peter Hutterer
62e4b144d2 test: add a semi-mt + hover synaptics touchpad
This device sends touch information before BTN_TOUCH

https://bugs.freedesktop.org/show_bug.cgi?id=87197

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-01-16 07:42:50 +10:00
Peter Hutterer
3d0e4f66f7 test: move semi-mt special tracking into the shared litest.c
An upcoming synaptics semi-mt device needs the same code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-01-16 07:42:50 +10:00
Peter Hutterer
1baf109b40 Change axis events to carry all directions
Sending separate axis events instead of one unified events is limiting,
especially when simultaneously scrolling in both directions and the caller
tries to implement kinetic scrolling.

Take a page from the tablet-support branch and instead implement the axis
event as a generic event that can contain multiple axes simultaneously.

Right now we only have two (scroll) axes and we could easily just check both
for non-zero values. If we want to allow further axes in the future, we need
a check whether an axis is set in an event, that's what
libinput_event_pointer_has_axis to scroll events() is for.

We also need the mask to notify of a scroll stop event, which could otherwise
be confused as a vertical-only or horizontal-only event.

This is an API and ABI break.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-01-13 13:54:21 +10:00
Peter Hutterer
c464458f82 test: add helper function for checking for a specific event type
In a few tests we care about that a specific set of events are in the queue
but not about the details of the events (usually checked elsewhere). Instead
of manual loops, provide a helper function that also checks that there is at
least one of those events in the queue.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-23 11:14:39 +10:00
Peter Hutterer
e9b160a995 test: print axis event information for debugging too
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-11 17:34:05 +10:00
Peter Hutterer
a296a102c7 test: print the string of the event type
Bit quicker to parse than the number

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-11 17:34:05 +10:00
Jonas Ådahl
3b4d8509cc test: Don't send two motion events when button scrolling
Button scrolling motion events don't pass through the acceleration
filter so no need to assume the initial event will be absorbed.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-05 11:54:18 +10:00
Hans de Goede
365141ec60 test: Add litest_button_scroll helper function
Turn test_trackpoint_scroll into a generic helper function for testing
"button scrolling".

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-11 12:13:07 +10:00
Peter Hutterer
d7a1addcdd test: rename a parameter to litest_assert_scroll()
This doesn't test for direction only, it tests for the minimum distance we
expect in the scroll event. Rename accordingly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-11-11 10:00:55 +10:00
Peter Hutterer
1bd5d32463 test: add VMWare Virtual USB Mouse device
Yes, the name has VMware twice, not a typo.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-11-11 09:55:42 +10:00
Peter Hutterer
a0b3af0d91 test: add Xen Virtual Pointer device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-11-11 09:55:42 +10:00
Peter Hutterer
529d30c7ac test: add QEMU tablet as test device
Re-uses the touch_down interface for now, but requires the slot is always 0.
That's easier for now than adding a new interface for abs event, at least
until we have more than one device that needs it.

This device, along with a couple of similar ones have a tendency to break in
the X.Org stack without people noticing. They're special in that they have
absolute x/y axes but relative wheels. For libinput that's not as much of a
problem as it is in X but let's add them anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-11-11 09:55:42 +10:00
Peter Hutterer
341eeec611 test: fix coding style
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-10 11:16:08 +10:00
Hans de Goede
00f74270e5 litest: Add a sleep_ms parameter to litest_touch_move_to
In reality moving a touch from point to another takes time. In some cases
(when a timeout may trigger during the move, e.g. tap-n-drag on a touchpad),
this is important. Add a sleep_ms parameter, which will cause
litest_touch_move_to to sleep the specified amount of ms every step.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-11-06 11:04:17 +01:00
Peter Hutterer
ba30abff77 test: pass an enum for the axis instead of uint
Let's pretend that makes it type-safe.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-06 15:08:28 +10:00
Peter Hutterer
4dce0648f6 test: add litest_push/pop_event_frame() helpers
For some tests we need to string multiple event sequences together into one
event frame. Use a push/pop frame approach that stops litest from sending any
EV_SYN/SYN_REPORT events, so we can merge two touches together by e.g.

litest_push_event_frame(d);
litest_touch_down(d, 0, 10, 10);
litest_touch_down(d, 1, 20, 50);
litest_pop_event_frame(d);

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-09-23 14:38:52 +10:00
Peter Hutterer
e4adbff919 test: add helper functions for the two timers we care about
Rather than a random msleep() with a comment, use a helper function that
describes what we're waiting for. Also makes changing the timeouts easier in
the future.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-09-23 14:38:37 +10:00
Hans de Goede
faa8764921 litest: Add litest_assert_scroll() helper function
Make check_2fg_scroll functionality available outside of touchpad.c ,
no functional changes.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-09-19 15:49:06 +10:00
Peter Hutterer
fca1519395 test: wait for events in litest_assert_button_events
Takes the onus of waiting from the caller.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-09-18 11:30:15 +10:00
Peter Hutterer
84007034aa test: move assert_button_event to litest proper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-09-18 11:30:15 +10:00
Peter Hutterer
dc3ad5315f test: add litest_add_device()
For adding a litest device to an existing context.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-09-18 11:30:15 +10:00