diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2014-07-18 16:01:10 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2014-07-21 08:56:10 +1000 |
commit | 489630f58b2ac099bf235efc5dfd9cd854c223ee (patch) | |
tree | 4840469c42593b74d74cc0a3deee14720cfbaafa | |
parent | 8665e3678ab07b7071c70d75b137e0528be70e84 (diff) | |
download | libinput-489630f58b2ac099bf235efc5dfd9cd854c223ee.tar.gz |
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>
-rw-r--r-- | test/litest-int.h | 2 | ||||
-rw-r--r-- | test/litest.c | 15 | ||||
-rw-r--r-- | test/litest.h | 12 | ||||
-rw-r--r-- | test/touchpad.c | 4 |
4 files changed, 18 insertions, 15 deletions
diff --git a/test/litest-int.h b/test/litest-int.h index 19e6e68d..581930b8 100644 --- a/test/litest-int.h +++ b/test/litest-int.h @@ -93,7 +93,7 @@ struct litest_device_interface { }; void litest_set_current_device(struct litest_device *device); -int litest_scale(const struct litest_device *d, unsigned int axis, int val); +int litest_scale(const struct litest_device *d, unsigned int axis, double val); void litest_generic_device_teardown(void); #endif diff --git a/test/litest.c b/test/litest.c index adcbf3ea..452cb770 100644 --- a/test/litest.c +++ b/test/litest.c @@ -595,7 +595,7 @@ litest_event(struct litest_device *d, unsigned int type, static int auto_assign_value(struct litest_device *d, const struct input_event *ev, - int slot, int x, int y) + int slot, double x, double y) { static int tracking_id; int value = ev->value; @@ -625,7 +625,8 @@ auto_assign_value(struct litest_device *d, void -litest_touch_down(struct litest_device *d, unsigned int slot, int x, int y) +litest_touch_down(struct litest_device *d, unsigned int slot, + double x, double y) { struct input_event *ev; @@ -669,7 +670,8 @@ litest_touch_up(struct litest_device *d, unsigned int slot) } void -litest_touch_move(struct litest_device *d, unsigned int slot, int x, int y) +litest_touch_move(struct litest_device *d, unsigned int slot, + double x, double y) { struct input_event *ev; @@ -689,8 +691,8 @@ litest_touch_move(struct litest_device *d, unsigned int slot, int x, int y) void litest_touch_move_to(struct litest_device *d, unsigned int slot, - int x_from, int y_from, - int x_to, int y_to, + double x_from, double y_from, + double x_to, double y_to, int steps) { for (int i = 0; i < steps - 1; i++) @@ -720,7 +722,8 @@ litest_keyboard_key(struct litest_device *d, unsigned int key, bool is_press) litest_button_click(d, key, is_press); } -int litest_scale(const struct litest_device *d, unsigned int axis, int val) +int +litest_scale(const struct litest_device *d, unsigned int axis, double val) { int min, max; ck_assert_int_ge(val, 0); diff --git a/test/litest.h b/test/litest.h index 3e75dd58..2363c7f9 100644 --- a/test/litest.h +++ b/test/litest.h @@ -108,16 +108,16 @@ void litest_event(struct litest_device *t, void litest_touch_up(struct litest_device *d, unsigned int slot); void litest_touch_move(struct litest_device *d, unsigned int slot, - int x, - int y); + double x, + double y); void litest_touch_down(struct litest_device *d, unsigned int slot, - int x, - int y); + double x, + double y); void litest_touch_move_to(struct litest_device *d, unsigned int slot, - int x_from, int y_from, - int x_to, int y_to, + double x_from, double y_from, + double x_to, double y_to, int steps); void litest_button_click(struct litest_device *d, unsigned int button, diff --git a/test/touchpad.c b/test/touchpad.c index b7b31d6b..3bd5fb67 100644 --- a/test/touchpad.c +++ b/test/touchpad.c @@ -1127,7 +1127,7 @@ START_TEST(clickpad_topsoftbuttons_move_out_ignore) END_TEST static void -test_2fg_scroll(struct litest_device *dev, int dx, int dy, int sleep) +test_2fg_scroll(struct litest_device *dev, double dx, double dy, int sleep) { struct libinput *li = dev->libinput; @@ -1210,7 +1210,7 @@ START_TEST(touchpad_2fg_scroll) check_2fg_scroll(dev, LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL, -10); /* 2fg scroll smaller than the threshold should not generate events */ - test_2fg_scroll(dev, 1, 1, 200); + test_2fg_scroll(dev, 0.1, 0.1, 200); litest_assert_empty_queue(li); } END_TEST |