feat(e2e): add probes of padding, exe rules and locking

w1_padding.py compares kfw's padding with its frames, w1_rules_exe.py runs
the exe rules with the extension in the id, w1_lock.py moves a window
while the screen is locked.
This commit is contained in:
LGUG2Z committed 2026-10-30 18:22:44 -07:00
1 parent 275e6b24ae
commit 206fa1748a
3 files changed
+139

No files matched your search

+51
View File
@@ -0,0 +1,51 @@
"""W1: can a window be moved while the screen is locked, and does kfw undo it?
usage: python -m platforms.qemu_windows.w1_lock GOLDEN BIN_DIR OUT [STATE]
Tiles the windows, locks, moves the first window to (400, 300) and prints its
frame and the daemon's idea of the managed windows at once, after 5 s locked,
and after the unlock. A probe: it prints what it saw.
"""
import importlib
import sys
import time
from pathlib import Path
from komorebi_vm.core.checks import Checks
from .guest import Guest
from .run import BINARIES
from .windows_platform import WindowsPlatform
def main(argv: list[str]) -> int:
golden, bin_dir, out = (Path(a) for a in argv[:3])
state = Path(argv[3]) if len(argv) > 3 else None
out.mkdir(parents=True, exist_ok=True)
tiling = importlib.import_module("komorebi_vm.core.scenarios.tiling")
with Guest(golden, out / "guest", state=state) as guest:
guest.upload(bin_dir, BINARIES)
platform = WindowsPlatform(guest.qmp, guest.agent, out, scale=1.5)
platform.start_komorebi()
clients = tiling.run(platform, Checks())
first = clients[0]
print(f"PASTE tiled: {platform.os_window(first).frame}")
platform.lock()
print(f"PASTE locked; windows the OS lists: "
f"{len(guest.agent.os_windows())}")
platform.move_window(first, 400, 300)
print(f"PASTE moved, at once: {platform.os_window(first).frame}")
time.sleep(5)
print(f"PASTE 5 s later, still locked: "
f"{platform.os_window(first).frame}")
platform.unlock()
time.sleep(1)
print(f"PASTE just unlocked: {platform.os_window(first).frame}")
time.sleep(5)
print(f"PASTE 5 s after the unlock: {platform.os_window(first).frame}")
return 0
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
+46
View File
@@ -0,0 +1,46 @@
"""W1: does kfw's state agree with how far its windows sit from the edge?
usage: python -m platforms.qemu_windows.w1_padding GOLDEN BIN_DIR OUT [STATE]
Opens the tiling windows and prints the padding the state gives, the work
area, and each frame's distance from the work area's edges. A probe: it
prints what it saw.
"""
import importlib
import sys
from pathlib import Path
from komorebi_vm.core.checks import Checks
from .guest import Guest
from .run import BINARIES
from .windows_platform import WindowsPlatform
def main(argv: list[str]) -> int:
golden, bin_dir, out = (Path(a) for a in argv[:3])
state = Path(argv[3]) if len(argv) > 3 else None
out.mkdir(parents=True, exist_ok=True)
tiling = importlib.import_module("komorebi_vm.core.scenarios.tiling")
with Guest(golden, out / "guest", state=state) as guest:
guest.upload(bin_dir, BINARIES)
platform = WindowsPlatform(guest.qmp, guest.agent, out, scale=1.5)
platform.start_komorebi()
clients = tiling.run(platform, Checks())
workspace = platform.state().workspace()
print(f"PASTE state: workspace padding {workspace.workspace_padding}"
f", container padding {workspace.container_padding}")
area = platform.work_area()
print(f"PASTE work area {area}")
for c in clients:
f = platform.os_window(c).frame
print(f"PASTE {c.title}: frame {f}; from the left "
f"{f.x - area.x}, top {f.y - area.y}, right "
f"{area.x + area.w - f.x - f.w}, bottom "
f"{area.y + area.h - f.y - f.h}")
return 0
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
@@ -0,0 +1,42 @@
"""W1: does an exe rule on kfw need the extension in its id?
usage: python -m platforms.qemu_windows.w1_rules_exe GOLDEN BIN_DIR OUT [STATE]
Runs the `rules_exe` scenario with the rule ids spelled `NAME.exe`, which is
how kfw names the exe of a window, and prints its checks. A probe.
"""
import importlib
import inspect
import sys
from pathlib import Path
from .guest import Guest
from .run import BINARIES, RecordedChecks
from .windows_platform import WindowsPlatform
def main(argv: list[str]) -> int:
golden, bin_dir, out = (Path(a) for a in argv[:3])
state = Path(argv[3]) if len(argv) > 3 else None
out.mkdir(parents=True, exist_ok=True)
module = importlib.import_module("komorebi_vm.core.scenarios.rules_exe")
source = inspect.getsource(module)
for name in ("sent", "left"):
source = source.replace(
f'"exe", "e2e-exe-{name}"', f'"exe", "e2e-exe-{name}.exe"'
)
scope: dict = {}
exec(compile(source, "rules_exe_exe", "exec"), scope)
with Guest(golden, out / "guest", state=state) as guest:
guest.upload(bin_dir, BINARIES)
platform = WindowsPlatform(guest.qmp, guest.agent, out, scale=1.5)
platform.start_komorebi()
checks = RecordedChecks()
scope["run"](platform, checks)
print(f"PASTE passed {checks.passed} failed {checks.failed}")
return 0
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))