From c71c8fd0132f8f0cf6861014dfd0810f9704d26b Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Fri, 30 Oct 2026 12:53:46 -0700 Subject: [PATCH] fix(nix): the monocle check and the fakes, after merging the agents --- .../lib/komorebi_vm/core/scenarios/monocle.py | 2 +- nix/tests/vm/lib/tests/fake_desk.py | 27 ++++++++++++++++++- nix/tests/vm/lib/tests/fake_platform.py | 6 +++-- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/nix/tests/vm/lib/komorebi_vm/core/scenarios/monocle.py b/nix/tests/vm/lib/komorebi_vm/core/scenarios/monocle.py index b35b7a34..272e2cf4 100644 --- a/nix/tests/vm/lib/komorebi_vm/core/scenarios/monocle.py +++ b/nix/tests/vm/lib/komorebi_vm/core/scenarios/monocle.py @@ -38,7 +38,7 @@ def run(platform: Platform, checks: Checks, clients: list[Client]) -> None: window = platform.os_window(last) checks.check( "... without going past the work area", - window is not None and window.frame.inside(area), + window is not None and window.frame.inside(platform.work_area()), ) checks.check( "... the daemon's state has it as the monocle container", diff --git a/nix/tests/vm/lib/tests/fake_desk.py b/nix/tests/vm/lib/tests/fake_desk.py index 7e58e51a..192aa51f 100644 --- a/nix/tests/vm/lib/tests/fake_desk.py +++ b/nix/tests/vm/lib/tests/fake_desk.py @@ -168,6 +168,24 @@ class FakeDesk: def screenshot(self, name: str) -> Image.Image: return Image.new("RGB", (4, 4)) + def resizable_display(self) -> int | None: + return None + + def resize_display(self, index: int, width: int, height: int) -> None: + pass + + def crash(self) -> None: + pass + + def temp_path(self, name: str) -> str: + return f"/tmp/{name}" + + def fullscreen(self, client: Client, on: bool = True) -> None: + pass + + def user_maximize(self, client: Client, on: bool = True) -> None: + pass + def exe_id(self, program: str) -> str: return program @@ -249,7 +267,14 @@ class FakeDesk: mon.spaces.append(Space()) mon.shown = workspace - def spawn(self, title: str, app_id: str | None = None, exe: str | None = None) -> Client: + def spawn( + self, + title: str, + app_id: str | None = None, + exe: str | None = None, + rename_to: str | None = None, + after: float = 0, + ) -> Client: self.order.append(title) target = self._by_rule(title) if target is not None: diff --git a/nix/tests/vm/lib/tests/fake_platform.py b/nix/tests/vm/lib/tests/fake_platform.py index 2dbb558d..f50ded50 100644 --- a/nix/tests/vm/lib/tests/fake_platform.py +++ b/nix/tests/vm/lib/tests/fake_platform.py @@ -339,8 +339,7 @@ class FakePlatform: self._place(title) else: self.containers.append([title]) - if len(self.containers) > len(self.tiles): - self._relayout() + self._relayout() if not self.keeps_fullscreen: self.fullscreened = None if self.applies_rules_on_event: @@ -419,6 +418,9 @@ class FakePlatform: def resizable_display(self) -> int | None: return self.display_count - 1 if self.resizable and self.display_count > 1 else None + def resize_display(self, index: int, width: int, height: int) -> None: + self.mode[index] = (width, height) + def _others(self) -> list[Rect]: """The displays after the first, side by side to its right.""" found = []