Serialize to node pos/size to plain array (#273)

This commit is contained in:
Chenlei Hu
2024-11-04 14:08:09 -05:00
committed by GitHub
parent 6c60045208
commit b663f86c9e
2 changed files with 8 additions and 5 deletions

View File

@@ -3,11 +3,14 @@ import {
} from "../src/litegraph"
describe("LGraphNode", () => {
it("should serialize position correctly", () => {
it("should serialize position/size correctly", () => {
const node = new LGraphNode("TestNode")
node.pos = [10, 10]
expect(node.pos).toEqual(new Float32Array([10, 10]))
expect(node.serialize().pos).toEqual(new Float32Array([10, 10]))
})
expect(node.serialize().pos).toEqual([10, 10])
node.size = [100, 100]
expect(node.size).toEqual(new Float32Array([100, 100]))
expect(node.serialize().size).toEqual([100, 100])
})
})