summaryrefslogtreecommitdiff
path: root/tests/wayland/test_tablet.c
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-12 22:12:02 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-12 22:12:02 +0300
commit94c5e361fbb229b0cd6853e2102a7d95f1f358b3 (patch)
tree3c0f11af9dcb84dac8067a31a6979acd6dd56fbf /tests/wayland/test_tablet.c
parent08dc9047098d6d96791024ac7d8f5837633673ef (diff)
better public interface and doxygen
Diffstat (limited to 'tests/wayland/test_tablet.c')
-rw-r--r--tests/wayland/test_tablet.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/wayland/test_tablet.c b/tests/wayland/test_tablet.c
index 449c446..f8982b0 100644
--- a/tests/wayland/test_tablet.c
+++ b/tests/wayland/test_tablet.c
@@ -50,6 +50,7 @@ int main(void)
tool_frame(&tool, NULL, 0);
ev = next(&surface);
assert(ev.kind == YASL_PTR_SCROLL && ev.device == YASL_PTR_DEV_ERASER);
+ assert(ev.scroll.x == 0 && ev.scroll.y == 1);
tablet_tool_proximity_out(&tool, NULL);
ev = next(&surface);
assert(ev.kind == YASL_PTR_LEAVE && ev.device == YASL_PTR_DEV_ERASER && !ev.pen.pressure);
@@ -57,6 +58,42 @@ int main(void)
assert(!(yasl_display_caps(&display.base) & YASL_CAP_TABLET));
display.tablet_mgr = (void *)&display; /* Capability depends on protocol availability. */
assert(yasl_display_caps(&display.base) & YASL_CAP_TABLET);
+
+ seat.pointer_focus = &surface;
+ /* A compositor may describe the same detent in three ways. value120 wins,
+ * and both axes belong to one event, without whole-line truncation. */
+ pointer_axis(&seat, NULL, 0, WL_POINTER_AXIS_VERTICAL_SCROLL, wl_fixed_from_int(10));
+ pointer_axis_discrete(&seat, NULL, WL_POINTER_AXIS_VERTICAL_SCROLL, 1);
+ pointer_axis_value120(&seat, NULL, WL_POINTER_AXIS_VERTICAL_SCROLL, 30);
+ pointer_axis_value120(&seat, NULL, WL_POINTER_AXIS_HORIZONTAL_SCROLL, -60);
+ pointer_frame(&seat, NULL);
+ ev = next(&surface);
+ assert(ev.kind == YASL_PTR_SCROLL && ev.device == YASL_PTR_DEV_MOUSE);
+ assert(ev.scroll.x == -0.5 && ev.scroll.y == 0.25);
+ struct yasl_input_event unused;
+ assert(!yasl_surface_input_poll(&surface.base, &unused));
+ pointer_frame(&seat, NULL);
+ assert(!yasl_surface_input_poll(&surface.base, &unused));
+
+ /* Stops preserve offsets from the same frame. Repeated tiny movements
+ * must be visible immediately rather than held until a whole detent. */
+ for (int i = 0; i < 3; i++) {
+ pointer_axis_source(&seat, NULL, WL_POINTER_AXIS_SOURCE_FINGER);
+ pointer_axis(&seat, NULL, 0, WL_POINTER_AXIS_VERTICAL_SCROLL, wl_fixed_from_double(1.25));
+ pointer_axis(&seat, NULL, 0, WL_POINTER_AXIS_HORIZONTAL_SCROLL, wl_fixed_from_double(-2.5));
+ pointer_axis_stop(&seat, NULL, 0, WL_POINTER_AXIS_VERTICAL_SCROLL);
+ pointer_frame(&seat, NULL);
+ ev = next(&surface);
+ assert(ev.scroll.x == -0.25 && ev.scroll.y == 0.125);
+ }
+ pointer_axis_discrete(&seat, NULL, WL_POINTER_AXIS_HORIZONTAL_SCROLL, 2);
+ pointer_frame(&seat, NULL);
+ ev = next(&surface);
+ assert(ev.scroll.x == 2 && ev.scroll.y == 0);
+ pointer_axis_value120(&seat, NULL, WL_POINTER_AXIS_VERTICAL_SCROLL, 60);
+ seat_pointer_reset(&seat);
+ pointer_frame(&seat, NULL);
+ assert(!yasl_surface_input_poll(&surface.base, &unused));
input_queue_clear(&surface.input);
return 0;
}