feat: testing scaled screenshots to normalized coordinate space

This commit is contained in:
Zoe
2026-09-20 23:13:17 -05:00
parent d1b14cb1f0
commit f4aef8f5f3
3 changed files with 31 additions and 4 deletions
+7 -1
View File
@@ -1,7 +1,7 @@
import { test } from "node:test";
import assert from "node:assert/strict";
import { complete } from "../src/model.js";
import { desktopArguments, shellArguments, toolsForCoordinates } from "../src/tools.js";
import { desktopArguments, scaleImage, shellArguments, toolsForCoordinates } from "../src/tools.js";
const config: import("../src/config.js").Config = { coordinateSpace: "pixels", llamaCppOrigin: "http://example.test", modelId: "test", databasePath: ":memory:" };
@@ -37,3 +37,9 @@ test("tool inputs reject invalid commands, bounds, and action names", () => {
assert.throws(() => desktopArguments.parse({ actions: [{ type: "click_target", target: "1" }] }));
assert.equal(desktopArguments.parse({ actions: [{ type: "click_target", target: "1", observationId: "frame" }] }).actions[0]?.type, "click_target");
});
test("scaleImage resizes PNG to requested dimensions", async () => {
const buffer = await scaleImage("artifacts/first.png", 1000, 1000);
assert.ok(Buffer.isBuffer(buffer));
assert.ok(buffer.length > 0);
});