Commit graph

262 commits

Author SHA1 Message Date
Peter Hutterer
3288349077 test: add litest_assert_tablet_button_event()
Does what it says on the box. or at least in the manual inside the box.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Stephen Chandler Paul <thatslyude@gmail.com>
2015-03-02 13:19:00 +10:00
Peter Hutterer
c23fb36eb1 test: fix double comparison macros
args needs to be within () to ensure correct calculation

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Stephen Chandler Paul <thatslyude@gmail.com>
2015-03-02 13:19:00 +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
2365f7d3d1 Merge branch 'master' into tablet-support
Added: udev-tag detection for the tablet.
libwacom assigns ID_INPUT_TABLET to all known devices but also
ID_INPUT_TOUCHPAD to all known devices with a touch interface. That's a bug
and should be fixed there but we can work around it by checking both and
making sure only one is set.

Conflicts:
	src/evdev.c
	test/misc.c
2015-02-10 15:23:38 +10:00
Peter Hutterer
633d01d146 0.9.0
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iEYEABECAAYFAlTLBSIACgkQ4jt+cLRn8L+4NgCgmgMNoZnmHfNJooSdrRQxzs2t
 8c0An1jHFRAO+9/47m2l2tAzXV2RBaf6
 =b46e
 -----END PGP SIGNATURE-----

Merge tag '0.9.0' into tablet-support

0.9.0

Conflicts:
	test/litest.h
2015-02-05 15:05:36 +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
35b3992792 Merge branch 'master' into tablet-support
Conflicts:
	test/litest.h
2015-01-20 15:24:34 +10:00
Peter Hutterer
395c449c8e Merge branch 'master' into tablet-support
Conflicts:
	src/libinput.h
2015-01-16 07:55:23 +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
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
83f97991a0 0.7.0
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iEYEABECAAYFAlSBMWUACgkQ4jt+cLRn8L/4JQCgt0u/hImDVk9GLPXpUfFZinRc
 pIgAn1bZ91n/o4nEhq6zOXSsKRoZvxHL
 =oj19
 -----END PGP SIGNATURE-----

Merge tag '0.7.0' into tablet-support

0.7.0

Conflicts:
	src/libinput-private.h
	test/device.c
	test/litest.h
2014-12-08 11:14:11 +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
77a2d7e8d9 test: rename LITEST_POINTER to LITEST_RELATIVE
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
c605276984 Merge branch 'for-peter' of git://people.freedesktop.org/~jwrdegoede/libinput 2014-11-07 11:03:12 +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
d2842893a8 test: add the MS surface touch cover device and fake-mt tests
In the device description, define the interfaces for touch down/move even
though we technically don't have those interfaces. Makes it easier to test.

The fake-mt tests make sure the device shows up correctly and that no touch
events are being sent for touch events.
This device is a pointer device too, the pointer tests will test it for
correct functionality of the REL_X/Y bits, no special test needed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-11-06 15:37:48 +10: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
Peter Hutterer
a6f18c9cca Merge branch 'master' into tablet-support
sendevents config tests currently disabled for LITEST_TABLET until that gains
the matching bits in the dispatch.

Conflicts:
	src/evdev.c
	src/libinput.c
	test/litest.c
	test/litest.h
2014-09-22 15:42:13 +10:00
Hans de Goede
04a602108b test: Add trackpoint middlebutton scrolling tests
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-22 10:59:29 +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
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
Peter Hutterer
647b2ba18d test: avoid erroneous devices to be passed into the test suites
The litest features overlap with the litest device specifiers, so it's easy to
pass in LITEST_MOUSE where LITEST_POINTER should be passed in, and vice versa.
Lacking proper type checking the best we can do here is simply move the
devices into the negative range and check for that.

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
efb9081454 test: add a generic single-touch device
With a non-zero absmin for both axes and different ranges for x/y, just to
detect those errors.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-08-26 13:49:16 +10:00
Peter Hutterer
ca3f3ea9ce test: add helpers to wait for specific events
litest_wait_for_event() returns if any event is available.
litest_wait_for_event_of_type(... type, type, type, -1) returns if any of the
given event types is availble. All other events are discarded.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-08-26 13:49:15 +10:00
Jonas Ådahl
4be59a972a test: Use only one test device for some udev and path tests
Some tests in test/path.c and test/udev.c are not dependent on
device behaviour but rather managing of device lifetime etc. Run those
tests only once with only one device, resulting more or less the same
code coverage but shorter run time.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-18 22:35:19 +02:00
Peter Hutterer
d1cc84265b test: add a semi-mt Alps test device
Provides the bounding box only, with slot 0 always being the upper/left, slot
1 being the lower-right touch. This needs to use the touch_down etc. litest
interfaces, which are now widened to double (leftover from 489630f58) and a
device-specific private pointer in the litest device.

