From 47fe85c5dccef4afb287c3e4ede4732a1a3eaf3c Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Sun, 15 Nov 2026 13:20:27 -0500 Subject: [PATCH] test(cua): give the fake zoom its own image 1d896a51 made a cell attach identical image bytes only once ("already attached"), on purpose: a plugin's screenshot shown again by path should not cost the model a second image. The fake cua driver answered zoom with the same 16x12 PNG as the window snapshot, so the zoom's attachment was deduplicated and the test saw one image instead of two. Return a distinct 8x4 PNG, matching the size the fake already reports for the zoom, and assert each image is the one its call produced. --- test/e2e/cua_test.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/e2e/cua_test.py b/test/e2e/cua_test.py index e84e88b40..d41ddaf14 100644 --- a/test/e2e/cua_test.py +++ b/test/e2e/cua_test.py @@ -28,6 +28,9 @@ def png_bytes(width: int, height: int) -> bytes: WINDOW_PNG = png_bytes(16, 12) WINDOW_PNG_B64 = base64.b64encode(WINDOW_PNG).decode("ascii") +# A cell attaches an image once, so the zoom must differ from the window shot. +ZOOM_PNG = png_bytes(8, 4) +ZOOM_PNG_B64 = base64.b64encode(ZOOM_PNG).decode("ascii") FAKE_DRIVER = f"""#!/usr/bin/env python3 import base64 @@ -36,7 +39,7 @@ from pathlib import Path import sys PNG = base64.b64decode({WINDOW_PNG_B64!r}) -PNG_B64 = {WINDOW_PNG_B64!r} +ZOOM_PNG_B64 = {ZOOM_PNG_B64!r} LOG = Path(sys.argv[0]).with_name("calls.jsonl") SOCKET = sys.argv[sys.argv.index("--socket") + 1] if "--socket" in sys.argv else None @@ -190,7 +193,7 @@ for raw in sys.stdin: resp = ok( req_id, {{"tool": "zoom", "args": args, "width": 8, "height": 4, "format": "png"}}, - image_b64=PNG_B64, + image_b64=ZOOM_PNG_B64, ) elif name == "click" and args.get("delivery_mode") == "background" and args.get("x") == 999: resp = err( @@ -390,7 +393,7 @@ Path({str(marker)!r}).write_text("ok", encoding="utf-8") encoded = re.findall(r"data:image/png;base64,([A-Za-z0-9+/=]+)", sent) self.assertEqual(len(encoded), 2) self.assertEqual(base64.b64decode(encoded[0]), WINDOW_PNG) - self.assertEqual(base64.b64decode(encoded[1]), WINDOW_PNG) + self.assertEqual(base64.b64decode(encoded[1]), ZOOM_PNG) calls = [ json.loads(line) -- knotmirror 0.0.1