Advance N-015 through N-018 bounded workflows
This commit is contained in:
@@ -44,6 +44,17 @@ function command(engine, handle, payload) {
|
||||
finally { engine._free(pointer); }
|
||||
}
|
||||
|
||||
function reject(engine, handle, payload, code) {
|
||||
const bytes = new TextEncoder().encode(JSON.stringify(payload));
|
||||
const pointer = engine._malloc(bytes.byteLength);
|
||||
try {
|
||||
engine.HEAPU8.set(bytes, pointer);
|
||||
assert.notEqual(engine._web_engine_apply_command(handle, pointer, bytes.byteLength), 0, `${payload.type} unexpectedly succeeded`);
|
||||
assert.match(engine.UTF8ToString(engine._web_engine_last_error_message()), new RegExp(code));
|
||||
}
|
||||
finally { engine._free(pointer); }
|
||||
}
|
||||
|
||||
function snapshot(engine, handle) {
|
||||
return JSON.parse(new TextDecoder().decode(output(engine, handle, engine._web_engine_get_scene_snapshot)));
|
||||
}
|
||||
@@ -198,7 +209,8 @@ const curveCyclic = curve.cyclicU.map((value, index) => index === 0 ? !value : v
|
||||
const curveHandlePoints = curve.handlePoints.slice();
|
||||
curveHandlePoints[0] += 0.25;
|
||||
curveHandlePoints[15] -= 0.2;
|
||||
command(engine, handle, { type: "setCurveTopology", dataId: curveId, splineTypes: curve.splineTypes, cyclicU: curveCyclic, cyclicV: curve.cyclicV, handleTypes: curve.handleTypes, handlePoints: curveHandlePoints });
|
||||
reject(engine, handle, { type: "setCurveTopology", baseRevision: snapshot(engine, handle).revision - 1, dataId: curveId, splineTypes: curve.splineTypes, cyclicU: curveCyclic, cyclicV: curve.cyclicV, handleTypes: curve.handleTypes, handlePoints: curveHandlePoints }, "REVISION_CONFLICT");
|
||||
command(engine, handle, { type: "setCurveTopology", baseRevision: snapshot(engine, handle).revision, dataId: curveId, splineTypes: curve.splineTypes, cyclicU: curveCyclic, cyclicV: curve.cyclicV, handleTypes: curve.handleTypes, handlePoints: curveHandlePoints });
|
||||
const preciseHandlePosition = curveHandlePoints.slice(12, 15);
|
||||
preciseHandlePosition[2] += 0.125;
|
||||
command(engine, handle, { type: "setCurveHandle", dataId: curveId, pointIndex: curve.handlePointIndices[2], side: "LEFT", position: preciseHandlePosition });
|
||||
|
||||
Reference in New Issue
Block a user