From dfd3d281a54931cf8a81d1dd60b6da5c415de2d0 Mon Sep 17 00:00:00 2001 From: BugFest Date: Sun, 22 Sep 2024 11:30:36 +0200 Subject: [PATCH] feat(WriteTask): Add struct+array test --- src/WriteTask.spec.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/WriteTask.spec.ts b/src/WriteTask.spec.ts index 8604d73a..e1c60149 100644 --- a/src/WriteTask.spec.ts +++ b/src/WriteTask.spec.ts @@ -836,5 +836,32 @@ describe("WriteTask", function () { // const missing = Object.keys(before).filter((k) => !(k in after)) // console.log({ missing }) }) + + it("supports creating arrays in structs", async () => { + const f = await testImg() + const regionData = { + RegionInfo: { + AppliedToDimensions: { W: 10, H: 10, Unit: "pixel" }, + RegionList: [ + { + Area: { X: 0.5, Y: 0.5, W: 0.1, H: 0.1, Unit: "normalized" }, + Rotation: 0, + Type: "Face", + Name: "randomName1", + }, + { + Area: { X: 0.5, Y: 0.5, W: 0.1, H: 0.1, Unit: "normalized" }, + Rotation: 0, + Type: "Face", + Name: "randomName2", + }, + ], + }, + } + + await exiftool.write(f, regionData) + const after = await exiftool.read(f) + expect(after).to.containSubset(regionData) + }) }) })