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)