From 61d6423fdd38e98ba230e73b5224d8290e7da7ee Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sat, 31 Oct 2026 14:36:42 -0700 Subject: [PATCH] test(e2e): handover needs two tiled containers on the workspace, or says so Scenario precondition fix; the check "the unmanaged window is inside the work area and not on a tile of the layout" itself stays as strict as it was. The KDE VM suite vm-commands failed it on a calm host, on the original komorebi-for-kde tip (7d19fd40) and on the refactored stage alike, with the same numbers each time: work area (0,0,1920,1080), layout a single tile (10,10,1900,1060), win3 at (10,10,1896,1050) (within the 24 px tolerance of that tile), win1/win2/win5 parked on workspace 3. After the sweep win3 was the only window on its workspace. Unmanaging a lone window leaves it on the tile it was put on, and an emptied workspace has nothing to calculate, so it keeps its last layout; "not on a tile" could never hold. The scenario now checks first that the focused workspace has at least two tiled containers and, if not, fails with a message that says so (and the describe() dump) instead of the misleading unmanage failure. Windows runs handover as its own suite with its three tiled clients on workspace 0, so the precondition holds there. The same file lives in e2e/lib and in komorebi-for-kde/nix/tests/vm/lib; both are edited alike. A fake-platform test covers the precondition; the existing handover cases still fail where they should. Native pytest of the VM lib: 320 passed; ruff check and format clean. VM verification: not yet (vm-commands on baseline-with-fix and candidate, ~20 min each, after the KDE VM run). --- e2e/lib/komorebi_vm/core/scenarios/handover.py | 13 +++++++++++++ .../vm/lib/komorebi_vm/core/scenarios/handover.py | 13 +++++++++++++ .../nix/tests/vm/lib/tests/test_moved.py | 13 ++++++++++++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/e2e/lib/komorebi_vm/core/scenarios/handover.py b/e2e/lib/komorebi_vm/core/scenarios/handover.py index 9f1a75bb..439ee301 100644 --- a/e2e/lib/komorebi_vm/core/scenarios/handover.py +++ b/e2e/lib/komorebi_vm/core/scenarios/handover.py @@ -22,7 +22,20 @@ def run(platform: Platform, checks: Checks, clients: list[Client]) -> None: They take a window out of the daemon's hands, so a sweep of commands does not run them. The window is tiled again at the end. + + There have to be two containers or more on the focused workspace. A window that is alone there + stays on the tile it was put on, and an emptied workspace keeps its last layout (the daemon has + nothing to calculate), so "not on a tile of the layout" could never hold: the scenario says so + and stops, rather than fail on a precondition that was never met. """ + tiled = len(platform.state().workspace().containers) + if not checks.check( + "the focused workspace has two tiled containers or more, for a window to be let go of" + f" (it has {tiled})", + tiled >= 2, + ): + print(describe(platform, clients)) + return title = platform.state().focused_title() target = Client(title) before = platform.state().managed() diff --git a/komorebi-for-kde/nix/tests/vm/lib/komorebi_vm/core/scenarios/handover.py b/komorebi-for-kde/nix/tests/vm/lib/komorebi_vm/core/scenarios/handover.py index 9f1a75bb..439ee301 100644 --- a/komorebi-for-kde/nix/tests/vm/lib/komorebi_vm/core/scenarios/handover.py +++ b/komorebi-for-kde/nix/tests/vm/lib/komorebi_vm/core/scenarios/handover.py @@ -22,7 +22,20 @@ def run(platform: Platform, checks: Checks, clients: list[Client]) -> None: They take a window out of the daemon's hands, so a sweep of commands does not run them. The window is tiled again at the end. + + There have to be two containers or more on the focused workspace. A window that is alone there + stays on the tile it was put on, and an emptied workspace keeps its last layout (the daemon has + nothing to calculate), so "not on a tile of the layout" could never hold: the scenario says so + and stops, rather than fail on a precondition that was never met. """ + tiled = len(platform.state().workspace().containers) + if not checks.check( + "the focused workspace has two tiled containers or more, for a window to be let go of" + f" (it has {tiled})", + tiled >= 2, + ): + print(describe(platform, clients)) + return title = platform.state().focused_title() target = Client(title) before = platform.state().managed() diff --git a/komorebi-for-kde/nix/tests/vm/lib/tests/test_moved.py b/komorebi-for-kde/nix/tests/vm/lib/tests/test_moved.py index 675bd9d6..8b484c55 100644 --- a/komorebi-for-kde/nix/tests/vm/lib/tests/test_moved.py +++ b/komorebi-for-kde/nix/tests/vm/lib/tests/test_moved.py @@ -60,7 +60,7 @@ def test_a_daemon_that_lets_go_and_takes_up_again_passes_handover() -> None: base = checks.passed handover.run(platform, checks, clients) assert checks.failed == 0, checks.failures - assert checks.passed - base == 5 + assert checks.passed - base == 6 def test_a_daemon_that_keeps_an_unmanaged_window_fails_handover() -> None: @@ -332,3 +332,14 @@ def test_a_crash_that_leaves_a_window_hidden_fails() -> None: clients = opened(platform, checks) lifecycle_hidden.crash(platform, checks, clients) assert any("none is left out of sight" in f for f in checks.failures), checks.failures + + +def test_a_window_that_is_alone_on_its_workspace_fails_handover_on_the_precondition() -> None: + platform = FakePlatform() + checks = Checks() + clients = opened(platform, checks) + platform.komorebic("send-to-workspace", "1") + platform.komorebic("send-to-workspace", "1") + handover.run(platform, checks, clients) + assert any("two tiled containers" in f for f in checks.failures) + assert not any("unmanage" in f for f in checks.failures)