New device feature for litest: LITEST_SEMI_MT

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-08-04 20:21:03 +10:00
Peter Hutterer
61995348d9 test: auto-update for BTN_TOOL_* when using litest_touch_ functions
Set BTN_TOUCH, BTN_TOOL_DOUBLETAP automatically depending on the number of
fingers down.

This emulates real event sequences a bit better than the current approach,
though it's not a 100% correct emulation:
1) On real devices, BTN_* are usually sent last before the SYN_REPORT - here
   they are sent first to slot in with the custom, device-specific event
   sequence. We should only ever look at the complete sequence anyway, so this
   shouldn't matter.
2) On real devices, the switch from BTN_TOOL_DOUBLETAP to TRIPLETAP and vice
   versa is not always toggled within the same SYN_REPORT
3) On synaptics devices, BTN_TOUCH is released in the frame where
   BTN_TOOL_DOUBLETAP is set. It is then immediately set again in the next
   frame.  With the current litest framework this is hard to integrate, so we
   just leave BTN_TOUCH set the whole time, which is what MT devices do if
   they don't have BTN_TOOL_DOUBLETAP.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-07-23 15:08:15 +10:00
Peter Hutterer
0891bc0d92 Merge branch 'master' into tablet-support 2014-07-21 09:31:37 +10:00
Peter Hutterer
489630f58b test: widen litest to use doubles for scaled variables
Using a 0-100% range is useful but in some cases we need events with finer
than 1% granularity.

And fix up the two-finger test that now fails. This was a bug in the test
anyway, the dx/dy supplied here was 1% of the touchpad width. Confined to
integers this meant we only ever had the touch down, then the single move by
1%. That caused two events - not enough to satisfy tp_estimate_delta, so we
always had a delta of 0/0 regardless of the size of the move.

Now with doubles this fails, so drop it to 0.1% instead, which is small enough
on all touchpads we currently have.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-07-21 08:56:10 +10:00
Stephen Chandler Paul
d8f2c1b11b test: Add tests for serial numbers on tools
These tests make sure that any tablets with the capability to report a tool's
serial number do so properly, that the tool changes when another tool of the
same type with a different serial number is used, and that libinput doesn't
change the current tool when -1 is reported as the serial number (-1 is used for
special purposes by the linuxwacom driver).

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-19 15:52:30 +10:00
Carlos Garnacho
0716580fc2 test: Add Wacom ISDv4 E6 Pen device definition
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-06-17 17:17:14 -04:00
Carlos Garnacho
c5736b7a9b test: Add Wacom Intuos5 touch M Pen device definition
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-06-17 17:17:14 -04:00
Carlos Garnacho
20343ab41c test: Add Wacom Cintiq 12WX device definition
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-06-17 17:17:14 -04:00
Carlos Garnacho
f43a9b2c76 test: Add Wacom Bamboo 16FG 4x5 Pen device definition
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-06-17 17:17:14 -04:00
Stephen Chandler Paul
9d96286a44 test: Add litest_assert_double_*() macros
Converts two doubles to 24.8 fixed-width integers so assertions can be made with
doubles in tests

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-17 17:17:14 -04:00
Carlos Garnacho
204d1d7514 test: Add infrastructure for testing tablet events.
no vfuncs are used, only input_event arrays.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-06-17 17:17:14 -04:00
Peter Hutterer
d4c29a0af8 test: Add description for the T440 synaptics touchpad
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-06-12 10:29:26 +10:00
Peter Hutterer
466c1acf48 test: add a bunch of test for click behavior on touchpads
Mainly testing the behaviour when clicking during a tap or tap-n-drag. Adds a
new "feature" to the litest system, Apple clickpads don't have software
buttons by default.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-06-12 10:29:26 +10:00
Peter Hutterer
e0ce8a67ea test: add litest_assert_empty_queue helper function
Checks if the queue is empty and prints informatino about any events before
failing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-06-12 10:29:26 +10:00
Jonas Ådahl
3f349026cf test: Test seat wide button and key count helpers
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-04-23 00:07:40 +02:00