From 72631512750c385cce4c930fcc17f2787c9cc5e4 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Fri, 30 Oct 2026 16:20:00 -0700 Subject: [PATCH] test(nix): a failed ring check of wallpaper prints what it saw The frame of the window, the hue that was found and the colors of the pixels near its left edge, so that a port whose border is not repainted (or is drawn elsewhere) can be told from one that has no border. --- .../lib/komorebi_vm/core/scenarios/wallpaper.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/nix/tests/vm/lib/komorebi_vm/core/scenarios/wallpaper.py b/nix/tests/vm/lib/komorebi_vm/core/scenarios/wallpaper.py index 39c70384..3ebc9702 100644 --- a/nix/tests/vm/lib/komorebi_vm/core/scenarios/wallpaper.py +++ b/nix/tests/vm/lib/komorebi_vm/core/scenarios/wallpaper.py @@ -88,13 +88,25 @@ def run(platform: Platform, checks: Checks) -> None: return platform.wait_for(lambda: hue_of(platform.screenshot(name)) == hue, timeout=20) def has_ring(client: Client, hue: str, name: str) -> bool: - """The window has a ring of `hue` in a screenshot taken until it does.""" + """The window has a ring of `hue` in a screenshot taken until it does. When it has not, + what the last screenshot had is printed: the frame, and the colors it was read from.""" def ring() -> bool: window = platform.os_window(client) return window is not None and ring_hue(window.frame, platform.screenshot(name)) == hue - return platform.wait_for(ring, timeout=20) + if platform.wait_for(ring, timeout=20): + return True + window = platform.os_window(client) + if window is None: + print(f" {client.title} has no window") + else: + image = platform.screenshot(name) + f = window.frame + y = f.y + f.h // 2 + row = [pixels.pixel(image, x, y) for x in range(max(0, f.x - 12), f.x + 12, 2)] + print(f" {client.title} {f}: ring {ring_hue(f, image)}, wanted {hue}; pixels {row}") + return False platform.set_wallpaper(other) checks.check(