Expand render graph playground editing
Amp-Thread-ID: https://ampcode.com/threads/T-01a033d4-0e44-708e-af0e-6166283416ff Co-authored-by: Heaust Azure <heaust.azure@gmail.com>
This commit is contained in:
+13
-6
@@ -25,10 +25,16 @@ test("canvas-free authority owns independent attachable views", async ({ page })
|
||||
else if (message.type === "view.attach") {
|
||||
// Exercise the valid event-before-acknowledgement ordering.
|
||||
this.emit({
|
||||
protocol: 3,
|
||||
protocol: 4,
|
||||
type: "view.selection.host",
|
||||
viewId: message.viewId,
|
||||
projection: { nodeCount: 0, linkCount: 0, canRemove: false, mute: { enabled: false } },
|
||||
projection: {
|
||||
nodeIds: [],
|
||||
nodeCount: 0,
|
||||
linkCount: 0,
|
||||
canRemove: false,
|
||||
mute: { enabled: false },
|
||||
},
|
||||
});
|
||||
this.respond(message.id);
|
||||
} else if (message.type === "view.detach") this.respond(message.id);
|
||||
@@ -50,7 +56,7 @@ test("canvas-free authority owns independent attachable views", async ({ page })
|
||||
settleViewport(ok: boolean): void {
|
||||
const id = this.heldViewportIds.shift()!;
|
||||
this.emit({
|
||||
protocol: 3,
|
||||
protocol: 4,
|
||||
type: "response",
|
||||
id,
|
||||
ok,
|
||||
@@ -60,7 +66,7 @@ test("canvas-free authority owns independent attachable views", async ({ page })
|
||||
|
||||
private respond(id: string, value?: unknown): void {
|
||||
this.emit({
|
||||
protocol: 3,
|
||||
protocol: 4,
|
||||
type: "response",
|
||||
id,
|
||||
ok: true,
|
||||
@@ -100,10 +106,11 @@ test("canvas-free authority owns independent attachable views", async ({ page })
|
||||
duplicateCode = (error as { code?: string }).code ?? "";
|
||||
}
|
||||
worker.emit({
|
||||
protocol: 3,
|
||||
protocol: 4,
|
||||
type: "view.selection.host",
|
||||
viewId: first.id,
|
||||
projection: {
|
||||
nodeIds: ["selected-node"],
|
||||
nodeCount: 1,
|
||||
linkCount: 0,
|
||||
canRemove: true,
|
||||
@@ -171,7 +178,7 @@ test("canvas-free authority owns independent attachable views", async ({ page })
|
||||
modifiers,
|
||||
});
|
||||
worker.emit({
|
||||
protocol: 3,
|
||||
protocol: 4,
|
||||
type: "view.resource.open",
|
||||
viewId: first.id,
|
||||
requestId: resourceOpenRequestId,
|
||||
|
||||
+13
-2
@@ -7,7 +7,11 @@ test("host snapshots are stable immutable projections with isolated subscription
|
||||
view = window.view,
|
||||
first = view.getHostSnapshot(),
|
||||
same = first === view.getHostSnapshot(),
|
||||
frozen = Object.isFrozen(first) && Object.isFrozen(first.selection) && Object.isFrozen(first.selection.mute);
|
||||
frozen =
|
||||
Object.isFrozen(first) &&
|
||||
Object.isFrozen(first.selection) &&
|
||||
Object.isFrozen(first.selection.nodeIds) &&
|
||||
Object.isFrozen(first.selection.mute);
|
||||
let good = 0,
|
||||
bad = 0;
|
||||
const offBad = view.subscribeHost(() => {
|
||||
@@ -172,6 +176,7 @@ test("explicit node and selection actions preserve worker authority and structur
|
||||
expect(result.duplicate).toBe("node.duplicate");
|
||||
expect(result.added).toEqual({ status: "committed", version: 2 });
|
||||
expect(result.selected).toEqual({
|
||||
nodeIds: ["supplied-id"],
|
||||
nodeCount: 1,
|
||||
linkCount: 0,
|
||||
canRemove: true,
|
||||
@@ -182,7 +187,13 @@ test("explicit node and selection actions preserve worker authority and structur
|
||||
expect(result.mutedSelection.mute).toEqual({ enabled: true, state: "all-muted" });
|
||||
expect(result.removed).toEqual({ status: "committed", version: 4 });
|
||||
expect(result.remaining).toBe(0);
|
||||
expect(result.empty).toEqual({ nodeCount: 0, linkCount: 0, canRemove: false, mute: { enabled: false } });
|
||||
expect(result.empty).toEqual({
|
||||
nodeIds: [],
|
||||
nodeCount: 0,
|
||||
linkCount: 0,
|
||||
canRemove: false,
|
||||
mute: { enabled: false },
|
||||
});
|
||||
expect(result.notifications).toBe(3);
|
||||
});
|
||||
test("dedicated worker renders, commits FIFO, fans out and destroys", async ({ page }) => {
|
||||
|
||||
+7
-1
@@ -336,7 +336,13 @@ test("selection publication does not wait for frame consumption", async ({ page
|
||||
expect(result).toEqual({
|
||||
receipt: { status: "committed", version: 2 },
|
||||
changed: true,
|
||||
selection: { nodeCount: 1, linkCount: 0, canRemove: true, mute: { enabled: true, state: "all-unmuted" } },
|
||||
selection: {
|
||||
nodeIds: ["blocked-frame"],
|
||||
nodeCount: 1,
|
||||
linkCount: 0,
|
||||
canRemove: true,
|
||||
mute: { enabled: true, state: "all-unmuted" },
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -334,6 +334,7 @@ test("worker resource requests close delayed add-menu UI without intercepting in
|
||||
compositionRevision: 0,
|
||||
colorPickerOpen: false,
|
||||
selection: Object.freeze({
|
||||
nodeIds: Object.freeze([]),
|
||||
nodeCount: 0,
|
||||
linkCount: 0,
|
||||
canRemove: false,
|
||||
@@ -424,6 +425,7 @@ test("default resource picker ignores obsolete asynchronous reads", async ({ pag
|
||||
compositionRevision: 0,
|
||||
colorPickerOpen: false,
|
||||
selection: Object.freeze({
|
||||
nodeIds: Object.freeze([]),
|
||||
nodeCount: 0,
|
||||
linkCount: 0,
|
||||
canRemove: false,
|
||||
|
||||
+1
-1
@@ -399,7 +399,7 @@ test("live composition instance API keeps one worker-authoritative revisioned ha
|
||||
};
|
||||
worker.addEventListener("message", listener);
|
||||
worker.postMessage({
|
||||
protocol: 3,
|
||||
protocol: 4,
|
||||
type: "composition.update",
|
||||
id,
|
||||
expected: { kind: "exact", revision: -1 },
|
||||
|
||||
Vendored
+15
-1
@@ -599,12 +599,26 @@ test("action requests, selection projections, menu results, and receipts are exa
|
||||
protocol: PROTOCOL_VERSION,
|
||||
type: "view.selection.host",
|
||||
viewId,
|
||||
projection: { nodeCount, linkCount, canRemove, mute: { enabled: false } },
|
||||
projection: {
|
||||
nodeIds: Array.from({ length: nodeCount }, (_, index) => `node-${index}`),
|
||||
nodeCount,
|
||||
linkCount,
|
||||
canRemove,
|
||||
mute: { enabled: false },
|
||||
},
|
||||
});
|
||||
assert.equal(validWorkerMessage(selection(0, 0, false)), true);
|
||||
assert.equal(validWorkerMessage(selection(1, 0, true)), true);
|
||||
assert.equal(validWorkerMessage(selection(0, 0, true)), false);
|
||||
assert.equal(validWorkerMessage(selection(1, 0, false)), false);
|
||||
const mismatchedSelection = selection(1, 0, true);
|
||||
assert.equal(
|
||||
validWorkerMessage({
|
||||
...mismatchedSelection,
|
||||
projection: { ...mismatchedSelection.projection, nodeCount: 0 },
|
||||
}),
|
||||
false,
|
||||
);
|
||||
assert.equal(
|
||||
validWorkerMessage({
|
||||
protocol: PROTOCOL_VERSION,
|
||||
|
||||
Reference in New Issue
Block a user