test(kde): vm-commands brings the swept windows back before handover

Scenario precondition fix for the vm-commands failure "[shared] win3 is inside the work area and
not on a tile of the layout" (see the previous revision for the log evidence).

The shared sweep sends windows to other workspaces (send-to-last-workspace and the like), so
by the time handover ran, win3 was alone on workspace 0 and win1/win2/win5 were parked on
workspace 3. New KDE step bring_back, between replace_configuration and handover: while another
workspace of the first monitor has windows, focus it and send-to-workspace 0, then focus
workspace 0 and check that it has two containers or more and is the focused one. The handover
check is untouched.

Native pytest of the VM lib: 320 passed; ruff check and format clean. The step itself only runs
in the VM.
VM verification: not yet (vm-commands on baseline-with-fix and candidate, ~20 min each, after the
KDE VM run).
This commit is contained in:
LGUG2Z committed 2026-11-05 15:03:26 -08:00
1 parent 61d6423fdd
commit b680dbd31d
2 files changed
+39 -2

No files matched your search

@@ -6,8 +6,8 @@ windows and that every command is understood and leaves the daemon healthy, as t
sees it; what is here reads KWin (`kdotool`) and the daemon's log.
The suite runs `setup`, `layouts_by_count`, the shared `layouts` and `sweep`,
`replace_configuration`, the shared `handover`, `title_rule`, `prints` and `queries`, and
`at_the_end`.
`replace_configuration`, `bring_back`, the shared `handover`, `title_rule`, `prints` and
`queries`, and `at_the_end`.
The daemon runs on a session with two outputs, and `clients` are five windows on the first.
"""
@@ -143,6 +143,42 @@ def replace_configuration(platform: KdePlatform, checks: Checks, clients: list[C
)
def bring_back(platform: KdePlatform, checks: Checks, clients: list[Client]) -> None:
"""Puts the windows the sweep sent to other workspaces back on the first, a container each, and
focuses it, so that the scenarios after it start from the windows the sweep left, on one
workspace, as the shared `handover` needs (a window alone on its workspace has no layout to be
left out of).
"""
def count() -> int:
return len(platform.state().workspace(0).windows())
for _ in clients:
elsewhere = [
i
for i, ws in enumerate(platform.state().monitors[0].workspaces)
if i != 0 and ws.windows()
]
if not elsewhere:
break
here = count()
platform.komorebic("focus-workspace", str(elsewhere[0]))
platform.komorebic("send-to-workspace", "0")
platform.wait_for(lambda h=here: count() > h, timeout=10)
platform.komorebic("focus-workspace", "0")
state = platform.state
checks.check(
"the windows are back on the first workspace, in view, in a container each",
platform.wait_for(
lambda: (
len(state().workspace(0).containers) >= 2
and state().monitors[0].focused_workspace == 0
),
timeout=10,
),
)
def at_the_end(platform: KdePlatform, checks: Checks, clients: list[Client]) -> None:
"""The daemon has every window KWin has, each is where the daemon last asked for it, and a
clean stop leaves the daemon not running."""
@@ -45,6 +45,7 @@ run_suite(
platform_only("kde", kde.komorebic, "change-layout", "bsp"),
shared(commands.sweep, *args, CONFIG),
platform_only("kde", kde_commands.replace_configuration, *args),
platform_only("kde", kde_commands.bring_back, *args),
shared(handover.run, *args),
shared(title_rule.run, platform, checks),
shared(commands.prints, platform, checks),