@embedpdf/engine-core 3.0.0-next.2 → 3.0.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AbortError-ByBflvEl.cjs → AbortError-BFwCIKC6.cjs} +2 -2
- package/dist/{AbortError-ByBflvEl.cjs.map → AbortError-BFwCIKC6.cjs.map} +1 -1
- package/dist/{AbortError-CjSasIlL.js → AbortError-D0w0N4pJ.js} +2 -2
- package/dist/{AbortError-CjSasIlL.js.map → AbortError-D0w0N4pJ.js.map} +1 -1
- package/dist/{AnnotationListSnapshot-W0RCsyDE.d.cts → AnnotationListSnapshot-_Z600IzD.d.cts} +216 -20
- package/dist/{AnnotationListSnapshot-W0RCsyDE.d.ts → AnnotationListSnapshot-_Z600IzD.d.ts} +216 -20
- package/dist/{DocumentSecurityService-B-tULKNY.d.ts → DocumentSecurityService-BR4tesJK.d.ts} +2 -2
- package/dist/{DocumentSecurityService-Df79fgpe.d.cts → DocumentSecurityService-CoHQf0Ju.d.cts} +2 -2
- package/dist/{Engine-D9loFZc1.d.cts → Engine-LHgbW5z-.d.cts} +4 -4
- package/dist/{Engine-B7Oe7f5i.d.ts → Engine-h_6P4pjM.d.ts} +4 -4
- package/dist/{builders-C548U47M.js → builders-BWgXkLKd.js} +382 -167
- package/dist/builders-BWgXkLKd.js.map +1 -0
- package/dist/{builders-BvikWRuO.cjs → builders-CBK8k_cn.cjs} +423 -220
- package/dist/builders-CBK8k_cn.cjs.map +1 -0
- package/dist/conformance.cjs +303 -135
- package/dist/conformance.cjs.map +1 -1
- package/dist/conformance.d.cts +37 -3
- package/dist/conformance.d.ts +37 -3
- package/dist/conformance.js +303 -136
- package/dist/conformance.js.map +1 -1
- package/dist/{fold-CB4fAOOy.js → fold-D3_ZiKOg.js} +162 -3
- package/dist/fold-D3_ZiKOg.js.map +1 -0
- package/dist/{fold-IaMph3CO.cjs → fold-M6iEyY8X.cjs} +233 -2
- package/dist/fold-M6iEyY8X.cjs.map +1 -0
- package/dist/index.cjs +22 -12
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/runtime.cjs +23 -13
- package/dist/runtime.d.cts +4 -4
- package/dist/runtime.d.ts +4 -4
- package/dist/runtime.js +5 -5
- package/dist/{schemas-9OpSSeM6.js → schemas-C32v81cE.js} +29 -4
- package/dist/schemas-C32v81cE.js.map +1 -0
- package/dist/{schemas-B_1VyFsm.cjs → schemas-CLByd6ze.cjs} +29 -4
- package/dist/schemas-CLByd6ze.cjs.map +1 -0
- package/dist/{subtype-qejjVr6h.cjs → subtype-C4XA7C16.cjs} +9 -1
- package/dist/subtype-C4XA7C16.cjs.map +1 -0
- package/dist/{subtype-BvAzLCGC.js → subtype-DsxZbJtP.js} +9 -1
- package/dist/subtype-DsxZbJtP.js.map +1 -0
- package/dist/wire.cjs +14 -1
- package/dist/wire.cjs.map +1 -1
- package/dist/wire.d.cts +13 -4
- package/dist/wire.d.ts +13 -4
- package/dist/wire.js +14 -2
- package/dist/wire.js.map +1 -1
- package/package.json +1 -1
- package/dist/builders-BvikWRuO.cjs.map +0 -1
- package/dist/builders-C548U47M.js.map +0 -1
- package/dist/fold-CB4fAOOy.js.map +0 -1
- package/dist/fold-IaMph3CO.cjs.map +0 -1
- package/dist/schemas-9OpSSeM6.js.map +0 -1
- package/dist/schemas-B_1VyFsm.cjs.map +0 -1
- package/dist/subtype-BvAzLCGC.js.map +0 -1
- package/dist/subtype-qejjVr6h.cjs.map +0 -1
package/dist/conformance.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as AbortError } from "./AbortError-
|
|
4
|
-
import { A as FormSetValueResultSchema, At as AnnotationDTOSchema, B as PageDeleteResultSchema, G as PageListSnapshotSchema, H as PageFlattenResultSchema, O as FormImportResultSchema, Q as PageRotateResultSchema, a as AnnotationCreateResultSchema, c as AnnotationListPageSnapshotSchema, d as AnnotationUpdateResultSchema, k as FormRepairResultSchema, l as AnnotationListSnapshotAllPagesSchema, o as AnnotationDeleteResultSchema, q as PageMoveResultSchema, rt as RedactionApplyResultSchema, tt as PageTextSnapshotSchema, u as AnnotationMoveResultSchema, ur as DocumentActionsSnapshotSchema, ut as SearchSliceSchema, wt as FormSnapshotSchema } from "./schemas-
|
|
1
|
+
import { f as pdfQuadBounds, i as EngineError, n as foldText, u as isRotatedGeometryRun } from "./fold-D3_ZiKOg.js";
|
|
2
|
+
import { o as EngineErrorCode } from "./subtype-DsxZbJtP.js";
|
|
3
|
+
import { t as AbortError } from "./AbortError-D0w0N4pJ.js";
|
|
4
|
+
import { A as FormSetValueResultSchema, At as AnnotationDTOSchema, B as PageDeleteResultSchema, G as PageListSnapshotSchema, H as PageFlattenResultSchema, O as FormImportResultSchema, Q as PageRotateResultSchema, U as PageGeometrySnapshotSchema, a as AnnotationCreateResultSchema, c as AnnotationListPageSnapshotSchema, d as AnnotationUpdateResultSchema, k as FormRepairResultSchema, l as AnnotationListSnapshotAllPagesSchema, o as AnnotationDeleteResultSchema, q as PageMoveResultSchema, rt as RedactionApplyResultSchema, tt as PageTextSnapshotSchema, u as AnnotationMoveResultSchema, ur as DocumentActionsSnapshotSchema, ut as SearchSliceSchema, wt as FormSnapshotSchema } from "./schemas-C32v81cE.js";
|
|
5
5
|
//#region src/conformance/runMetadataConformance.ts
|
|
6
6
|
/**
|
|
7
7
|
* The conformance harness is transport-agnostic. It takes the test runner as
|
|
@@ -18,7 +18,7 @@ function runMetadataConformance(runner, opts) {
|
|
|
18
18
|
if (engine) await engine.destroy();
|
|
19
19
|
});
|
|
20
20
|
test("reads metadata from sample fixture", async () => {
|
|
21
|
-
const doc = await openFixture$
|
|
21
|
+
const doc = await openFixture$15(engine, opts);
|
|
22
22
|
try {
|
|
23
23
|
const meta = await doc.metadata.read();
|
|
24
24
|
expect(meta).toMatchObject(opts.fixture.expected);
|
|
@@ -28,7 +28,7 @@ function runMetadataConformance(runner, opts) {
|
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
test("abort() before completion rejects with AbortError", async () => {
|
|
31
|
-
const doc = await openFixture$
|
|
31
|
+
const doc = await openFixture$15(engine, opts);
|
|
32
32
|
try {
|
|
33
33
|
const p = doc.metadata.read();
|
|
34
34
|
p.abort("test");
|
|
@@ -38,7 +38,7 @@ function runMetadataConformance(runner, opts) {
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
test("aborting one read does not affect a concurrent one", async () => {
|
|
41
|
-
const doc = await openFixture$
|
|
41
|
+
const doc = await openFixture$15(engine, opts);
|
|
42
42
|
try {
|
|
43
43
|
const a = doc.metadata.read();
|
|
44
44
|
const b = doc.metadata.read();
|
|
@@ -50,7 +50,7 @@ function runMetadataConformance(runner, opts) {
|
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
test("metadata after close throws DocNotOpen", async () => {
|
|
53
|
-
const doc = await openFixture$
|
|
53
|
+
const doc = await openFixture$15(engine, opts);
|
|
54
54
|
await doc.close();
|
|
55
55
|
let caught;
|
|
56
56
|
try {
|
|
@@ -62,7 +62,7 @@ function runMetadataConformance(runner, opts) {
|
|
|
62
62
|
expect(EngineError.is(caught, EngineErrorCode.DocNotOpen)).toBe(true);
|
|
63
63
|
});
|
|
64
64
|
test("update() sets standard + custom fields and a subsequent read observes them", async () => {
|
|
65
|
-
const doc = await openFixture$
|
|
65
|
+
const doc = await openFixture$15(engine, opts);
|
|
66
66
|
try {
|
|
67
67
|
const result = await doc.metadata.update({
|
|
68
68
|
title: "Conformance Title",
|
|
@@ -81,7 +81,7 @@ function runMetadataConformance(runner, opts) {
|
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
83
|
test("update() clears a field with null", async () => {
|
|
84
|
-
const doc = await openFixture$
|
|
84
|
+
const doc = await openFixture$15(engine, opts);
|
|
85
85
|
try {
|
|
86
86
|
await doc.metadata.update({ title: "To Be Cleared" });
|
|
87
87
|
const set = await doc.metadata.read();
|
|
@@ -94,7 +94,7 @@ function runMetadataConformance(runner, opts) {
|
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
96
|
test("update() after close throws DocNotOpen", async () => {
|
|
97
|
-
const doc = await openFixture$
|
|
97
|
+
const doc = await openFixture$15(engine, opts);
|
|
98
98
|
await doc.close();
|
|
99
99
|
let caught;
|
|
100
100
|
try {
|
|
@@ -107,7 +107,7 @@ function runMetadataConformance(runner, opts) {
|
|
|
107
107
|
});
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
-
async function openFixture$
|
|
110
|
+
async function openFixture$15(engine, opts) {
|
|
111
111
|
if (opts.openKind === "bytes") {
|
|
112
112
|
const bytes = await opts.fixture.bytes();
|
|
113
113
|
return engine.open({
|
|
@@ -134,7 +134,7 @@ function runAnnotationReadConformance(runner, opts) {
|
|
|
134
134
|
if (engine) await engine.destroy();
|
|
135
135
|
});
|
|
136
136
|
test("listRawAll returns one entry per page with valid PageState", async () => {
|
|
137
|
-
const doc = await openFixture$
|
|
137
|
+
const doc = await openFixture$14(engine, opts);
|
|
138
138
|
try {
|
|
139
139
|
const snap = await doc.annotations.listRawAll();
|
|
140
140
|
expect(AnnotationListSnapshotAllPagesSchema.safeParse(snap).success).toBe(true);
|
|
@@ -147,7 +147,7 @@ function runAnnotationReadConformance(runner, opts) {
|
|
|
147
147
|
}
|
|
148
148
|
});
|
|
149
149
|
test("listRaw on the test page returns the expected counts and DTO shape", async () => {
|
|
150
|
-
const doc = await openFixture$
|
|
150
|
+
const doc = await openFixture$14(engine, opts);
|
|
151
151
|
try {
|
|
152
152
|
const snap = await doc.annotations.listRaw(opts.fixture.pageObjectNumber);
|
|
153
153
|
expect(AnnotationListPageSnapshotSchema.safeParse(snap).success).toBe(true);
|
|
@@ -177,7 +177,7 @@ function runAnnotationReadConformance(runner, opts) {
|
|
|
177
177
|
}
|
|
178
178
|
});
|
|
179
179
|
test("shape/vertex/line annotations expose their family fields", async () => {
|
|
180
|
-
const doc = await openFixture$
|
|
180
|
+
const doc = await openFixture$14(engine, opts);
|
|
181
181
|
try {
|
|
182
182
|
const snap = await doc.annotations.listRaw(opts.fixture.pageObjectNumber);
|
|
183
183
|
for (const a of snap.annotations) {
|
|
@@ -236,7 +236,7 @@ function runAnnotationReadConformance(runner, opts) {
|
|
|
236
236
|
}
|
|
237
237
|
});
|
|
238
238
|
test("full page list dispatches per-subtype and matches raw counts", async () => {
|
|
239
|
-
const doc = await openFixture$
|
|
239
|
+
const doc = await openFixture$14(engine, opts);
|
|
240
240
|
try {
|
|
241
241
|
const full = await doc.page(opts.fixture.pageObjectNumber).annotations.list();
|
|
242
242
|
expect(AnnotationListPageSnapshotSchema.safeParse(full).success).toBe(true);
|
|
@@ -246,7 +246,7 @@ function runAnnotationReadConformance(runner, opts) {
|
|
|
246
246
|
}
|
|
247
247
|
});
|
|
248
248
|
test("every annotation DTO satisfies AnnotationDTOSchema (discriminated union)", async () => {
|
|
249
|
-
const doc = await openFixture$
|
|
249
|
+
const doc = await openFixture$14(engine, opts);
|
|
250
250
|
try {
|
|
251
251
|
const snap = await doc.annotations.listRaw(opts.fixture.pageObjectNumber);
|
|
252
252
|
for (const a of snap.annotations) {
|
|
@@ -286,7 +286,7 @@ function runAnnotationReadConformance(runner, opts) {
|
|
|
286
286
|
});
|
|
287
287
|
if (opts.fixture.expectsWeakAnnotation) {
|
|
288
288
|
test("weak annotations carry identityQuality: weak and ref.kind: index", async () => {
|
|
289
|
-
const doc = await openFixture$
|
|
289
|
+
const doc = await openFixture$14(engine, opts);
|
|
290
290
|
try {
|
|
291
291
|
const weak = (await doc.annotations.listRaw(opts.fixture.pageObjectNumber)).annotations.find((a) => a.identityQuality === "weak");
|
|
292
292
|
expect(weak !== void 0).toBe(true);
|
|
@@ -296,7 +296,7 @@ function runAnnotationReadConformance(runner, opts) {
|
|
|
296
296
|
}
|
|
297
297
|
});
|
|
298
298
|
test("a stale revision token throws InvalidReference", async () => {
|
|
299
|
-
const doc = await openFixture$
|
|
299
|
+
const doc = await openFixture$14(engine, opts);
|
|
300
300
|
try {
|
|
301
301
|
const snap = await doc.page(opts.fixture.pageObjectNumber).annotations.list();
|
|
302
302
|
const weak = snap.annotations.find((a) => a.identityQuality === "weak");
|
|
@@ -312,7 +312,7 @@ function runAnnotationReadConformance(runner, opts) {
|
|
|
312
312
|
});
|
|
313
313
|
}
|
|
314
314
|
test("abort() on listRaw rejects with AbortError", async () => {
|
|
315
|
-
const doc = await openFixture$
|
|
315
|
+
const doc = await openFixture$14(engine, opts);
|
|
316
316
|
try {
|
|
317
317
|
const p = doc.annotations.listRaw(opts.fixture.pageObjectNumber);
|
|
318
318
|
p.abort("test");
|
|
@@ -322,7 +322,7 @@ function runAnnotationReadConformance(runner, opts) {
|
|
|
322
322
|
}
|
|
323
323
|
});
|
|
324
324
|
test("listRaw on an unknown pageObjectNumber throws NotFound", async () => {
|
|
325
|
-
const doc = await openFixture$
|
|
325
|
+
const doc = await openFixture$14(engine, opts);
|
|
326
326
|
try {
|
|
327
327
|
let caught;
|
|
328
328
|
try {
|
|
@@ -338,7 +338,7 @@ function runAnnotationReadConformance(runner, opts) {
|
|
|
338
338
|
});
|
|
339
339
|
});
|
|
340
340
|
}
|
|
341
|
-
async function openFixture$
|
|
341
|
+
async function openFixture$14(engine, opts) {
|
|
342
342
|
if (opts.openKind === "bytes") {
|
|
343
343
|
const bytes = await opts.fixture.bytes();
|
|
344
344
|
return engine.open({
|
|
@@ -596,7 +596,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
596
596
|
if (engine) await engine.destroy();
|
|
597
597
|
});
|
|
598
598
|
test("create appends without shifting indices and leaves weak refs valid", async () => {
|
|
599
|
-
const doc = await openFixture$
|
|
599
|
+
const doc = await openFixture$13(engine, opts);
|
|
600
600
|
try {
|
|
601
601
|
const page = doc.page(fix.pageObjectNumber);
|
|
602
602
|
const before = await page.annotations.list();
|
|
@@ -632,7 +632,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
632
632
|
}
|
|
633
633
|
});
|
|
634
634
|
test("create + update honor annotation flags (set on create, merge on patch)", async () => {
|
|
635
|
-
const doc = await openFixture$
|
|
635
|
+
const doc = await openFixture$13(engine, opts);
|
|
636
636
|
try {
|
|
637
637
|
const page = doc.page(fix.pageObjectNumber);
|
|
638
638
|
const draft = {
|
|
@@ -667,7 +667,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
667
667
|
}
|
|
668
668
|
});
|
|
669
669
|
test("create shape annotations (circle + square) round-trip shape fields", async () => {
|
|
670
|
-
const doc = await openFixture$
|
|
670
|
+
const doc = await openFixture$13(engine, opts);
|
|
671
671
|
try {
|
|
672
672
|
const page = doc.page(fix.pageObjectNumber);
|
|
673
673
|
const circleDraft = {
|
|
@@ -748,7 +748,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
748
748
|
}
|
|
749
749
|
});
|
|
750
750
|
test("cloudy border (/BE) + rect differences (/RD) are tri-state", async () => {
|
|
751
|
-
const doc = await openFixture$
|
|
751
|
+
const doc = await openFixture$13(engine, opts);
|
|
752
752
|
try {
|
|
753
753
|
const page = doc.page(fix.pageObjectNumber);
|
|
754
754
|
const plainDraft = {
|
|
@@ -827,7 +827,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
827
827
|
}
|
|
828
828
|
});
|
|
829
829
|
test("update echoes the appearance verdict: moves preserve /AP, restyles re-bake", async () => {
|
|
830
|
-
const doc = await openFixture$
|
|
830
|
+
const doc = await openFixture$13(engine, opts);
|
|
831
831
|
try {
|
|
832
832
|
const page = doc.page(fix.pageObjectNumber);
|
|
833
833
|
const draft = {
|
|
@@ -902,7 +902,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
902
902
|
}
|
|
903
903
|
});
|
|
904
904
|
test("a partial /DA patch preserves the unpatched font members", async () => {
|
|
905
|
-
const doc = await openFixture$
|
|
905
|
+
const doc = await openFixture$13(engine, opts);
|
|
906
906
|
try {
|
|
907
907
|
const page = doc.page(fix.pageObjectNumber);
|
|
908
908
|
const draft = {
|
|
@@ -958,7 +958,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
958
958
|
}
|
|
959
959
|
});
|
|
960
960
|
test("box transform is tri-state: rect-only moves keep rotation, null flattens", async () => {
|
|
961
|
-
const doc = await openFixture$
|
|
961
|
+
const doc = await openFixture$13(engine, opts);
|
|
962
962
|
try {
|
|
963
963
|
const page = doc.page(fix.pageObjectNumber);
|
|
964
964
|
const draft = {
|
|
@@ -1019,7 +1019,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1019
1019
|
}
|
|
1020
1020
|
});
|
|
1021
1021
|
test("create vertex + line annotations (polygon/polyline/line) round-trip geometry", async () => {
|
|
1022
|
-
const doc = await openFixture$
|
|
1022
|
+
const doc = await openFixture$13(engine, opts);
|
|
1023
1023
|
try {
|
|
1024
1024
|
const page = doc.page(fix.pageObjectNumber);
|
|
1025
1025
|
const polygonDraft = {
|
|
@@ -1150,7 +1150,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1150
1150
|
}
|
|
1151
1151
|
});
|
|
1152
1152
|
test("create free-text + callout round-trip text/colour/intent fields", async () => {
|
|
1153
|
-
const doc = await openFixture$
|
|
1153
|
+
const doc = await openFixture$13(engine, opts);
|
|
1154
1154
|
try {
|
|
1155
1155
|
const page = doc.page(fix.pageObjectNumber);
|
|
1156
1156
|
const freeTextDraft = {
|
|
@@ -1246,7 +1246,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1246
1246
|
}
|
|
1247
1247
|
});
|
|
1248
1248
|
test("update a free-text patches alignment + colours and is non-structural", async () => {
|
|
1249
|
-
const doc = await openFixture$
|
|
1249
|
+
const doc = await openFixture$13(engine, opts);
|
|
1250
1250
|
try {
|
|
1251
1251
|
const page = doc.page(fix.pageObjectNumber);
|
|
1252
1252
|
const created = await page.annotations.create({
|
|
@@ -1307,7 +1307,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1307
1307
|
}
|
|
1308
1308
|
});
|
|
1309
1309
|
test("create redact (area + text) round-trips label + colour fields", async () => {
|
|
1310
|
-
const doc = await openFixture$
|
|
1310
|
+
const doc = await openFixture$13(engine, opts);
|
|
1311
1311
|
try {
|
|
1312
1312
|
const page = doc.page(fix.pageObjectNumber);
|
|
1313
1313
|
const areaDraft = {
|
|
@@ -1387,7 +1387,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1387
1387
|
}
|
|
1388
1388
|
});
|
|
1389
1389
|
test("update a redact patches the label and clears it, non-structurally", async () => {
|
|
1390
|
-
const doc = await openFixture$
|
|
1390
|
+
const doc = await openFixture$13(engine, opts);
|
|
1391
1391
|
try {
|
|
1392
1392
|
const page = doc.page(fix.pageObjectNumber);
|
|
1393
1393
|
const created = await page.annotations.create({
|
|
@@ -1464,7 +1464,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1464
1464
|
}
|
|
1465
1465
|
});
|
|
1466
1466
|
test("create + update a caret round-trips color/opacity/rect differences", async () => {
|
|
1467
|
-
const doc = await openFixture$
|
|
1467
|
+
const doc = await openFixture$13(engine, opts);
|
|
1468
1468
|
try {
|
|
1469
1469
|
const page = doc.page(fix.pageObjectNumber);
|
|
1470
1470
|
const caretDraft = {
|
|
@@ -1544,7 +1544,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1544
1544
|
}
|
|
1545
1545
|
});
|
|
1546
1546
|
test("update an ink annotation patches strokes + color and is non-structural", async () => {
|
|
1547
|
-
const doc = await openFixture$
|
|
1547
|
+
const doc = await openFixture$13(engine, opts);
|
|
1548
1548
|
try {
|
|
1549
1549
|
const page = doc.page(fix.pageObjectNumber);
|
|
1550
1550
|
const created = await page.annotations.create({
|
|
@@ -1595,7 +1595,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1595
1595
|
}
|
|
1596
1596
|
});
|
|
1597
1597
|
test("ink highlight intent + blend round-trip and unrelated patches preserve blend", async () => {
|
|
1598
|
-
const doc = await openFixture$
|
|
1598
|
+
const doc = await openFixture$13(engine, opts);
|
|
1599
1599
|
try {
|
|
1600
1600
|
const page = doc.page(fix.pageObjectNumber);
|
|
1601
1601
|
const created = await page.annotations.create({
|
|
@@ -1638,7 +1638,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1638
1638
|
}
|
|
1639
1639
|
});
|
|
1640
1640
|
test("update a polyline patches vertices + line endings and is non-structural", async () => {
|
|
1641
|
-
const doc = await openFixture$
|
|
1641
|
+
const doc = await openFixture$13(engine, opts);
|
|
1642
1642
|
try {
|
|
1643
1643
|
const page = doc.page(fix.pageObjectNumber);
|
|
1644
1644
|
const created = await page.annotations.create({
|
|
@@ -1687,7 +1687,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1687
1687
|
}
|
|
1688
1688
|
});
|
|
1689
1689
|
test("update a shape annotation patches color and is non-structural", async () => {
|
|
1690
|
-
const doc = await openFixture$
|
|
1690
|
+
const doc = await openFixture$13(engine, opts);
|
|
1691
1691
|
try {
|
|
1692
1692
|
const page = doc.page(fix.pageObjectNumber);
|
|
1693
1693
|
const created = await page.annotations.create({
|
|
@@ -1736,7 +1736,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1736
1736
|
}
|
|
1737
1737
|
});
|
|
1738
1738
|
if (opts.supportsAppearanceRasters) test("creating a shape bakes an /AP appearance the reader can rasterize", async () => {
|
|
1739
|
-
const doc = await openFixture$
|
|
1739
|
+
const doc = await openFixture$13(engine, opts);
|
|
1740
1740
|
try {
|
|
1741
1741
|
const page = doc.page(fix.pageObjectNumber);
|
|
1742
1742
|
const created = await page.annotations.create({
|
|
@@ -1766,7 +1766,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1766
1766
|
}
|
|
1767
1767
|
});
|
|
1768
1768
|
test("update on a durable annotation is non-structural and never touches /NM", async () => {
|
|
1769
|
-
const doc = await openFixture$
|
|
1769
|
+
const doc = await openFixture$13(engine, opts);
|
|
1770
1770
|
try {
|
|
1771
1771
|
const page = doc.page(fix.pageObjectNumber);
|
|
1772
1772
|
const before = await page.annotations.list();
|
|
@@ -1792,7 +1792,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1792
1792
|
}
|
|
1793
1793
|
});
|
|
1794
1794
|
if (fix.expectsWeakAnnotation) test("update on a weak annotation stamps a UUID v4 /NM and upgrades the ref", async () => {
|
|
1795
|
-
const doc = await openFixture$
|
|
1795
|
+
const doc = await openFixture$13(engine, opts);
|
|
1796
1796
|
try {
|
|
1797
1797
|
const page = doc.page(fix.pageObjectNumber);
|
|
1798
1798
|
const before = await page.annotations.list();
|
|
@@ -1822,7 +1822,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1822
1822
|
}
|
|
1823
1823
|
});
|
|
1824
1824
|
test("delete by objectNumber removes the annotation and reports a stable id", async () => {
|
|
1825
|
-
const doc = await openFixture$
|
|
1825
|
+
const doc = await openFixture$13(engine, opts);
|
|
1826
1826
|
try {
|
|
1827
1827
|
const page = doc.page(fix.pageObjectNumber);
|
|
1828
1828
|
const draft = {
|
|
@@ -1852,7 +1852,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1852
1852
|
}
|
|
1853
1853
|
});
|
|
1854
1854
|
if (fix.expectsWeakAnnotation) test("delete by index of a weak annotation reports deleted: null and refetch reason", async () => {
|
|
1855
|
-
const doc = await openFixture$
|
|
1855
|
+
const doc = await openFixture$13(engine, opts);
|
|
1856
1856
|
try {
|
|
1857
1857
|
const page = doc.page(fix.pageObjectNumber);
|
|
1858
1858
|
const weak = (await page.annotations.list()).annotations.find((a) => a.identityQuality === "weak");
|
|
@@ -1875,7 +1875,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1875
1875
|
}
|
|
1876
1876
|
});
|
|
1877
1877
|
test("abort on create rejects with AbortError", async () => {
|
|
1878
|
-
const doc = await openFixture$
|
|
1878
|
+
const doc = await openFixture$13(engine, opts);
|
|
1879
1879
|
try {
|
|
1880
1880
|
const page = doc.page(fix.pageObjectNumber);
|
|
1881
1881
|
const draft = {
|
|
@@ -1891,7 +1891,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1891
1891
|
}
|
|
1892
1892
|
});
|
|
1893
1893
|
test("update with a stale index revision throws InvalidReference", async () => {
|
|
1894
|
-
const doc = await openFixture$
|
|
1894
|
+
const doc = await openFixture$13(engine, opts);
|
|
1895
1895
|
try {
|
|
1896
1896
|
const page = doc.page(fix.pageObjectNumber);
|
|
1897
1897
|
const weak = (await page.annotations.list()).annotations.find((a) => a.identityQuality === "weak");
|
|
@@ -1918,7 +1918,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1918
1918
|
}
|
|
1919
1919
|
});
|
|
1920
1920
|
test("move single durable annotation reorders within the page (single-as-batch)", async () => {
|
|
1921
|
-
const doc = await openFixture$
|
|
1921
|
+
const doc = await openFixture$13(engine, opts);
|
|
1922
1922
|
try {
|
|
1923
1923
|
const page = doc.page(fix.pageObjectNumber);
|
|
1924
1924
|
const aDraft = {
|
|
@@ -1962,7 +1962,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1962
1962
|
}
|
|
1963
1963
|
});
|
|
1964
1964
|
test("move multi-block preserves caller-supplied order at the destination", async () => {
|
|
1965
|
-
const doc = await openFixture$
|
|
1965
|
+
const doc = await openFixture$13(engine, opts);
|
|
1966
1966
|
try {
|
|
1967
1967
|
const page = doc.page(fix.pageObjectNumber);
|
|
1968
1968
|
const ids = await Promise.all([
|
|
@@ -2001,7 +2001,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2001
2001
|
}
|
|
2002
2002
|
});
|
|
2003
2003
|
if (fix.expectsWeakAnnotation) test("move on a weak annotation upgrades it to durable /NM (one rev bump for batch)", async () => {
|
|
2004
|
-
const doc = await openFixture$
|
|
2004
|
+
const doc = await openFixture$13(engine, opts);
|
|
2005
2005
|
try {
|
|
2006
2006
|
const page = doc.page(fix.pageObjectNumber);
|
|
2007
2007
|
const before = await page.annotations.list();
|
|
@@ -2026,7 +2026,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2026
2026
|
}
|
|
2027
2027
|
});
|
|
2028
2028
|
test("move with a stale index revision rejects (locked rev-token guard)", async () => {
|
|
2029
|
-
const doc = await openFixture$
|
|
2029
|
+
const doc = await openFixture$13(engine, opts);
|
|
2030
2030
|
try {
|
|
2031
2031
|
const page = doc.page(fix.pageObjectNumber);
|
|
2032
2032
|
const a = await page.annotations.create({
|
|
@@ -2064,7 +2064,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2064
2064
|
}
|
|
2065
2065
|
});
|
|
2066
2066
|
test("move with out-of-range toIndex rejects with InvalidArg", async () => {
|
|
2067
|
-
const doc = await openFixture$
|
|
2067
|
+
const doc = await openFixture$13(engine, opts);
|
|
2068
2068
|
try {
|
|
2069
2069
|
const page = doc.page(fix.pageObjectNumber);
|
|
2070
2070
|
const a = await page.annotations.create({
|
|
@@ -2088,7 +2088,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2088
2088
|
}
|
|
2089
2089
|
});
|
|
2090
2090
|
test("move with duplicate refs rejects with InvalidArg", async () => {
|
|
2091
|
-
const doc = await openFixture$
|
|
2091
|
+
const doc = await openFixture$13(engine, opts);
|
|
2092
2092
|
try {
|
|
2093
2093
|
const page = doc.page(fix.pageObjectNumber);
|
|
2094
2094
|
const a = await page.annotations.create({
|
|
@@ -2111,7 +2111,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2111
2111
|
}
|
|
2112
2112
|
});
|
|
2113
2113
|
test("abort on move rejects with AbortError", async () => {
|
|
2114
|
-
const doc = await openFixture$
|
|
2114
|
+
const doc = await openFixture$13(engine, opts);
|
|
2115
2115
|
try {
|
|
2116
2116
|
const page = doc.page(fix.pageObjectNumber);
|
|
2117
2117
|
const a = await page.annotations.create({
|
|
@@ -2132,7 +2132,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2132
2132
|
}
|
|
2133
2133
|
});
|
|
2134
2134
|
test("a page move does NOT bump per-page RevisionTokens (weak refs survive reorder)", async () => {
|
|
2135
|
-
const doc = await openFixture$
|
|
2135
|
+
const doc = await openFixture$13(engine, opts);
|
|
2136
2136
|
try {
|
|
2137
2137
|
const list = await doc.pages.list();
|
|
2138
2138
|
if (list.pages.length < 1) return;
|
|
@@ -2147,7 +2147,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2147
2147
|
}
|
|
2148
2148
|
});
|
|
2149
2149
|
test("create a reply links /IRT and defaults /RT to \"reply\", reporting the parent", async () => {
|
|
2150
|
-
const doc = await openFixture$
|
|
2150
|
+
const doc = await openFixture$13(engine, opts);
|
|
2151
2151
|
try {
|
|
2152
2152
|
const page = doc.page(fix.pageObjectNumber);
|
|
2153
2153
|
const parent = await page.annotations.create({
|
|
@@ -2181,7 +2181,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2181
2181
|
}
|
|
2182
2182
|
});
|
|
2183
2183
|
test("create a grouped subordinate writes /RT /Group", async () => {
|
|
2184
|
-
const doc = await openFixture$
|
|
2184
|
+
const doc = await openFixture$13(engine, opts);
|
|
2185
2185
|
try {
|
|
2186
2186
|
const page = doc.page(fix.pageObjectNumber);
|
|
2187
2187
|
const primary = await page.annotations.create({
|
|
@@ -2212,7 +2212,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2212
2212
|
}
|
|
2213
2213
|
});
|
|
2214
2214
|
test("create link annotations round-trip uri, goto/xyz, goto/fitH, and dead targets", async () => {
|
|
2215
|
-
const doc = await openFixture$
|
|
2215
|
+
const doc = await openFixture$13(engine, opts);
|
|
2216
2216
|
try {
|
|
2217
2217
|
const page = doc.page(fix.pageObjectNumber);
|
|
2218
2218
|
const uri = await page.annotations.create({
|
|
@@ -2289,7 +2289,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2289
2289
|
}
|
|
2290
2290
|
});
|
|
2291
2291
|
test("a link patch retargets in both directions (uri→goto, goto→uri) and moves the rect", async () => {
|
|
2292
|
-
const doc = await openFixture$
|
|
2292
|
+
const doc = await openFixture$13(engine, opts);
|
|
2293
2293
|
try {
|
|
2294
2294
|
const page = doc.page(fix.pageObjectNumber);
|
|
2295
2295
|
const created = await page.annotations.create({
|
|
@@ -2344,7 +2344,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2344
2344
|
}
|
|
2345
2345
|
});
|
|
2346
2346
|
test("a link patch clears the target with null — a dead link on re-read", async () => {
|
|
2347
|
-
const doc = await openFixture$
|
|
2347
|
+
const doc = await openFixture$13(engine, opts);
|
|
2348
2348
|
try {
|
|
2349
2349
|
const page = doc.page(fix.pageObjectNumber);
|
|
2350
2350
|
const created = await page.annotations.create({
|
|
@@ -2383,7 +2383,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2383
2383
|
}
|
|
2384
2384
|
});
|
|
2385
2385
|
test("a link grouped to a highlight round-trips /IRT + /RT /Group with its target", async () => {
|
|
2386
|
-
const doc = await openFixture$
|
|
2386
|
+
const doc = await openFixture$13(engine, opts);
|
|
2387
2387
|
try {
|
|
2388
2388
|
const page = doc.page(fix.pageObjectNumber);
|
|
2389
2389
|
const parent = await page.annotations.create({
|
|
@@ -2417,7 +2417,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2417
2417
|
}
|
|
2418
2418
|
});
|
|
2419
2419
|
test("replace-text round-trips /IT and groups StrikeOut under its Caret", async () => {
|
|
2420
|
-
const doc = await openFixture$
|
|
2420
|
+
const doc = await openFixture$13(engine, opts);
|
|
2421
2421
|
try {
|
|
2422
2422
|
const page = doc.page(fix.pageObjectNumber);
|
|
2423
2423
|
const caret = await page.annotations.create({
|
|
@@ -2469,7 +2469,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2469
2469
|
}
|
|
2470
2470
|
});
|
|
2471
2471
|
test("patch inReplyTo: null clears /IRT and /RT (back to top-level)", async () => {
|
|
2472
|
-
const doc = await openFixture$
|
|
2472
|
+
const doc = await openFixture$13(engine, opts);
|
|
2473
2473
|
try {
|
|
2474
2474
|
const page = doc.page(fix.pageObjectNumber);
|
|
2475
2475
|
const parent = await page.annotations.create({
|
|
@@ -2496,7 +2496,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2496
2496
|
}
|
|
2497
2497
|
});
|
|
2498
2498
|
test("create with a cross-page /IRT parent throws InvalidArg", async () => {
|
|
2499
|
-
const doc = await openFixture$
|
|
2499
|
+
const doc = await openFixture$13(engine, opts);
|
|
2500
2500
|
try {
|
|
2501
2501
|
const page = doc.page(fix.pageObjectNumber);
|
|
2502
2502
|
const parent = await page.annotations.create({
|
|
@@ -2532,7 +2532,7 @@ async function beginWeakEditIfRequired(doc, pageObjectNumber, fix) {
|
|
|
2532
2532
|
if (doc.capabilities.weakAnnotationEditSessions !== "required" || !fix.expectsWeakAnnotation) return null;
|
|
2533
2533
|
return doc.annotations.beginWeakEdit([pageObjectNumber]);
|
|
2534
2534
|
}
|
|
2535
|
-
async function openFixture$
|
|
2535
|
+
async function openFixture$13(engine, opts) {
|
|
2536
2536
|
if (opts.openKind === "bytes") {
|
|
2537
2537
|
const bytes = await opts.fixture.bytes();
|
|
2538
2538
|
return engine.open({
|
|
@@ -3122,7 +3122,7 @@ function runAnnotationAppearanceConformance(runner, opts) {
|
|
|
3122
3122
|
if (engine) await engine.destroy();
|
|
3123
3123
|
});
|
|
3124
3124
|
test("renders the expected set of appearances with valid output", async () => {
|
|
3125
|
-
const doc = await openFixture$
|
|
3125
|
+
const doc = await openFixture$12(engine, opts);
|
|
3126
3126
|
try {
|
|
3127
3127
|
const { pageState, appearances } = await collect(doc, opts, useRaw);
|
|
3128
3128
|
expect(pageState.pageObjectNumber).toBe(opts.fixture.pageObjectNumber);
|
|
@@ -3149,7 +3149,7 @@ function runAnnotationAppearanceConformance(runner, opts) {
|
|
|
3149
3149
|
}
|
|
3150
3150
|
});
|
|
3151
3151
|
if (opts.fixture.expectsWeakAppearance) test("weak (index-only) annotations are emitted, not dropped", async () => {
|
|
3152
|
-
const doc = await openFixture$
|
|
3152
|
+
const doc = await openFixture$12(engine, opts);
|
|
3153
3153
|
try {
|
|
3154
3154
|
const { appearances } = await collect(doc, opts, useRaw);
|
|
3155
3155
|
const weak = appearances.find((a) => a.ref.kind === "index");
|
|
@@ -3159,7 +3159,7 @@ function runAnnotationAppearanceConformance(runner, opts) {
|
|
|
3159
3159
|
}
|
|
3160
3160
|
});
|
|
3161
3161
|
if (useRaw) test("rendered appearances are not blank (non-zero alpha)", async () => {
|
|
3162
|
-
const doc = await openFixture$
|
|
3162
|
+
const doc = await openFixture$12(engine, opts);
|
|
3163
3163
|
try {
|
|
3164
3164
|
const { appearances } = await collect(doc, opts, useRaw);
|
|
3165
3165
|
const anyVisible = appearances.some((a) => a.raster !== null && hasOpaquePixel(a.raster));
|
|
@@ -3169,7 +3169,7 @@ function runAnnotationAppearanceConformance(runner, opts) {
|
|
|
3169
3169
|
}
|
|
3170
3170
|
});
|
|
3171
3171
|
test("abort() rejects with AbortError", async () => {
|
|
3172
|
-
const doc = await openFixture$
|
|
3172
|
+
const doc = await openFixture$12(engine, opts);
|
|
3173
3173
|
try {
|
|
3174
3174
|
const page = doc.page(opts.fixture.pageObjectNumber);
|
|
3175
3175
|
const p = useRaw ? page.annotations.renderAppearances({ scale: 1 }) : page.annotations.renderAppearanceImages({
|
|
@@ -3224,7 +3224,7 @@ function hasOpaquePixel(raster) {
|
|
|
3224
3224
|
}
|
|
3225
3225
|
return false;
|
|
3226
3226
|
}
|
|
3227
|
-
async function openFixture$
|
|
3227
|
+
async function openFixture$12(engine, opts) {
|
|
3228
3228
|
if (opts.openKind === "bytes") {
|
|
3229
3229
|
const bytes = await opts.fixture.bytes();
|
|
3230
3230
|
return engine.open({
|
|
@@ -3293,7 +3293,7 @@ function runPageReorderConformance(runner, opts) {
|
|
|
3293
3293
|
if (engine) await engine.destroy();
|
|
3294
3294
|
});
|
|
3295
3295
|
test("pages.list() returns every page in display order, durable PONs only", async () => {
|
|
3296
|
-
const doc = await openFixture$
|
|
3296
|
+
const doc = await openFixture$11(engine, opts);
|
|
3297
3297
|
try {
|
|
3298
3298
|
const list = await doc.pages.list();
|
|
3299
3299
|
expect(PageListSnapshotSchema.safeParse(list).success).toBe(true);
|
|
@@ -3312,7 +3312,7 @@ function runPageReorderConformance(runner, opts) {
|
|
|
3312
3312
|
}
|
|
3313
3313
|
});
|
|
3314
3314
|
test("pages.move() reorders pages and returns the full post-move order", async () => {
|
|
3315
|
-
const doc = await openFixture$
|
|
3315
|
+
const doc = await openFixture$11(engine, opts);
|
|
3316
3316
|
try {
|
|
3317
3317
|
const before = await doc.pages.list();
|
|
3318
3318
|
if (before.pages.length < 3) return;
|
|
@@ -3336,7 +3336,7 @@ function runPageReorderConformance(runner, opts) {
|
|
|
3336
3336
|
}
|
|
3337
3337
|
});
|
|
3338
3338
|
test("weak index-based annotation refs survive a page reorder", async () => {
|
|
3339
|
-
const doc = await openFixture$
|
|
3339
|
+
const doc = await openFixture$11(engine, opts);
|
|
3340
3340
|
try {
|
|
3341
3341
|
const list = await doc.pages.list();
|
|
3342
3342
|
if (list.pages.length < 2) return;
|
|
@@ -3373,7 +3373,7 @@ function runPageReorderConformance(runner, opts) {
|
|
|
3373
3373
|
}
|
|
3374
3374
|
});
|
|
3375
3375
|
test("pages.move() rejects duplicate PONs with InvalidArg", async () => {
|
|
3376
|
-
const doc = await openFixture$
|
|
3376
|
+
const doc = await openFixture$11(engine, opts);
|
|
3377
3377
|
try {
|
|
3378
3378
|
const list = await doc.pages.list();
|
|
3379
3379
|
if (list.pages.length < 1) return;
|
|
@@ -3390,7 +3390,7 @@ function runPageReorderConformance(runner, opts) {
|
|
|
3390
3390
|
}
|
|
3391
3391
|
});
|
|
3392
3392
|
test("pages.move() rejects out-of-range destIndex with InvalidArg", async () => {
|
|
3393
|
-
const doc = await openFixture$
|
|
3393
|
+
const doc = await openFixture$11(engine, opts);
|
|
3394
3394
|
try {
|
|
3395
3395
|
const list = await doc.pages.list();
|
|
3396
3396
|
if (list.pages.length < 1) return;
|
|
@@ -3407,7 +3407,7 @@ function runPageReorderConformance(runner, opts) {
|
|
|
3407
3407
|
}
|
|
3408
3408
|
});
|
|
3409
3409
|
test("pages.move() rejects unknown PON with NotFound or InvalidArg", async () => {
|
|
3410
|
-
const doc = await openFixture$
|
|
3410
|
+
const doc = await openFixture$11(engine, opts);
|
|
3411
3411
|
try {
|
|
3412
3412
|
const list = await doc.pages.list();
|
|
3413
3413
|
let bogus = 0;
|
|
@@ -3425,7 +3425,7 @@ function runPageReorderConformance(runner, opts) {
|
|
|
3425
3425
|
}
|
|
3426
3426
|
});
|
|
3427
3427
|
test("abort on pages.move() rejects with AbortError", async () => {
|
|
3428
|
-
const doc = await openFixture$
|
|
3428
|
+
const doc = await openFixture$11(engine, opts);
|
|
3429
3429
|
try {
|
|
3430
3430
|
const list = await doc.pages.list();
|
|
3431
3431
|
if (list.pages.length < 1) return;
|
|
@@ -3439,7 +3439,7 @@ function runPageReorderConformance(runner, opts) {
|
|
|
3439
3439
|
});
|
|
3440
3440
|
});
|
|
3441
3441
|
}
|
|
3442
|
-
async function openFixture$
|
|
3442
|
+
async function openFixture$11(engine, opts) {
|
|
3443
3443
|
if (opts.openKind === "bytes") {
|
|
3444
3444
|
const bytes = await opts.fixture.bytes();
|
|
3445
3445
|
return engine.open({
|
|
@@ -3513,7 +3513,7 @@ function runPageRotateConformance(runner, opts) {
|
|
|
3513
3513
|
if (engine) await engine.destroy();
|
|
3514
3514
|
});
|
|
3515
3515
|
test("pages.rotate() sets the absolute rotation and returns the full layout", async () => {
|
|
3516
|
-
const doc = await openFixture$
|
|
3516
|
+
const doc = await openFixture$10(engine, opts);
|
|
3517
3517
|
try {
|
|
3518
3518
|
const before = await doc.pages.list();
|
|
3519
3519
|
const target = before.pages[0];
|
|
@@ -3532,7 +3532,7 @@ function runPageRotateConformance(runner, opts) {
|
|
|
3532
3532
|
}
|
|
3533
3533
|
});
|
|
3534
3534
|
test("absolute rotation is idempotent: setting the same value twice is a no-op", async () => {
|
|
3535
|
-
const doc = await openFixture$
|
|
3535
|
+
const doc = await openFixture$10(engine, opts);
|
|
3536
3536
|
try {
|
|
3537
3537
|
const pon = (await doc.pages.list()).pages[0].pageObjectNumber;
|
|
3538
3538
|
const first = await doc.pages.rotate([pon], 180);
|
|
@@ -3543,7 +3543,7 @@ function runPageRotateConformance(runner, opts) {
|
|
|
3543
3543
|
}
|
|
3544
3544
|
});
|
|
3545
3545
|
test("one rotation applies to EVERY listed page (the multi-select gesture)", async () => {
|
|
3546
|
-
const doc = await openFixture$
|
|
3546
|
+
const doc = await openFixture$10(engine, opts);
|
|
3547
3547
|
try {
|
|
3548
3548
|
const list = await doc.pages.list();
|
|
3549
3549
|
if (list.pages.length < 2) return;
|
|
@@ -3555,7 +3555,7 @@ function runPageRotateConformance(runner, opts) {
|
|
|
3555
3555
|
}
|
|
3556
3556
|
});
|
|
3557
3557
|
test("weak index-based annotation refs survive a rotate (no revision bump)", async () => {
|
|
3558
|
-
const doc = await openFixture$
|
|
3558
|
+
const doc = await openFixture$10(engine, opts);
|
|
3559
3559
|
try {
|
|
3560
3560
|
const hostPon = (await doc.pages.list()).pages[0].pageObjectNumber;
|
|
3561
3561
|
const hostPage = doc.page(hostPon);
|
|
@@ -3585,7 +3585,7 @@ function runPageRotateConformance(runner, opts) {
|
|
|
3585
3585
|
}
|
|
3586
3586
|
});
|
|
3587
3587
|
test("pages.rotate() rejects an invalid rotation value with InvalidArg", async () => {
|
|
3588
|
-
const doc = await openFixture$
|
|
3588
|
+
const doc = await openFixture$10(engine, opts);
|
|
3589
3589
|
try {
|
|
3590
3590
|
const pon = (await doc.pages.list()).pages[0].pageObjectNumber;
|
|
3591
3591
|
let caught;
|
|
@@ -3600,7 +3600,7 @@ function runPageRotateConformance(runner, opts) {
|
|
|
3600
3600
|
}
|
|
3601
3601
|
});
|
|
3602
3602
|
test("pages.rotate() rejects duplicate PONs with InvalidArg", async () => {
|
|
3603
|
-
const doc = await openFixture$
|
|
3603
|
+
const doc = await openFixture$10(engine, opts);
|
|
3604
3604
|
try {
|
|
3605
3605
|
const pon = (await doc.pages.list()).pages[0].pageObjectNumber;
|
|
3606
3606
|
let caught;
|
|
@@ -3615,7 +3615,7 @@ function runPageRotateConformance(runner, opts) {
|
|
|
3615
3615
|
}
|
|
3616
3616
|
});
|
|
3617
3617
|
test("pages.rotate() rejects unknown PON with NotFound or InvalidArg", async () => {
|
|
3618
|
-
const doc = await openFixture$
|
|
3618
|
+
const doc = await openFixture$10(engine, opts);
|
|
3619
3619
|
try {
|
|
3620
3620
|
const list = await doc.pages.list();
|
|
3621
3621
|
let bogus = 0;
|
|
@@ -3633,7 +3633,7 @@ function runPageRotateConformance(runner, opts) {
|
|
|
3633
3633
|
}
|
|
3634
3634
|
});
|
|
3635
3635
|
test("abort on pages.rotate() rejects with AbortError", async () => {
|
|
3636
|
-
const doc = await openFixture$
|
|
3636
|
+
const doc = await openFixture$10(engine, opts);
|
|
3637
3637
|
try {
|
|
3638
3638
|
const pon = (await doc.pages.list()).pages[0].pageObjectNumber;
|
|
3639
3639
|
const p = doc.pages.rotate([pon], 90);
|
|
@@ -3645,7 +3645,7 @@ function runPageRotateConformance(runner, opts) {
|
|
|
3645
3645
|
});
|
|
3646
3646
|
});
|
|
3647
3647
|
}
|
|
3648
|
-
async function openFixture$
|
|
3648
|
+
async function openFixture$10(engine, opts) {
|
|
3649
3649
|
if (opts.openKind === "bytes") {
|
|
3650
3650
|
const bytes = await opts.fixture.bytes();
|
|
3651
3651
|
return engine.open({
|
|
@@ -3708,7 +3708,7 @@ function runPageDeleteConformance(runner, opts) {
|
|
|
3708
3708
|
if (engine) await engine.destroy();
|
|
3709
3709
|
});
|
|
3710
3710
|
test("pages.delete() removes the page and returns the surviving layout", async () => {
|
|
3711
|
-
const doc = await openFixture$
|
|
3711
|
+
const doc = await openFixture$9(engine, opts);
|
|
3712
3712
|
try {
|
|
3713
3713
|
const before = await doc.pages.list();
|
|
3714
3714
|
if (before.pages.length < 2) return;
|
|
@@ -3729,7 +3729,7 @@ function runPageDeleteConformance(runner, opts) {
|
|
|
3729
3729
|
}
|
|
3730
3730
|
});
|
|
3731
3731
|
test("addressing a deleted page afterwards is a clean NotFound", async () => {
|
|
3732
|
-
const doc = await openFixture$
|
|
3732
|
+
const doc = await openFixture$9(engine, opts);
|
|
3733
3733
|
try {
|
|
3734
3734
|
const before = await doc.pages.list();
|
|
3735
3735
|
if (before.pages.length < 2) return;
|
|
@@ -3747,7 +3747,7 @@ function runPageDeleteConformance(runner, opts) {
|
|
|
3747
3747
|
}
|
|
3748
3748
|
});
|
|
3749
3749
|
test("surviving pages keep their weak index-based annotation refs", async () => {
|
|
3750
|
-
const doc = await openFixture$
|
|
3750
|
+
const doc = await openFixture$9(engine, opts);
|
|
3751
3751
|
try {
|
|
3752
3752
|
const list = await doc.pages.list();
|
|
3753
3753
|
if (list.pages.length < 2) return;
|
|
@@ -3780,7 +3780,7 @@ function runPageDeleteConformance(runner, opts) {
|
|
|
3780
3780
|
}
|
|
3781
3781
|
});
|
|
3782
3782
|
test("deleting EVERY page is rejected with InvalidArg", async () => {
|
|
3783
|
-
const doc = await openFixture$
|
|
3783
|
+
const doc = await openFixture$9(engine, opts);
|
|
3784
3784
|
try {
|
|
3785
3785
|
const list = await doc.pages.list();
|
|
3786
3786
|
let caught;
|
|
@@ -3795,7 +3795,7 @@ function runPageDeleteConformance(runner, opts) {
|
|
|
3795
3795
|
}
|
|
3796
3796
|
});
|
|
3797
3797
|
test("pages.delete() rejects duplicate PONs with InvalidArg", async () => {
|
|
3798
|
-
const doc = await openFixture$
|
|
3798
|
+
const doc = await openFixture$9(engine, opts);
|
|
3799
3799
|
try {
|
|
3800
3800
|
const pon = (await doc.pages.list()).pages[0].pageObjectNumber;
|
|
3801
3801
|
let caught;
|
|
@@ -3810,7 +3810,7 @@ function runPageDeleteConformance(runner, opts) {
|
|
|
3810
3810
|
}
|
|
3811
3811
|
});
|
|
3812
3812
|
test("pages.delete() rejects unknown PON with NotFound or InvalidArg", async () => {
|
|
3813
|
-
const doc = await openFixture$
|
|
3813
|
+
const doc = await openFixture$9(engine, opts);
|
|
3814
3814
|
try {
|
|
3815
3815
|
const list = await doc.pages.list();
|
|
3816
3816
|
let bogus = 0;
|
|
@@ -3828,7 +3828,7 @@ function runPageDeleteConformance(runner, opts) {
|
|
|
3828
3828
|
}
|
|
3829
3829
|
});
|
|
3830
3830
|
test("abort on pages.delete() rejects with AbortError", async () => {
|
|
3831
|
-
const doc = await openFixture$
|
|
3831
|
+
const doc = await openFixture$9(engine, opts);
|
|
3832
3832
|
try {
|
|
3833
3833
|
const list = await doc.pages.list();
|
|
3834
3834
|
if (list.pages.length < 2) return;
|
|
@@ -3842,7 +3842,7 @@ function runPageDeleteConformance(runner, opts) {
|
|
|
3842
3842
|
});
|
|
3843
3843
|
});
|
|
3844
3844
|
}
|
|
3845
|
-
async function openFixture$
|
|
3845
|
+
async function openFixture$9(engine, opts) {
|
|
3846
3846
|
if (opts.openKind === "bytes") {
|
|
3847
3847
|
const bytes = await opts.fixture.bytes();
|
|
3848
3848
|
return engine.open({
|
|
@@ -3870,7 +3870,7 @@ function runPageFlattenConformance(runner, opts) {
|
|
|
3870
3870
|
if (engine) await engine.destroy();
|
|
3871
3871
|
});
|
|
3872
3872
|
test("flattens eligible appearances once without changing layout", async () => {
|
|
3873
|
-
const doc = await openFixture$
|
|
3873
|
+
const doc = await openFixture$8(engine, opts);
|
|
3874
3874
|
try {
|
|
3875
3875
|
if (!doc.pages.flatten) return;
|
|
3876
3876
|
const layoutBefore = await doc.pages.list();
|
|
@@ -3904,7 +3904,7 @@ function runPageFlattenConformance(runner, opts) {
|
|
|
3904
3904
|
});
|
|
3905
3905
|
});
|
|
3906
3906
|
}
|
|
3907
|
-
async function openFixture$
|
|
3907
|
+
async function openFixture$8(engine, opts) {
|
|
3908
3908
|
if (opts.openKind === "bytes") return engine.open({
|
|
3909
3909
|
kind: "bytes",
|
|
3910
3910
|
id: opts.fixture.id,
|
|
@@ -3959,7 +3959,7 @@ function runRedactionApplyConformance(runner, opts) {
|
|
|
3959
3959
|
if (engine) await engine.destroy();
|
|
3960
3960
|
});
|
|
3961
3961
|
test("annotations scope applies the marked redaction and counts collateral", async () => {
|
|
3962
|
-
const doc = await openFixture$
|
|
3962
|
+
const doc = await openFixture$7(engine, opts);
|
|
3963
3963
|
try {
|
|
3964
3964
|
if (!doc.redaction) return;
|
|
3965
3965
|
const layoutBefore = await doc.pages.list();
|
|
@@ -4013,7 +4013,7 @@ function runRedactionApplyConformance(runner, opts) {
|
|
|
4013
4013
|
}
|
|
4014
4014
|
});
|
|
4015
4015
|
test("pages scope applies everything once and validates its input", async () => {
|
|
4016
|
-
const doc = await openFixture$
|
|
4016
|
+
const doc = await openFixture$7(engine, opts);
|
|
4017
4017
|
try {
|
|
4018
4018
|
if (!doc.redaction) return;
|
|
4019
4019
|
const pageObjectNumber = (await doc.pages.list()).pages[0].pageObjectNumber;
|
|
@@ -4064,7 +4064,7 @@ function runRedactionApplyConformance(runner, opts) {
|
|
|
4064
4064
|
});
|
|
4065
4065
|
});
|
|
4066
4066
|
}
|
|
4067
|
-
async function openFixture$
|
|
4067
|
+
async function openFixture$7(engine, opts) {
|
|
4068
4068
|
if (opts.openKind === "bytes") return engine.open({
|
|
4069
4069
|
kind: "bytes",
|
|
4070
4070
|
id: opts.fixture.id,
|
|
@@ -4107,7 +4107,7 @@ function runPageExtractConformance(runner, opts) {
|
|
|
4107
4107
|
let supported = false;
|
|
4108
4108
|
beforeAll(async () => {
|
|
4109
4109
|
engine = await opts.makeEngine();
|
|
4110
|
-
const probe = await openFixture$
|
|
4110
|
+
const probe = await openFixture$6(engine, opts);
|
|
4111
4111
|
supported = probe.pages.extract !== void 0;
|
|
4112
4112
|
await probe.close();
|
|
4113
4113
|
});
|
|
@@ -4116,7 +4116,7 @@ function runPageExtractConformance(runner, opts) {
|
|
|
4116
4116
|
});
|
|
4117
4117
|
test("pages.extract() returns standalone PDF bytes and leaves the source untouched", async () => {
|
|
4118
4118
|
if (!supported) return;
|
|
4119
|
-
const doc = await openFixture$
|
|
4119
|
+
const doc = await openFixture$6(engine, opts);
|
|
4120
4120
|
try {
|
|
4121
4121
|
const before = await doc.pages.list();
|
|
4122
4122
|
const target = before.pages[before.pages.length - 1];
|
|
@@ -4132,7 +4132,7 @@ function runPageExtractConformance(runner, opts) {
|
|
|
4132
4132
|
});
|
|
4133
4133
|
test("extracted bytes re-open as a document with the requested pages, in caller order", async () => {
|
|
4134
4134
|
if (!supported || opts.openKind !== "bytes") return;
|
|
4135
|
-
const doc = await openFixture$
|
|
4135
|
+
const doc = await openFixture$6(engine, opts);
|
|
4136
4136
|
let extracted = null;
|
|
4137
4137
|
try {
|
|
4138
4138
|
const list = await doc.pages.list();
|
|
@@ -4156,7 +4156,7 @@ function runPageExtractConformance(runner, opts) {
|
|
|
4156
4156
|
});
|
|
4157
4157
|
test("pages.extract() rejects empty input with InvalidArg", async () => {
|
|
4158
4158
|
if (!supported) return;
|
|
4159
|
-
const doc = await openFixture$
|
|
4159
|
+
const doc = await openFixture$6(engine, opts);
|
|
4160
4160
|
try {
|
|
4161
4161
|
let caught;
|
|
4162
4162
|
try {
|
|
@@ -4171,7 +4171,7 @@ function runPageExtractConformance(runner, opts) {
|
|
|
4171
4171
|
});
|
|
4172
4172
|
test("pages.extract() rejects duplicate PONs with InvalidArg", async () => {
|
|
4173
4173
|
if (!supported) return;
|
|
4174
|
-
const doc = await openFixture$
|
|
4174
|
+
const doc = await openFixture$6(engine, opts);
|
|
4175
4175
|
try {
|
|
4176
4176
|
const pon = (await doc.pages.list()).pages[0].pageObjectNumber;
|
|
4177
4177
|
let caught;
|
|
@@ -4187,7 +4187,7 @@ function runPageExtractConformance(runner, opts) {
|
|
|
4187
4187
|
});
|
|
4188
4188
|
test("pages.extract() rejects unknown PON with NotFound or InvalidArg", async () => {
|
|
4189
4189
|
if (!supported) return;
|
|
4190
|
-
const doc = await openFixture$
|
|
4190
|
+
const doc = await openFixture$6(engine, opts);
|
|
4191
4191
|
try {
|
|
4192
4192
|
const list = await doc.pages.list();
|
|
4193
4193
|
let bogus = 0;
|
|
@@ -4206,7 +4206,7 @@ function runPageExtractConformance(runner, opts) {
|
|
|
4206
4206
|
});
|
|
4207
4207
|
test("abort on pages.extract() rejects with AbortError", async () => {
|
|
4208
4208
|
if (!supported) return;
|
|
4209
|
-
const doc = await openFixture$
|
|
4209
|
+
const doc = await openFixture$6(engine, opts);
|
|
4210
4210
|
try {
|
|
4211
4211
|
const list = await doc.pages.list();
|
|
4212
4212
|
const p = doc.pages.extract([list.pages[0].pageObjectNumber]);
|
|
@@ -4218,7 +4218,7 @@ function runPageExtractConformance(runner, opts) {
|
|
|
4218
4218
|
});
|
|
4219
4219
|
});
|
|
4220
4220
|
}
|
|
4221
|
-
async function openFixture$
|
|
4221
|
+
async function openFixture$6(engine, opts) {
|
|
4222
4222
|
if (opts.openKind === "bytes") {
|
|
4223
4223
|
const bytes = await opts.fixture.bytes();
|
|
4224
4224
|
return engine.open({
|
|
@@ -4501,7 +4501,7 @@ function runPageInsertConformance(runner, opts) {
|
|
|
4501
4501
|
let supported = false;
|
|
4502
4502
|
beforeAll(async () => {
|
|
4503
4503
|
engine = await opts.makeEngine();
|
|
4504
|
-
const probe = await openFixture$
|
|
4504
|
+
const probe = await openFixture$5(engine, opts);
|
|
4505
4505
|
supported = probe.pages.insert !== void 0 && probe.pages.extract !== void 0;
|
|
4506
4506
|
await probe.close();
|
|
4507
4507
|
});
|
|
@@ -4510,7 +4510,7 @@ function runPageInsertConformance(runner, opts) {
|
|
|
4510
4510
|
});
|
|
4511
4511
|
test("appends every source page with fresh PONs; existing pages keep identity", async () => {
|
|
4512
4512
|
if (!supported) return;
|
|
4513
|
-
const doc = await openFixture$
|
|
4513
|
+
const doc = await openFixture$5(engine, opts);
|
|
4514
4514
|
try {
|
|
4515
4515
|
const before = await doc.pages.list();
|
|
4516
4516
|
const beforePons = before.pages.map((p) => p.pageObjectNumber);
|
|
@@ -4529,7 +4529,7 @@ function runPageInsertConformance(runner, opts) {
|
|
|
4529
4529
|
});
|
|
4530
4530
|
test("destIndex places the block mid-document, in source order", async () => {
|
|
4531
4531
|
if (!supported) return;
|
|
4532
|
-
const doc = await openFixture$
|
|
4532
|
+
const doc = await openFixture$5(engine, opts);
|
|
4533
4533
|
try {
|
|
4534
4534
|
const before = await doc.pages.list();
|
|
4535
4535
|
if (before.pages.length < 2) return;
|
|
@@ -4547,7 +4547,7 @@ function runPageInsertConformance(runner, opts) {
|
|
|
4547
4547
|
});
|
|
4548
4548
|
test("the inserted pages persist through save → re-open", async () => {
|
|
4549
4549
|
if (!supported || opts.openKind !== "bytes") return;
|
|
4550
|
-
const doc = await openFixture$
|
|
4550
|
+
const doc = await openFixture$5(engine, opts);
|
|
4551
4551
|
let reopened = null;
|
|
4552
4552
|
try {
|
|
4553
4553
|
const before = await doc.pages.list();
|
|
@@ -4568,7 +4568,7 @@ function runPageInsertConformance(runner, opts) {
|
|
|
4568
4568
|
});
|
|
4569
4569
|
test("empty bytes reject with InvalidArg; garbage rejects with MalformedPdf", async () => {
|
|
4570
4570
|
if (!supported) return;
|
|
4571
|
-
const doc = await openFixture$
|
|
4571
|
+
const doc = await openFixture$5(engine, opts);
|
|
4572
4572
|
try {
|
|
4573
4573
|
let caught;
|
|
4574
4574
|
try {
|
|
@@ -4592,7 +4592,7 @@ function runPageInsertConformance(runner, opts) {
|
|
|
4592
4592
|
});
|
|
4593
4593
|
test("out-of-range destIndex rejects with InvalidArg", async () => {
|
|
4594
4594
|
if (!supported) return;
|
|
4595
|
-
const doc = await openFixture$
|
|
4595
|
+
const doc = await openFixture$5(engine, opts);
|
|
4596
4596
|
try {
|
|
4597
4597
|
const before = await doc.pages.list();
|
|
4598
4598
|
const single = await doc.pages.extract([before.pages[0].pageObjectNumber]);
|
|
@@ -4609,7 +4609,7 @@ function runPageInsertConformance(runner, opts) {
|
|
|
4609
4609
|
});
|
|
4610
4610
|
});
|
|
4611
4611
|
}
|
|
4612
|
-
async function openFixture$
|
|
4612
|
+
async function openFixture$5(engine, opts) {
|
|
4613
4613
|
if (opts.openKind === "bytes") {
|
|
4614
4614
|
const bytes = await opts.fixture.bytes();
|
|
4615
4615
|
return engine.open({
|
|
@@ -4650,7 +4650,7 @@ function runPieceInfoConformance(runner, opts) {
|
|
|
4650
4650
|
let supported = false;
|
|
4651
4651
|
beforeAll(async () => {
|
|
4652
4652
|
engine = await opts.makeEngine();
|
|
4653
|
-
const probe = await openFixture$
|
|
4653
|
+
const probe = await openFixture$4(engine, opts);
|
|
4654
4654
|
supported = probe.pieceInfo !== void 0;
|
|
4655
4655
|
await probe.close();
|
|
4656
4656
|
});
|
|
@@ -4659,7 +4659,7 @@ function runPieceInfoConformance(runner, opts) {
|
|
|
4659
4659
|
});
|
|
4660
4660
|
test("doc-level: the full value vocabulary round-trips with tags intact", async () => {
|
|
4661
4661
|
if (!supported) return;
|
|
4662
|
-
const doc = await openFixture$
|
|
4662
|
+
const doc = await openFixture$4(engine, opts);
|
|
4663
4663
|
try {
|
|
4664
4664
|
await doc.pieceInfo.update(APP, {
|
|
4665
4665
|
name: "Standard Stamps",
|
|
@@ -4699,7 +4699,7 @@ function runPieceInfoConformance(runner, opts) {
|
|
|
4699
4699
|
});
|
|
4700
4700
|
test("page-level: the stamp schema round-trips on a page", async () => {
|
|
4701
4701
|
if (!supported) return;
|
|
4702
|
-
const doc = await openFixture$
|
|
4702
|
+
const doc = await openFixture$4(engine, opts);
|
|
4703
4703
|
try {
|
|
4704
4704
|
const list = await doc.pages.list();
|
|
4705
4705
|
const page = doc.page(list.pages[0].pageObjectNumber);
|
|
@@ -4725,7 +4725,7 @@ function runPieceInfoConformance(runner, opts) {
|
|
|
4725
4725
|
});
|
|
4726
4726
|
test("writes persist through save → re-open", async () => {
|
|
4727
4727
|
if (!supported || opts.openKind !== "bytes") return;
|
|
4728
|
-
const doc = await openFixture$
|
|
4728
|
+
const doc = await openFixture$4(engine, opts);
|
|
4729
4729
|
let reopened = null;
|
|
4730
4730
|
try {
|
|
4731
4731
|
const pon = (await doc.pages.list()).pages[0].pageObjectNumber;
|
|
@@ -4758,7 +4758,7 @@ function runPieceInfoConformance(runner, opts) {
|
|
|
4758
4758
|
});
|
|
4759
4759
|
test("null deletes a key; clear removes an entry; siblings survive", async () => {
|
|
4760
4760
|
if (!supported) return;
|
|
4761
|
-
const doc = await openFixture$
|
|
4761
|
+
const doc = await openFixture$4(engine, opts);
|
|
4762
4762
|
try {
|
|
4763
4763
|
await doc.pieceInfo.update(APP, {
|
|
4764
4764
|
name: "A",
|
|
@@ -4784,7 +4784,7 @@ function runPieceInfoConformance(runner, opts) {
|
|
|
4784
4784
|
});
|
|
4785
4785
|
test("an application that was never written reads as null", async () => {
|
|
4786
4786
|
if (!supported) return;
|
|
4787
|
-
const doc = await openFixture$
|
|
4787
|
+
const doc = await openFixture$4(engine, opts);
|
|
4788
4788
|
try {
|
|
4789
4789
|
expect(await doc.pieceInfo.read("EMBD_NeverWritten")).toBe(null);
|
|
4790
4790
|
const list = await doc.pages.list();
|
|
@@ -4795,7 +4795,7 @@ function runPieceInfoConformance(runner, opts) {
|
|
|
4795
4795
|
});
|
|
4796
4796
|
});
|
|
4797
4797
|
}
|
|
4798
|
-
async function openFixture$
|
|
4798
|
+
async function openFixture$4(engine, opts) {
|
|
4799
4799
|
if (opts.openKind === "bytes") {
|
|
4800
4800
|
const bytes = await opts.fixture.bytes();
|
|
4801
4801
|
return engine.open({
|
|
@@ -4858,7 +4858,7 @@ function runDocumentEventsConformance(runner, opts) {
|
|
|
4858
4858
|
if (engine) await engine.destroy();
|
|
4859
4859
|
});
|
|
4860
4860
|
test("every confirmed mutation publishes exactly one event, results verbatim", async () => {
|
|
4861
|
-
const doc = await openFixture$
|
|
4861
|
+
const doc = await openFixture$3(engine, opts);
|
|
4862
4862
|
try {
|
|
4863
4863
|
const events = [];
|
|
4864
4864
|
doc.events.subscribe((event) => events.push(event));
|
|
@@ -4917,7 +4917,7 @@ function runDocumentEventsConformance(runner, opts) {
|
|
|
4917
4917
|
}
|
|
4918
4918
|
});
|
|
4919
4919
|
test("a FAILED mutation publishes nothing (events are ground truth)", async () => {
|
|
4920
|
-
const doc = await openFixture$
|
|
4920
|
+
const doc = await openFixture$3(engine, opts);
|
|
4921
4921
|
try {
|
|
4922
4922
|
const events = [];
|
|
4923
4923
|
doc.events.subscribe((event) => events.push(event));
|
|
@@ -4935,7 +4935,7 @@ function runDocumentEventsConformance(runner, opts) {
|
|
|
4935
4935
|
}
|
|
4936
4936
|
});
|
|
4937
4937
|
test("unsubscribe stops delivery", async () => {
|
|
4938
|
-
const doc = await openFixture$
|
|
4938
|
+
const doc = await openFixture$3(engine, opts);
|
|
4939
4939
|
try {
|
|
4940
4940
|
const events = [];
|
|
4941
4941
|
doc.events.subscribe((event) => events.push(event))();
|
|
@@ -4948,7 +4948,7 @@ function runDocumentEventsConformance(runner, opts) {
|
|
|
4948
4948
|
});
|
|
4949
4949
|
});
|
|
4950
4950
|
}
|
|
4951
|
-
async function openFixture$
|
|
4951
|
+
async function openFixture$3(engine, opts) {
|
|
4952
4952
|
if (opts.openKind === "bytes") {
|
|
4953
4953
|
const bytes = await opts.fixture.bytes();
|
|
4954
4954
|
return engine.open({
|
|
@@ -4975,7 +4975,7 @@ function runPageTextConformance(runner, opts) {
|
|
|
4975
4975
|
if (engine) await engine.destroy();
|
|
4976
4976
|
});
|
|
4977
4977
|
test("read() returns a PageTextSnapshot with non-empty text", async () => {
|
|
4978
|
-
const doc = await openFixture$
|
|
4978
|
+
const doc = await openFixture$2(engine, opts);
|
|
4979
4979
|
try {
|
|
4980
4980
|
const snap = await doc.page(opts.fixture.pageObjectNumber).text.read();
|
|
4981
4981
|
expect(PageTextSnapshotSchema.safeParse(snap).success).toBe(true);
|
|
@@ -4986,7 +4986,7 @@ function runPageTextConformance(runner, opts) {
|
|
|
4986
4986
|
}
|
|
4987
4987
|
});
|
|
4988
4988
|
test("extracted text contains the expected substring", async () => {
|
|
4989
|
-
const doc = await openFixture$
|
|
4989
|
+
const doc = await openFixture$2(engine, opts);
|
|
4990
4990
|
try {
|
|
4991
4991
|
const snap = await doc.page(opts.fixture.pageObjectNumber).text.read();
|
|
4992
4992
|
expect(snap.text.includes(opts.fixture.expectedSubstring)).toBe(true);
|
|
@@ -4995,7 +4995,7 @@ function runPageTextConformance(runner, opts) {
|
|
|
4995
4995
|
}
|
|
4996
4996
|
});
|
|
4997
4997
|
test("read() on an unknown pageObjectNumber throws NotFound", async () => {
|
|
4998
|
-
const doc = await openFixture$
|
|
4998
|
+
const doc = await openFixture$2(engine, opts);
|
|
4999
4999
|
try {
|
|
5000
5000
|
let caught;
|
|
5001
5001
|
try {
|
|
@@ -5010,7 +5010,7 @@ function runPageTextConformance(runner, opts) {
|
|
|
5010
5010
|
}
|
|
5011
5011
|
});
|
|
5012
5012
|
test("abort() on read rejects with AbortError", async () => {
|
|
5013
|
-
const doc = await openFixture$
|
|
5013
|
+
const doc = await openFixture$2(engine, opts);
|
|
5014
5014
|
try {
|
|
5015
5015
|
const p = doc.page(opts.fixture.pageObjectNumber).text.read();
|
|
5016
5016
|
p.abort("test");
|
|
@@ -5020,7 +5020,7 @@ function runPageTextConformance(runner, opts) {
|
|
|
5020
5020
|
}
|
|
5021
5021
|
});
|
|
5022
5022
|
test("read after close throws DocNotOpen", async () => {
|
|
5023
|
-
const doc = await openFixture$
|
|
5023
|
+
const doc = await openFixture$2(engine, opts);
|
|
5024
5024
|
const page = doc.page(opts.fixture.pageObjectNumber);
|
|
5025
5025
|
await doc.close();
|
|
5026
5026
|
let caught;
|
|
@@ -5034,6 +5034,156 @@ function runPageTextConformance(runner, opts) {
|
|
|
5034
5034
|
});
|
|
5035
5035
|
});
|
|
5036
5036
|
}
|
|
5037
|
+
async function openFixture$2(engine, opts) {
|
|
5038
|
+
if (opts.openKind === "bytes") {
|
|
5039
|
+
const bytes = await opts.fixture.bytes();
|
|
5040
|
+
return engine.open({
|
|
5041
|
+
kind: "bytes",
|
|
5042
|
+
id: opts.fixture.id,
|
|
5043
|
+
bytes
|
|
5044
|
+
});
|
|
5045
|
+
}
|
|
5046
|
+
return engine.open({
|
|
5047
|
+
kind: "id",
|
|
5048
|
+
id: opts.fixture.cloudId ?? opts.fixture.id
|
|
5049
|
+
});
|
|
5050
|
+
}
|
|
5051
|
+
//#endregion
|
|
5052
|
+
//#region src/conformance/runPageGeometryOrientationConformance.ts
|
|
5053
|
+
const FLAG_EMPTY = 2;
|
|
5054
|
+
/** Absolute tolerance for coordinate assertions (PDF points). */
|
|
5055
|
+
const COORD_TOLERANCE = .001;
|
|
5056
|
+
/** Tolerance for baseline-angle assertions (radians). */
|
|
5057
|
+
const ANGLE_TOLERANCE = .001;
|
|
5058
|
+
function runPageGeometryOrientationConformance(runner, opts) {
|
|
5059
|
+
const { describe, test, beforeAll, afterAll, expect } = runner;
|
|
5060
|
+
describe(`page geometry orientation conformance: ${opts.label} [${opts.fixture.id}]`, () => {
|
|
5061
|
+
let engine;
|
|
5062
|
+
beforeAll(async () => {
|
|
5063
|
+
engine = await opts.makeEngine();
|
|
5064
|
+
});
|
|
5065
|
+
afterAll(async () => {
|
|
5066
|
+
if (engine) await engine.destroy();
|
|
5067
|
+
});
|
|
5068
|
+
const readSnapshot = async () => {
|
|
5069
|
+
const doc = await openFixture$1(engine, opts);
|
|
5070
|
+
return {
|
|
5071
|
+
snapshot: await doc.page(opts.fixture.pageObjectNumber).geometry.read(),
|
|
5072
|
+
close: () => doc.close()
|
|
5073
|
+
};
|
|
5074
|
+
};
|
|
5075
|
+
test("snapshot round-trips the wire schema", async () => {
|
|
5076
|
+
const { snapshot, close } = await readSnapshot();
|
|
5077
|
+
try {
|
|
5078
|
+
const parsed = PageGeometrySnapshotSchema.safeParse(snapshot);
|
|
5079
|
+
expect(parsed.success).toBe(true);
|
|
5080
|
+
if (parsed.success) expect(parsed.data).toEqual(snapshot);
|
|
5081
|
+
} finally {
|
|
5082
|
+
await close();
|
|
5083
|
+
}
|
|
5084
|
+
});
|
|
5085
|
+
test("run charStart indices tile the page glyph sequence", async () => {
|
|
5086
|
+
const { snapshot, close } = await readSnapshot();
|
|
5087
|
+
try {
|
|
5088
|
+
let next = 0;
|
|
5089
|
+
for (const run of snapshot.runs) {
|
|
5090
|
+
expect(run.charStart).toBe(next);
|
|
5091
|
+
next += run.glyphs.length;
|
|
5092
|
+
}
|
|
5093
|
+
} finally {
|
|
5094
|
+
await close();
|
|
5095
|
+
}
|
|
5096
|
+
});
|
|
5097
|
+
test("runs match the fixture orientation expectation", async () => {
|
|
5098
|
+
const { snapshot, close } = await readSnapshot();
|
|
5099
|
+
try {
|
|
5100
|
+
const expectation = opts.fixture.expectation;
|
|
5101
|
+
if (expectation.kind === "upright") {
|
|
5102
|
+
for (const run of snapshot.runs) {
|
|
5103
|
+
expect(isRotatedGeometryRun(run)).toBe(false);
|
|
5104
|
+
if (isRotatedGeometryRun(run)) continue;
|
|
5105
|
+
for (const glyph of run.glyphs) {
|
|
5106
|
+
expect("looseQuad" in glyph).toBe(false);
|
|
5107
|
+
if (glyph.flags & FLAG_EMPTY) expect(glyph.looseBox).toEqual({
|
|
5108
|
+
left: 0,
|
|
5109
|
+
bottom: 0,
|
|
5110
|
+
right: 0,
|
|
5111
|
+
top: 0
|
|
5112
|
+
});
|
|
5113
|
+
}
|
|
5114
|
+
}
|
|
5115
|
+
return;
|
|
5116
|
+
}
|
|
5117
|
+
if (expectation.kind === "empty-only") {
|
|
5118
|
+
for (const run of snapshot.runs) {
|
|
5119
|
+
expect(isRotatedGeometryRun(run)).toBe(false);
|
|
5120
|
+
if (isRotatedGeometryRun(run)) continue;
|
|
5121
|
+
for (const glyph of run.glyphs) {
|
|
5122
|
+
expect(glyph.flags & FLAG_EMPTY).toBe(FLAG_EMPTY);
|
|
5123
|
+
expect(glyph.looseBox).toEqual({
|
|
5124
|
+
left: 0,
|
|
5125
|
+
bottom: 0,
|
|
5126
|
+
right: 0,
|
|
5127
|
+
top: 0
|
|
5128
|
+
});
|
|
5129
|
+
}
|
|
5130
|
+
}
|
|
5131
|
+
return;
|
|
5132
|
+
}
|
|
5133
|
+
const rotatedRuns = snapshot.runs.filter(isRotatedGeometryRun);
|
|
5134
|
+
expect(rotatedRuns.length >= (expectation.minRotatedRuns ?? 1)).toBe(true);
|
|
5135
|
+
for (const run of rotatedRuns) {
|
|
5136
|
+
expect(expectation.rotations.some((angle) => angleClose(run.rotation, angle, ANGLE_TOLERANCE))).toBe(true);
|
|
5137
|
+
expect(run.ascentFlip).toBe(expectation.ascentFlip);
|
|
5138
|
+
assertRotatedRunGeometry(run);
|
|
5139
|
+
}
|
|
5140
|
+
if (expectation.sheared) {
|
|
5141
|
+
const shearedGlyphs = rotatedRuns.flatMap((run) => run.glyphs).filter((glyph) => (glyph.flags & FLAG_EMPTY) === 0 && Math.abs(glyph.looseQuad.p3.x - glyph.looseQuad.p1.x) > 1);
|
|
5142
|
+
expect(shearedGlyphs.length > 0).toBe(true);
|
|
5143
|
+
}
|
|
5144
|
+
} finally {
|
|
5145
|
+
await close();
|
|
5146
|
+
}
|
|
5147
|
+
});
|
|
5148
|
+
function assertRotatedRunGeometry(run) {
|
|
5149
|
+
for (const glyph of run.glyphs) {
|
|
5150
|
+
if (glyph.flags & FLAG_EMPTY) {
|
|
5151
|
+
expect(glyph.looseQuad).toEqual({
|
|
5152
|
+
p1: {
|
|
5153
|
+
x: 0,
|
|
5154
|
+
y: 0
|
|
5155
|
+
},
|
|
5156
|
+
p2: {
|
|
5157
|
+
x: 0,
|
|
5158
|
+
y: 0
|
|
5159
|
+
},
|
|
5160
|
+
p3: {
|
|
5161
|
+
x: 0,
|
|
5162
|
+
y: 0
|
|
5163
|
+
},
|
|
5164
|
+
p4: {
|
|
5165
|
+
x: 0,
|
|
5166
|
+
y: 0
|
|
5167
|
+
}
|
|
5168
|
+
});
|
|
5169
|
+
continue;
|
|
5170
|
+
}
|
|
5171
|
+
const q = glyph.looseQuad;
|
|
5172
|
+
expect(Math.abs(q.p2.x - q.p1.x - (q.p4.x - q.p3.x)) <= COORD_TOLERANCE).toBe(true);
|
|
5173
|
+
expect(Math.abs(q.p2.y - q.p1.y - (q.p4.y - q.p3.y)) <= COORD_TOLERANCE).toBe(true);
|
|
5174
|
+
const bounds = pdfQuadBounds(q);
|
|
5175
|
+
expect(bounds.left >= run.rect.left - COORD_TOLERANCE).toBe(true);
|
|
5176
|
+
expect(bounds.right <= run.rect.right + COORD_TOLERANCE).toBe(true);
|
|
5177
|
+
expect(bounds.bottom >= run.rect.bottom - COORD_TOLERANCE).toBe(true);
|
|
5178
|
+
expect(bounds.top <= run.rect.top + COORD_TOLERANCE).toBe(true);
|
|
5179
|
+
}
|
|
5180
|
+
}
|
|
5181
|
+
});
|
|
5182
|
+
}
|
|
5183
|
+
function angleClose(a, b, tolerance) {
|
|
5184
|
+
const delta = a - b;
|
|
5185
|
+
return Math.abs(Math.atan2(Math.sin(delta), Math.cos(delta))) <= tolerance;
|
|
5186
|
+
}
|
|
5037
5187
|
async function openFixture$1(engine, opts) {
|
|
5038
5188
|
if (opts.openKind === "bytes") {
|
|
5039
5189
|
const bytes = await opts.fixture.bytes();
|
|
@@ -5089,10 +5239,27 @@ function runSearchConformance(runner, opts) {
|
|
|
5089
5239
|
expect(matches.some((m) => m.pageObjectNumber === fixture.presentPageObjectNumber)).toBe(true);
|
|
5090
5240
|
for (const m of matches) {
|
|
5091
5241
|
expect(m.charCount > 0).toBe(true);
|
|
5092
|
-
expect(m.
|
|
5093
|
-
for (const
|
|
5094
|
-
expect(
|
|
5095
|
-
expect(
|
|
5242
|
+
expect(m.segments.length > 0).toBe(true);
|
|
5243
|
+
for (const s of m.segments) {
|
|
5244
|
+
expect(s.rect.right > s.rect.left).toBe(true);
|
|
5245
|
+
expect(s.rect.top > s.rect.bottom).toBe(true);
|
|
5246
|
+
const xs = [
|
|
5247
|
+
s.quad.p1.x,
|
|
5248
|
+
s.quad.p2.x,
|
|
5249
|
+
s.quad.p3.x,
|
|
5250
|
+
s.quad.p4.x
|
|
5251
|
+
];
|
|
5252
|
+
const ys = [
|
|
5253
|
+
s.quad.p1.y,
|
|
5254
|
+
s.quad.p2.y,
|
|
5255
|
+
s.quad.p3.y,
|
|
5256
|
+
s.quad.p4.y
|
|
5257
|
+
];
|
|
5258
|
+
expect(Math.abs(s.rect.left - Math.min(...xs)) < .001).toBe(true);
|
|
5259
|
+
expect(Math.abs(s.rect.right - Math.max(...xs)) < .001).toBe(true);
|
|
5260
|
+
expect(Math.abs(s.rect.bottom - Math.min(...ys)) < .001).toBe(true);
|
|
5261
|
+
expect(Math.abs(s.rect.top - Math.max(...ys)) < .001).toBe(true);
|
|
5262
|
+
expect(s.advance === 1 || s.advance === -1).toBe(true);
|
|
5096
5263
|
}
|
|
5097
5264
|
}
|
|
5098
5265
|
} finally {
|
|
@@ -5224,7 +5391,7 @@ function runSearchConformance(runner, opts) {
|
|
|
5224
5391
|
expect(matches.length > 0).toBe(true);
|
|
5225
5392
|
for (const m of matches) {
|
|
5226
5393
|
expect(m.charCount > 0).toBe(true);
|
|
5227
|
-
expect(m.
|
|
5394
|
+
expect(m.segments.length > 0).toBe(true);
|
|
5228
5395
|
}
|
|
5229
5396
|
} finally {
|
|
5230
5397
|
await doc.close();
|
|
@@ -5389,6 +5556,6 @@ function diffAnnotation(i, a, b, errs) {
|
|
|
5389
5556
|
if (a.nm !== b.nm) errs.push(`annotations[${i}].nm mismatch: ${a.nm} vs ${b.nm}`);
|
|
5390
5557
|
}
|
|
5391
5558
|
//#endregion
|
|
5392
|
-
export { diffAnnotationListSnapshot, diffAnnotationListSnapshotAll, runActionsConformance, runAnnotationAppearanceConformance, runAnnotationMutationConformance, runAnnotationReadConformance, runAttachmentConformance, runDocumentEventsConformance, runFormConformance, runMetadataConformance, runPageDeleteConformance, runPageExtractConformance, runPageFlattenConformance, runPageInsertConformance, runPageReorderConformance, runPageRotateConformance, runPageTextConformance, runPieceInfoConformance, runRedactionApplyConformance, runSearchConformance };
|
|
5559
|
+
export { diffAnnotationListSnapshot, diffAnnotationListSnapshotAll, runActionsConformance, runAnnotationAppearanceConformance, runAnnotationMutationConformance, runAnnotationReadConformance, runAttachmentConformance, runDocumentEventsConformance, runFormConformance, runMetadataConformance, runPageDeleteConformance, runPageExtractConformance, runPageFlattenConformance, runPageGeometryOrientationConformance, runPageInsertConformance, runPageReorderConformance, runPageRotateConformance, runPageTextConformance, runPieceInfoConformance, runRedactionApplyConformance, runSearchConformance };
|
|
5393
5560
|
|
|
5394
5561
|
//# sourceMappingURL=conformance.js.map
|