test: cover camera device selection
This commit is contained in:
@@ -81,6 +81,7 @@
|
|||||||
- macOS camera: wait for exposure/white balance to settle before capturing a snap to avoid dark images.
|
- macOS camera: wait for exposure/white balance to settle before capturing a snap to avoid dark images.
|
||||||
- Camera snap: add `delayMs` parameter (default 2000ms on macOS) to improve exposure reliability.
|
- Camera snap: add `delayMs` parameter (default 2000ms on macOS) to improve exposure reliability.
|
||||||
- Camera: add `camera.list` and optional `deviceId` selection for snaps/clips.
|
- Camera: add `camera.list` and optional `deviceId` selection for snaps/clips.
|
||||||
|
- Tests: cover camera device selection params in CLI + agent tools.
|
||||||
- macOS packaging: move rpath config into swift build for reliability (#69) — thanks @petter-b
|
- macOS packaging: move rpath config into swift build for reliability (#69) — thanks @petter-b
|
||||||
- macOS: prioritize main bundle for device resources to prevent crash (#73) — thanks @petter-b
|
- macOS: prioritize main bundle for device resources to prevent crash (#73) — thanks @petter-b
|
||||||
- macOS remote: route settings through gateway config and avoid local config reads in remote mode.
|
- macOS remote: route settings through gateway config and avoid local config reads in remote mode.
|
||||||
|
|||||||
@@ -50,4 +50,39 @@ describe("clawdis_nodes camera_snap", () => {
|
|||||||
expect(images).toHaveLength(1);
|
expect(images).toHaveLength(1);
|
||||||
expect(images[0]?.mimeType).toBe("image/jpeg");
|
expect(images[0]?.mimeType).toBe("image/jpeg");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("passes deviceId when provided", async () => {
|
||||||
|
callGateway.mockImplementation(async ({ method, params }) => {
|
||||||
|
if (method === "node.list") {
|
||||||
|
return { nodes: [{ nodeId: "mac-1" }] };
|
||||||
|
}
|
||||||
|
if (method === "node.invoke") {
|
||||||
|
expect(params).toMatchObject({
|
||||||
|
command: "camera.snap",
|
||||||
|
params: { deviceId: "cam-123" },
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
payload: {
|
||||||
|
format: "jpg",
|
||||||
|
base64: "aGVsbG8=",
|
||||||
|
width: 1,
|
||||||
|
height: 1,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
throw new Error(`unexpected method: ${String(method)}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
const tool = createClawdisTools().find(
|
||||||
|
(candidate) => candidate.name === "clawdis_nodes",
|
||||||
|
);
|
||||||
|
if (!tool) throw new Error("missing clawdis_nodes tool");
|
||||||
|
|
||||||
|
await tool.execute("call1", {
|
||||||
|
action: "camera_snap",
|
||||||
|
node: "mac-1",
|
||||||
|
facing: "front",
|
||||||
|
deviceId: "cam-123",
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -425,6 +425,10 @@ describe("cli program", () => {
|
|||||||
"640",
|
"640",
|
||||||
"--quality",
|
"--quality",
|
||||||
"0.8",
|
"0.8",
|
||||||
|
"--delay-ms",
|
||||||
|
"2000",
|
||||||
|
"--device-id",
|
||||||
|
"cam-123",
|
||||||
],
|
],
|
||||||
{ from: "user" },
|
{ from: "user" },
|
||||||
);
|
);
|
||||||
@@ -442,6 +446,8 @@ describe("cli program", () => {
|
|||||||
facing: "front",
|
facing: "front",
|
||||||
maxWidth: 640,
|
maxWidth: 640,
|
||||||
quality: 0.8,
|
quality: 0.8,
|
||||||
|
delayMs: 2000,
|
||||||
|
deviceId: "cam-123",
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
@@ -494,6 +500,8 @@ describe("cli program", () => {
|
|||||||
"--duration",
|
"--duration",
|
||||||
"3000",
|
"3000",
|
||||||
"--no-audio",
|
"--no-audio",
|
||||||
|
"--device-id",
|
||||||
|
"cam-123",
|
||||||
],
|
],
|
||||||
{ from: "user" },
|
{ from: "user" },
|
||||||
);
|
);
|
||||||
@@ -509,6 +517,7 @@ describe("cli program", () => {
|
|||||||
idempotencyKey: "idem-test",
|
idempotencyKey: "idem-test",
|
||||||
params: expect.objectContaining({
|
params: expect.objectContaining({
|
||||||
includeAudio: false,
|
includeAudio: false,
|
||||||
|
deviceId: "cam-123",
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user