diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-12 10:17:33 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-12 10:17:33 +0300 |
| commit | 881fb6cb1d64868132287bd9637f4ae1cbc3504c (patch) | |
| tree | 5688d5f8be69805ccf290178675b522802155e6d /tests | |
| parent | 3b8af02be94a510e385f44d58c35c86bb89424a6 (diff) | |
cursor hidden and tablet support
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/common/test_backends.c | 17 | ||||
| -rw-r--r-- | tests/helpers/run_backends.py | 6 | ||||
| -rw-r--r-- | tests/meson.build | 44 |
3 files changed, 65 insertions, 2 deletions
diff --git a/tests/common/test_backends.c b/tests/common/test_backends.c index 4f49765..605dac0 100644 --- a/tests/common/test_backends.c +++ b/tests/common/test_backends.c @@ -160,6 +160,23 @@ static void x11_behavior(struct yasl_loop *loop, struct yasl_display *d, struct assert(w->configures > 0); struct yasl_vector2i size = yasl_surface_geometry(w->surface).size; assert(size.x == 200 && size.y == 120); + /* A server-generated motion verifies the XI2 subscription and cookie + * dispatch path, including source-device lookup, rather than SendEvent. */ + struct yasl_input_event pointer_event; + while (yasl_surface_input_poll(w->surface, &pointer_event)) {} + XWarpPointer(native, None, window, 0, 0, 0, 0, 80, 50); + XFlush(native); + pump(loop, d, NULL); + bool saw_motion = false; + while (yasl_surface_input_poll(w->surface, &pointer_event)) { + if (pointer_event.kind == YASL_INPUT_MOUSE && pointer_event.mouse.kind == YASL_PTR_MOTION) { + assert(pointer_event.mouse.device == YASL_PTR_DEV_MOUSE); + assert(!pointer_event.mouse.pen.pressure); + if (pointer_event.mouse.pos.x == 80 && pointer_event.mouse.pos.y == 50) + saw_motion = true; + } + } + assert(saw_motion); XEvent key = {0}; key.xkey = (XKeyEvent){.type = KeyPress, .display = native, .window = window, .root = DefaultRootWindow(native), .same_screen = True, diff --git a/tests/helpers/run_backends.py b/tests/helpers/run_backends.py index 8c5428a..57cc9ab 100644 --- a/tests/helpers/run_backends.py +++ b/tests/helpers/run_backends.py @@ -21,7 +21,7 @@ def wait_for(process, ready): def main(): - weston, xwayland, test, timers = sys.argv[1:] + weston, xwayland, test, timers, tablet = sys.argv[1:] servers = [] with tempfile.TemporaryDirectory(prefix="yasl-backends-") as directory: root = Path(directory) @@ -80,6 +80,10 @@ def main(): x_env["XDG_SESSION_TYPE"] = "x11" print("Test: X11 surface timers", flush=True) subprocess.run([timers], env=x_env, check=True, timeout=8) + for backend in ("wayland", "x11"): + print("Test: tablet example on", backend, flush=True) + subprocess.run([tablet, "--backend", backend, "--smoke-test"], + env=env, check=True, timeout=8) except BaseException: for log in (wl_log, x_log): log.flush() diff --git a/tests/meson.build b/tests/meson.build index 0f28c39..177e400 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -84,12 +84,43 @@ selection_test = executable( ) test('selection', selection_test) +tablet_example_test = executable('yasl-tablet-example-test', 'common/test_tablet_example.c', + dependencies: yasl_dep, +) +test('tablet-example', tablet_example_test) + +if has_x11 + tablet_x11_test = executable('yasl-tablet-x11-test', 'x11/test_tablet.c', + include_directories: inc, dependencies: yasl_dep, + ) + test('tablet-x11', tablet_x11_test) + if get_option('x11_tablet_tests') + xorg = find_program('/usr/lib/Xorg', '/usr/lib/xorg/Xorg', 'Xorg') + native_tablet_test = executable('yasl-tablet-x11-native-test', 'x11/test_tablet_native.c', + dependencies: yasl_dep, + ) + test('tablet-x11-native', python, + args: [files('helpers/run_x11_tablet.py'), xorg, native_tablet_test], timeout: 30, + ) + endif +elif get_option('x11_tablet_tests') + error('Native X11 tablet tests require the X11 backend.') +endif + if has_wayland ime_test = executable('yasl-ime-test', 'wayland/test_input.c', include_directories: inc, dependencies: yasl_dep, ) test('ime-ownership', ime_test) + tablet_wayland_test = executable('yasl-tablet-wayland-test', 'wayland/test_tablet.c', + include_directories: inc, dependencies: yasl_dep, + ) + test('tablet-wayland', tablet_wayland_test) + cursor_wayland_test = executable('yasl-cursor-wayland-test', 'wayland/test_cursor.c', + include_directories: inc, dependencies: yasl_dep, + ) + test('cursor-wayland', cursor_wayland_test) endif if get_option('integration_tests') @@ -102,6 +133,17 @@ if get_option('integration_tests') dependencies: [shared_dep, deps], ) test('native-ownership', ownership_test, timeout: 20) + tablet_cocoa_test = executable('yasl-tablet-cocoa-test', 'cocoa/test_tablet.m', + dependencies: [shared_dep, deps], + ) + test('tablet-cocoa', tablet_cocoa_test, timeout: 20) + cursor_cocoa_test = executable('yasl-cursor-cocoa-test', 'cocoa/test_cursor.m', + dependencies: [shared_dep, deps], + ) + test('cursor-cocoa', cursor_cocoa_test, timeout: 20) + test('tablet-cocoa-window', tablet_example, + args: ['--backend', 'cocoa', '--smoke-test'], timeout: 20, + ) else if not has_wayland or not has_x11 error('Linux integration tests require Wayland and X11.') @@ -115,7 +157,7 @@ if get_option('integration_tests') xwayland = find_program('Xwayland') test('backends', python, args: [files('helpers/run_backends.py'), weston, xwayland, - backend_test, timer_test], + backend_test, timer_test, tablet_example], timeout: 60, ) endif |
