From 7890315cf6b258375b73dec98b6252ca9fad73be Mon Sep 17 00:00:00 2001 From: Hermenix Date: Sun, 4 Oct 2026 04:16:46 +0000 Subject: [PATCH] checks(unit): xkbcommon in the suite's env, and the two-warp acquire MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two gaps found by running more than the gate command. `checks/unit.nix` builds its own `python3.withPackages` and had only pytest and pywayland in it, so `nix build .#checks.unit` would have collected tests/pointer/test_keymap.py and failed on the import. The dev shell has xkbcommon through nix/package.nix and the gate command therefore never noticed. It is not an optional dependency: that file compiles a real `us` keymap and a real `de` one, because only xkbcommon can say `é` is unmappable on `us` and that `@` on `de` needs a level-three mask. And two integration tests asserted acquire's single warp, which is now two. They are the whole-gesture trace and the bookmark-survives-a- restart case, and both now assert the pair -- with the restored position as the SECOND warp, since the bookmark is where the cursor is left and the reverse order would restore every session a few pixels off. nix develop -c python -m pytest tests -q 905 passed in 65.91s nix build --no-link .#checks.x86_64-linux.unit 903 passed, 2 skipped in 73.24s unit suite: 905 collected, 903 executed, 0 failed, 0 errored, 2 skipped Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01GhNPM6rGcuzxocM1nATnuM --- checks/unit.nix | 8 +++++++- tests/sessions/integration/test_containers.py | 12 +++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/checks/unit.nix b/checks/unit.nix index de0ac15..4a29301 100644 --- a/checks/unit.nix +++ b/checks/unit.nix @@ -18,7 +18,13 @@ hhstream, }: let - pytestEnv = python3.withPackages (ps: [ ps.pytest ps.pywayland ]); + # `xkbcommon` beside `pywayland`, and it is not optional: `tests/pointer/ + # test_keymap.py` compiles a real `us` keymap and a real `de` one, because + # only xkbcommon can say that `é` is unmappable on `us` and that `@` on `de` + # needs a level-three mask rather than Shift. A suite that could skip those + # would let the unmappable-character path rot, which is the path that decides + # whether a bad string types a prefix. + pytestEnv = python3.withPackages (ps: [ ps.pytest ps.pywayland ps.xkbcommon ]); # Only the suite itself, so an editor's droppings or a local .pytest_cache # cannot change the derivation's hash. diff --git a/tests/sessions/integration/test_containers.py b/tests/sessions/integration/test_containers.py index 4ebd79f..25e224a 100644 --- a/tests/sessions/integration/test_containers.py +++ b/tests/sessions/integration/test_containers.py @@ -450,6 +450,11 @@ def test_a_whole_gesture_runs_through_the_broker_and_the_driver(rig: Rig): assert released["buttons_lifted"] == [] assert rig.driver.sink.calls == [ + # Acquire is TWO warps: one warp onto an idle cursor moves the cursor + # and not keyboard focus, so acquire nudges to a neighbouring pixel and + # then lands on the target. The second one is the bookmark. + ("warp", output, 0.5, 0.504), + ("frame", output), ("warp", output, 0.5, 0.5), ("frame", output), ("warp", output, 0.25, 0.75), @@ -572,7 +577,12 @@ def test_a_restored_bookmark_survives_a_daemon_restart(short_tmpdir: Path): acquired = rig.daemon.call("pointer.acquire", id=session_id) assert (acquired["bookmark"]["x"], acquired["bookmark"]["y"]) == (0.8, 0.2) - assert rig.driver.sink.of("warp") == [("warp", f"hh-{session_id}", 0.8, 0.2)] + # The nudge, then the restored position: the bookmark has to be the + # *second* warp, or every restore would be a few pixels off. + assert rig.driver.sink.of("warp") == [ + ("warp", f"hh-{session_id}", 0.8, 0.204), + ("warp", f"hh-{session_id}", 0.8, 0.2), + ] finally: _kill_everything(rig.daemon) rig.stop()