@embedpdf/engine-core 3.0.0-next.8 → 3.0.0-next.9
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-BsHuCO1S.js → AbortError-8-9JAX1Y.js} +2 -2
- package/dist/{AbortError-BsHuCO1S.js.map → AbortError-8-9JAX1Y.js.map} +1 -1
- package/dist/{AbortError-DmWeq9sx.cjs → AbortError-CRSooKsk.cjs} +2 -2
- package/dist/{AbortError-DmWeq9sx.cjs.map → AbortError-CRSooKsk.cjs.map} +1 -1
- package/dist/{AnnotationListSnapshot-CHjkcIaL.d.cts → AnnotationListSnapshot-Bwfnb1i-.d.cts} +25 -2
- package/dist/{AnnotationListSnapshot-CHjkcIaL.d.ts → AnnotationListSnapshot-Bwfnb1i-.d.ts} +25 -2
- package/dist/{DocumentSecurityService-CrxGktMI.d.ts → DocumentSecurityService-CqLXyTVM.d.ts} +2 -2
- package/dist/{DocumentSecurityService-B1uv4FaK.d.cts → DocumentSecurityService-DQNpYCXs.d.cts} +2 -2
- package/dist/{Engine-BE6r06QI.d.ts → Engine-C25gzAFz.d.ts} +26 -16
- package/dist/{Engine-BOaRwtKa.d.cts → Engine-COFJU7sA.d.cts} +26 -16
- package/dist/{charmap-D6PLtRiC.cjs → PageInsertBlankInput-CzShuSJI.cjs} +16 -1
- package/dist/PageInsertBlankInput-CzShuSJI.cjs.map +1 -0
- package/dist/{charmap-CUukAMhR.js → PageInsertBlankInput-WKY0tr6S.js} +11 -2
- package/dist/PageInsertBlankInput-WKY0tr6S.js.map +1 -0
- package/dist/{builders-BsUc2A1U.cjs → builders-B5CgvJ3j.cjs} +6 -6
- package/dist/{builders-BsUc2A1U.cjs.map → builders-B5CgvJ3j.cjs.map} +1 -1
- package/dist/{builders-CF5gKkOa.js → builders-CGcBlTrv.js} +3 -3
- package/dist/{builders-CF5gKkOa.js.map → builders-CGcBlTrv.js.map} +1 -1
- package/dist/conformance.cjs +337 -178
- package/dist/conformance.cjs.map +1 -1
- package/dist/conformance.d.cts +26 -6
- package/dist/conformance.d.ts +26 -6
- package/dist/conformance.js +292 -134
- package/dist/conformance.js.map +1 -1
- package/dist/{fold-DemV94jf.js → fold-BfyxxwS6.js} +2 -2
- package/dist/{fold-DemV94jf.js.map → fold-BfyxxwS6.js.map} +1 -1
- package/dist/{fold-BeT1GxLP.cjs → fold-C7I5GpBz.cjs} +4 -4
- package/dist/{fold-BeT1GxLP.cjs.map → fold-C7I5GpBz.cjs.map} +1 -1
- package/dist/index.cjs +15 -14
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/runtime.cjs +20 -19
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +24 -5
- package/dist/runtime.d.ts +24 -5
- package/dist/runtime.js +5 -5
- package/dist/{schemas-BCuQlwdg.js → schemas-BKRZZ-g1.js} +37 -5
- package/dist/{schemas-BCuQlwdg.js.map → schemas-BKRZZ-g1.js.map} +1 -1
- package/dist/{schemas-BPA_F2HV.cjs → schemas-DlxjcDIl.cjs} +81 -25
- package/dist/{schemas-BPA_F2HV.cjs.map → schemas-DlxjcDIl.cjs.map} +1 -1
- package/dist/wire.cjs +32 -8
- package/dist/wire.cjs.map +1 -1
- package/dist/wire.d.cts +64 -12
- package/dist/wire.d.ts +64 -12
- package/dist/wire.js +29 -9
- package/dist/wire.js.map +1 -1
- package/package.json +1 -1
- package/dist/charmap-CUukAMhR.js.map +0 -1
- package/dist/charmap-D6PLtRiC.cjs.map +0 -1
package/dist/conformance.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_fold = require("./fold-
|
|
3
|
-
const
|
|
4
|
-
const require_AbortError = require("./AbortError-
|
|
5
|
-
const require_schemas = require("./schemas-
|
|
2
|
+
const require_fold = require("./fold-C7I5GpBz.cjs");
|
|
3
|
+
const require_PageInsertBlankInput = require("./PageInsertBlankInput-CzShuSJI.cjs");
|
|
4
|
+
const require_AbortError = require("./AbortError-CRSooKsk.cjs");
|
|
5
|
+
const require_schemas = require("./schemas-DlxjcDIl.cjs");
|
|
6
6
|
//#region src/conformance/runMetadataConformance.ts
|
|
7
7
|
/**
|
|
8
8
|
* The conformance harness is transport-agnostic. It takes the test runner as
|
|
@@ -19,7 +19,7 @@ function runMetadataConformance(runner, opts) {
|
|
|
19
19
|
if (engine) await engine.destroy();
|
|
20
20
|
});
|
|
21
21
|
test("reads metadata from sample fixture", async () => {
|
|
22
|
-
const doc = await openFixture$
|
|
22
|
+
const doc = await openFixture$17(engine, opts);
|
|
23
23
|
try {
|
|
24
24
|
const meta = await doc.metadata.read();
|
|
25
25
|
expect(meta).toMatchObject(opts.fixture.expected);
|
|
@@ -29,7 +29,7 @@ function runMetadataConformance(runner, opts) {
|
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
test("abort() before completion rejects with AbortError", async () => {
|
|
32
|
-
const doc = await openFixture$
|
|
32
|
+
const doc = await openFixture$17(engine, opts);
|
|
33
33
|
try {
|
|
34
34
|
const p = doc.metadata.read();
|
|
35
35
|
p.abort("test");
|
|
@@ -39,7 +39,7 @@ function runMetadataConformance(runner, opts) {
|
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
test("aborting one read does not affect a concurrent one", async () => {
|
|
42
|
-
const doc = await openFixture$
|
|
42
|
+
const doc = await openFixture$17(engine, opts);
|
|
43
43
|
try {
|
|
44
44
|
const a = doc.metadata.read();
|
|
45
45
|
const b = doc.metadata.read();
|
|
@@ -51,7 +51,7 @@ function runMetadataConformance(runner, opts) {
|
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
53
|
test("metadata after close throws DocNotOpen", async () => {
|
|
54
|
-
const doc = await openFixture$
|
|
54
|
+
const doc = await openFixture$17(engine, opts);
|
|
55
55
|
await doc.close();
|
|
56
56
|
let caught;
|
|
57
57
|
try {
|
|
@@ -60,10 +60,10 @@ function runMetadataConformance(runner, opts) {
|
|
|
60
60
|
caught = err;
|
|
61
61
|
}
|
|
62
62
|
expect(caught).toBeTruthy();
|
|
63
|
-
expect(require_fold.EngineError.is(caught,
|
|
63
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.DocNotOpen)).toBe(true);
|
|
64
64
|
});
|
|
65
65
|
test("update() sets standard + custom fields and a subsequent read observes them", async () => {
|
|
66
|
-
const doc = await openFixture$
|
|
66
|
+
const doc = await openFixture$17(engine, opts);
|
|
67
67
|
try {
|
|
68
68
|
const result = await doc.metadata.update({
|
|
69
69
|
title: "Conformance Title",
|
|
@@ -82,7 +82,7 @@ function runMetadataConformance(runner, opts) {
|
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
84
|
test("update() clears a field with null", async () => {
|
|
85
|
-
const doc = await openFixture$
|
|
85
|
+
const doc = await openFixture$17(engine, opts);
|
|
86
86
|
try {
|
|
87
87
|
await doc.metadata.update({ title: "To Be Cleared" });
|
|
88
88
|
const set = await doc.metadata.read();
|
|
@@ -95,7 +95,7 @@ function runMetadataConformance(runner, opts) {
|
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
97
|
test("update() after close throws DocNotOpen", async () => {
|
|
98
|
-
const doc = await openFixture$
|
|
98
|
+
const doc = await openFixture$17(engine, opts);
|
|
99
99
|
await doc.close();
|
|
100
100
|
let caught;
|
|
101
101
|
try {
|
|
@@ -104,11 +104,11 @@ function runMetadataConformance(runner, opts) {
|
|
|
104
104
|
caught = err;
|
|
105
105
|
}
|
|
106
106
|
expect(caught).toBeTruthy();
|
|
107
|
-
expect(require_fold.EngineError.is(caught,
|
|
107
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.DocNotOpen)).toBe(true);
|
|
108
108
|
});
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
|
-
async function openFixture$
|
|
111
|
+
async function openFixture$17(engine, opts) {
|
|
112
112
|
if (opts.openKind === "bytes") {
|
|
113
113
|
const bytes = await opts.fixture.bytes();
|
|
114
114
|
return engine.open({
|
|
@@ -135,7 +135,7 @@ function runAnnotationReadConformance(runner, opts) {
|
|
|
135
135
|
if (engine) await engine.destroy();
|
|
136
136
|
});
|
|
137
137
|
test("listRawAll returns one entry per page with valid PageState", async () => {
|
|
138
|
-
const doc = await openFixture$
|
|
138
|
+
const doc = await openFixture$16(engine, opts);
|
|
139
139
|
try {
|
|
140
140
|
const snap = await doc.annotations.listRawAll();
|
|
141
141
|
expect(require_schemas.AnnotationListSnapshotAllPagesSchema.safeParse(snap).success).toBe(true);
|
|
@@ -148,7 +148,7 @@ function runAnnotationReadConformance(runner, opts) {
|
|
|
148
148
|
}
|
|
149
149
|
});
|
|
150
150
|
test("listRaw on the test page returns the expected counts and DTO shape", async () => {
|
|
151
|
-
const doc = await openFixture$
|
|
151
|
+
const doc = await openFixture$16(engine, opts);
|
|
152
152
|
try {
|
|
153
153
|
const snap = await doc.annotations.listRaw(opts.fixture.pageObjectNumber);
|
|
154
154
|
expect(require_schemas.AnnotationListPageSnapshotSchema.safeParse(snap).success).toBe(true);
|
|
@@ -178,7 +178,7 @@ function runAnnotationReadConformance(runner, opts) {
|
|
|
178
178
|
}
|
|
179
179
|
});
|
|
180
180
|
test("shape/vertex/line annotations expose their family fields", async () => {
|
|
181
|
-
const doc = await openFixture$
|
|
181
|
+
const doc = await openFixture$16(engine, opts);
|
|
182
182
|
try {
|
|
183
183
|
const snap = await doc.annotations.listRaw(opts.fixture.pageObjectNumber);
|
|
184
184
|
for (const a of snap.annotations) {
|
|
@@ -237,7 +237,7 @@ function runAnnotationReadConformance(runner, opts) {
|
|
|
237
237
|
}
|
|
238
238
|
});
|
|
239
239
|
test("full page list dispatches per-subtype and matches raw counts", async () => {
|
|
240
|
-
const doc = await openFixture$
|
|
240
|
+
const doc = await openFixture$16(engine, opts);
|
|
241
241
|
try {
|
|
242
242
|
const full = await doc.page(opts.fixture.pageObjectNumber).annotations.list();
|
|
243
243
|
expect(require_schemas.AnnotationListPageSnapshotSchema.safeParse(full).success).toBe(true);
|
|
@@ -247,7 +247,7 @@ function runAnnotationReadConformance(runner, opts) {
|
|
|
247
247
|
}
|
|
248
248
|
});
|
|
249
249
|
test("every annotation DTO satisfies AnnotationDTOSchema (discriminated union)", async () => {
|
|
250
|
-
const doc = await openFixture$
|
|
250
|
+
const doc = await openFixture$16(engine, opts);
|
|
251
251
|
try {
|
|
252
252
|
const snap = await doc.annotations.listRaw(opts.fixture.pageObjectNumber);
|
|
253
253
|
for (const a of snap.annotations) {
|
|
@@ -287,7 +287,7 @@ function runAnnotationReadConformance(runner, opts) {
|
|
|
287
287
|
});
|
|
288
288
|
if (opts.fixture.expectsWeakAnnotation) {
|
|
289
289
|
test("weak annotations carry identityQuality: weak and ref.kind: index", async () => {
|
|
290
|
-
const doc = await openFixture$
|
|
290
|
+
const doc = await openFixture$16(engine, opts);
|
|
291
291
|
try {
|
|
292
292
|
const weak = (await doc.annotations.listRaw(opts.fixture.pageObjectNumber)).annotations.find((a) => a.identityQuality === "weak");
|
|
293
293
|
expect(weak !== void 0).toBe(true);
|
|
@@ -297,7 +297,7 @@ function runAnnotationReadConformance(runner, opts) {
|
|
|
297
297
|
}
|
|
298
298
|
});
|
|
299
299
|
test("a stale revision token throws InvalidReference", async () => {
|
|
300
|
-
const doc = await openFixture$
|
|
300
|
+
const doc = await openFixture$16(engine, opts);
|
|
301
301
|
try {
|
|
302
302
|
const snap = await doc.page(opts.fixture.pageObjectNumber).annotations.list();
|
|
303
303
|
const weak = snap.annotations.find((a) => a.identityQuality === "weak");
|
|
@@ -313,7 +313,7 @@ function runAnnotationReadConformance(runner, opts) {
|
|
|
313
313
|
});
|
|
314
314
|
}
|
|
315
315
|
test("abort() on listRaw rejects with AbortError", async () => {
|
|
316
|
-
const doc = await openFixture$
|
|
316
|
+
const doc = await openFixture$16(engine, opts);
|
|
317
317
|
try {
|
|
318
318
|
const p = doc.annotations.listRaw(opts.fixture.pageObjectNumber);
|
|
319
319
|
p.abort("test");
|
|
@@ -323,7 +323,7 @@ function runAnnotationReadConformance(runner, opts) {
|
|
|
323
323
|
}
|
|
324
324
|
});
|
|
325
325
|
test("listRaw on an unknown pageObjectNumber throws NotFound", async () => {
|
|
326
|
-
const doc = await openFixture$
|
|
326
|
+
const doc = await openFixture$16(engine, opts);
|
|
327
327
|
try {
|
|
328
328
|
let caught;
|
|
329
329
|
try {
|
|
@@ -332,14 +332,14 @@ function runAnnotationReadConformance(runner, opts) {
|
|
|
332
332
|
caught = err;
|
|
333
333
|
}
|
|
334
334
|
expect(caught).toBeTruthy();
|
|
335
|
-
expect(require_fold.EngineError.is(caught,
|
|
335
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.NotFound)).toBe(true);
|
|
336
336
|
} finally {
|
|
337
337
|
await doc.close();
|
|
338
338
|
}
|
|
339
339
|
});
|
|
340
340
|
});
|
|
341
341
|
}
|
|
342
|
-
async function openFixture$
|
|
342
|
+
async function openFixture$16(engine, opts) {
|
|
343
343
|
if (opts.openKind === "bytes") {
|
|
344
344
|
const bytes = await opts.fixture.bytes();
|
|
345
345
|
return engine.open({
|
|
@@ -597,7 +597,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
597
597
|
if (engine) await engine.destroy();
|
|
598
598
|
});
|
|
599
599
|
test("create appends without shifting indices and leaves weak refs valid", async () => {
|
|
600
|
-
const doc = await openFixture$
|
|
600
|
+
const doc = await openFixture$15(engine, opts);
|
|
601
601
|
try {
|
|
602
602
|
const page = doc.page(fix.pageObjectNumber);
|
|
603
603
|
const before = await page.annotations.list();
|
|
@@ -633,7 +633,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
633
633
|
}
|
|
634
634
|
});
|
|
635
635
|
test("create + update honor annotation flags (set on create, merge on patch)", async () => {
|
|
636
|
-
const doc = await openFixture$
|
|
636
|
+
const doc = await openFixture$15(engine, opts);
|
|
637
637
|
try {
|
|
638
638
|
const page = doc.page(fix.pageObjectNumber);
|
|
639
639
|
const draft = {
|
|
@@ -668,7 +668,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
668
668
|
}
|
|
669
669
|
});
|
|
670
670
|
test("create shape annotations (circle + square) round-trip shape fields", async () => {
|
|
671
|
-
const doc = await openFixture$
|
|
671
|
+
const doc = await openFixture$15(engine, opts);
|
|
672
672
|
try {
|
|
673
673
|
const page = doc.page(fix.pageObjectNumber);
|
|
674
674
|
const circleDraft = {
|
|
@@ -749,7 +749,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
749
749
|
}
|
|
750
750
|
});
|
|
751
751
|
test("cloudy border (/BE) + rect differences (/RD) are tri-state", async () => {
|
|
752
|
-
const doc = await openFixture$
|
|
752
|
+
const doc = await openFixture$15(engine, opts);
|
|
753
753
|
try {
|
|
754
754
|
const page = doc.page(fix.pageObjectNumber);
|
|
755
755
|
const plainDraft = {
|
|
@@ -828,7 +828,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
828
828
|
}
|
|
829
829
|
});
|
|
830
830
|
test("update echoes the appearance verdict: moves preserve /AP, restyles re-bake", async () => {
|
|
831
|
-
const doc = await openFixture$
|
|
831
|
+
const doc = await openFixture$15(engine, opts);
|
|
832
832
|
try {
|
|
833
833
|
const page = doc.page(fix.pageObjectNumber);
|
|
834
834
|
const draft = {
|
|
@@ -903,7 +903,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
903
903
|
}
|
|
904
904
|
});
|
|
905
905
|
test("a partial /DA patch preserves the unpatched font members", async () => {
|
|
906
|
-
const doc = await openFixture$
|
|
906
|
+
const doc = await openFixture$15(engine, opts);
|
|
907
907
|
try {
|
|
908
908
|
const page = doc.page(fix.pageObjectNumber);
|
|
909
909
|
const draft = {
|
|
@@ -959,7 +959,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
959
959
|
}
|
|
960
960
|
});
|
|
961
961
|
test("box transform is tri-state: rect-only moves keep rotation, null flattens", async () => {
|
|
962
|
-
const doc = await openFixture$
|
|
962
|
+
const doc = await openFixture$15(engine, opts);
|
|
963
963
|
try {
|
|
964
964
|
const page = doc.page(fix.pageObjectNumber);
|
|
965
965
|
const draft = {
|
|
@@ -1020,7 +1020,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1020
1020
|
}
|
|
1021
1021
|
});
|
|
1022
1022
|
test("create vertex + line annotations (polygon/polyline/line) round-trip geometry", async () => {
|
|
1023
|
-
const doc = await openFixture$
|
|
1023
|
+
const doc = await openFixture$15(engine, opts);
|
|
1024
1024
|
try {
|
|
1025
1025
|
const page = doc.page(fix.pageObjectNumber);
|
|
1026
1026
|
const polygonDraft = {
|
|
@@ -1151,7 +1151,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1151
1151
|
}
|
|
1152
1152
|
});
|
|
1153
1153
|
test("create free-text + callout round-trip text/colour/intent fields", async () => {
|
|
1154
|
-
const doc = await openFixture$
|
|
1154
|
+
const doc = await openFixture$15(engine, opts);
|
|
1155
1155
|
try {
|
|
1156
1156
|
const page = doc.page(fix.pageObjectNumber);
|
|
1157
1157
|
const freeTextDraft = {
|
|
@@ -1247,7 +1247,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1247
1247
|
}
|
|
1248
1248
|
});
|
|
1249
1249
|
test("update a free-text patches alignment + colours and is non-structural", async () => {
|
|
1250
|
-
const doc = await openFixture$
|
|
1250
|
+
const doc = await openFixture$15(engine, opts);
|
|
1251
1251
|
try {
|
|
1252
1252
|
const page = doc.page(fix.pageObjectNumber);
|
|
1253
1253
|
const created = await page.annotations.create({
|
|
@@ -1308,7 +1308,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1308
1308
|
}
|
|
1309
1309
|
});
|
|
1310
1310
|
test("create redact (area + text) round-trips label + colour fields", async () => {
|
|
1311
|
-
const doc = await openFixture$
|
|
1311
|
+
const doc = await openFixture$15(engine, opts);
|
|
1312
1312
|
try {
|
|
1313
1313
|
const page = doc.page(fix.pageObjectNumber);
|
|
1314
1314
|
const areaDraft = {
|
|
@@ -1388,7 +1388,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1388
1388
|
}
|
|
1389
1389
|
});
|
|
1390
1390
|
test("update a redact patches the label and clears it, non-structurally", async () => {
|
|
1391
|
-
const doc = await openFixture$
|
|
1391
|
+
const doc = await openFixture$15(engine, opts);
|
|
1392
1392
|
try {
|
|
1393
1393
|
const page = doc.page(fix.pageObjectNumber);
|
|
1394
1394
|
const created = await page.annotations.create({
|
|
@@ -1465,7 +1465,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1465
1465
|
}
|
|
1466
1466
|
});
|
|
1467
1467
|
test("create + update a caret round-trips color/opacity/rect differences", async () => {
|
|
1468
|
-
const doc = await openFixture$
|
|
1468
|
+
const doc = await openFixture$15(engine, opts);
|
|
1469
1469
|
try {
|
|
1470
1470
|
const page = doc.page(fix.pageObjectNumber);
|
|
1471
1471
|
const caretDraft = {
|
|
@@ -1545,7 +1545,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1545
1545
|
}
|
|
1546
1546
|
});
|
|
1547
1547
|
test("update an ink annotation patches strokes + color and is non-structural", async () => {
|
|
1548
|
-
const doc = await openFixture$
|
|
1548
|
+
const doc = await openFixture$15(engine, opts);
|
|
1549
1549
|
try {
|
|
1550
1550
|
const page = doc.page(fix.pageObjectNumber);
|
|
1551
1551
|
const created = await page.annotations.create({
|
|
@@ -1596,7 +1596,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1596
1596
|
}
|
|
1597
1597
|
});
|
|
1598
1598
|
test("ink highlight intent + blend round-trip and unrelated patches preserve blend", async () => {
|
|
1599
|
-
const doc = await openFixture$
|
|
1599
|
+
const doc = await openFixture$15(engine, opts);
|
|
1600
1600
|
try {
|
|
1601
1601
|
const page = doc.page(fix.pageObjectNumber);
|
|
1602
1602
|
const created = await page.annotations.create({
|
|
@@ -1639,7 +1639,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1639
1639
|
}
|
|
1640
1640
|
});
|
|
1641
1641
|
test("update a polyline patches vertices + line endings and is non-structural", async () => {
|
|
1642
|
-
const doc = await openFixture$
|
|
1642
|
+
const doc = await openFixture$15(engine, opts);
|
|
1643
1643
|
try {
|
|
1644
1644
|
const page = doc.page(fix.pageObjectNumber);
|
|
1645
1645
|
const created = await page.annotations.create({
|
|
@@ -1688,7 +1688,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1688
1688
|
}
|
|
1689
1689
|
});
|
|
1690
1690
|
test("update a shape annotation patches color and is non-structural", async () => {
|
|
1691
|
-
const doc = await openFixture$
|
|
1691
|
+
const doc = await openFixture$15(engine, opts);
|
|
1692
1692
|
try {
|
|
1693
1693
|
const page = doc.page(fix.pageObjectNumber);
|
|
1694
1694
|
const created = await page.annotations.create({
|
|
@@ -1737,7 +1737,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1737
1737
|
}
|
|
1738
1738
|
});
|
|
1739
1739
|
if (opts.supportsAppearanceRasters) test("creating a shape bakes an /AP appearance the reader can rasterize", async () => {
|
|
1740
|
-
const doc = await openFixture$
|
|
1740
|
+
const doc = await openFixture$15(engine, opts);
|
|
1741
1741
|
try {
|
|
1742
1742
|
const page = doc.page(fix.pageObjectNumber);
|
|
1743
1743
|
const created = await page.annotations.create({
|
|
@@ -1767,7 +1767,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1767
1767
|
}
|
|
1768
1768
|
});
|
|
1769
1769
|
test("update on a durable annotation is non-structural and never touches /NM", async () => {
|
|
1770
|
-
const doc = await openFixture$
|
|
1770
|
+
const doc = await openFixture$15(engine, opts);
|
|
1771
1771
|
try {
|
|
1772
1772
|
const page = doc.page(fix.pageObjectNumber);
|
|
1773
1773
|
const before = await page.annotations.list();
|
|
@@ -1793,7 +1793,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1793
1793
|
}
|
|
1794
1794
|
});
|
|
1795
1795
|
if (fix.expectsWeakAnnotation) test("update on a weak annotation stamps a UUID v4 /NM and upgrades the ref", async () => {
|
|
1796
|
-
const doc = await openFixture$
|
|
1796
|
+
const doc = await openFixture$15(engine, opts);
|
|
1797
1797
|
try {
|
|
1798
1798
|
const page = doc.page(fix.pageObjectNumber);
|
|
1799
1799
|
const before = await page.annotations.list();
|
|
@@ -1823,7 +1823,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1823
1823
|
}
|
|
1824
1824
|
});
|
|
1825
1825
|
test("delete by objectNumber removes the annotation and reports a stable id", async () => {
|
|
1826
|
-
const doc = await openFixture$
|
|
1826
|
+
const doc = await openFixture$15(engine, opts);
|
|
1827
1827
|
try {
|
|
1828
1828
|
const page = doc.page(fix.pageObjectNumber);
|
|
1829
1829
|
const draft = {
|
|
@@ -1853,7 +1853,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1853
1853
|
}
|
|
1854
1854
|
});
|
|
1855
1855
|
if (fix.expectsWeakAnnotation) test("delete by index of a weak annotation reports deleted: null and refetch reason", async () => {
|
|
1856
|
-
const doc = await openFixture$
|
|
1856
|
+
const doc = await openFixture$15(engine, opts);
|
|
1857
1857
|
try {
|
|
1858
1858
|
const page = doc.page(fix.pageObjectNumber);
|
|
1859
1859
|
const weak = (await page.annotations.list()).annotations.find((a) => a.identityQuality === "weak");
|
|
@@ -1876,7 +1876,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1876
1876
|
}
|
|
1877
1877
|
});
|
|
1878
1878
|
test("abort on create rejects with AbortError", async () => {
|
|
1879
|
-
const doc = await openFixture$
|
|
1879
|
+
const doc = await openFixture$15(engine, opts);
|
|
1880
1880
|
try {
|
|
1881
1881
|
const page = doc.page(fix.pageObjectNumber);
|
|
1882
1882
|
const draft = {
|
|
@@ -1892,7 +1892,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1892
1892
|
}
|
|
1893
1893
|
});
|
|
1894
1894
|
test("update with a stale index revision throws InvalidReference", async () => {
|
|
1895
|
-
const doc = await openFixture$
|
|
1895
|
+
const doc = await openFixture$15(engine, opts);
|
|
1896
1896
|
try {
|
|
1897
1897
|
const page = doc.page(fix.pageObjectNumber);
|
|
1898
1898
|
const weak = (await page.annotations.list()).annotations.find((a) => a.identityQuality === "weak");
|
|
@@ -1913,13 +1913,13 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1913
1913
|
} catch (err) {
|
|
1914
1914
|
caught = err;
|
|
1915
1915
|
}
|
|
1916
|
-
expect(require_fold.EngineError.is(caught,
|
|
1916
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidReference)).toBe(true);
|
|
1917
1917
|
} finally {
|
|
1918
1918
|
await doc.close();
|
|
1919
1919
|
}
|
|
1920
1920
|
});
|
|
1921
1921
|
test("move single durable annotation reorders within the page (single-as-batch)", async () => {
|
|
1922
|
-
const doc = await openFixture$
|
|
1922
|
+
const doc = await openFixture$15(engine, opts);
|
|
1923
1923
|
try {
|
|
1924
1924
|
const page = doc.page(fix.pageObjectNumber);
|
|
1925
1925
|
const aDraft = {
|
|
@@ -1963,7 +1963,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
1963
1963
|
}
|
|
1964
1964
|
});
|
|
1965
1965
|
test("move multi-block preserves caller-supplied order at the destination", async () => {
|
|
1966
|
-
const doc = await openFixture$
|
|
1966
|
+
const doc = await openFixture$15(engine, opts);
|
|
1967
1967
|
try {
|
|
1968
1968
|
const page = doc.page(fix.pageObjectNumber);
|
|
1969
1969
|
const ids = await Promise.all([
|
|
@@ -2002,7 +2002,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2002
2002
|
}
|
|
2003
2003
|
});
|
|
2004
2004
|
if (fix.expectsWeakAnnotation) test("move on a weak annotation upgrades it to durable /NM (one rev bump for batch)", async () => {
|
|
2005
|
-
const doc = await openFixture$
|
|
2005
|
+
const doc = await openFixture$15(engine, opts);
|
|
2006
2006
|
try {
|
|
2007
2007
|
const page = doc.page(fix.pageObjectNumber);
|
|
2008
2008
|
const before = await page.annotations.list();
|
|
@@ -2027,7 +2027,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2027
2027
|
}
|
|
2028
2028
|
});
|
|
2029
2029
|
test("move with a stale index revision rejects (locked rev-token guard)", async () => {
|
|
2030
|
-
const doc = await openFixture$
|
|
2030
|
+
const doc = await openFixture$15(engine, opts);
|
|
2031
2031
|
try {
|
|
2032
2032
|
const page = doc.page(fix.pageObjectNumber);
|
|
2033
2033
|
const a = await page.annotations.create({
|
|
@@ -2059,13 +2059,13 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2059
2059
|
} finally {
|
|
2060
2060
|
await weakSession?.release();
|
|
2061
2061
|
}
|
|
2062
|
-
expect(require_fold.EngineError.is(caught,
|
|
2062
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidReference)).toBe(true);
|
|
2063
2063
|
} finally {
|
|
2064
2064
|
await doc.close();
|
|
2065
2065
|
}
|
|
2066
2066
|
});
|
|
2067
2067
|
test("move with out-of-range toIndex rejects with InvalidArg", async () => {
|
|
2068
|
-
const doc = await openFixture$
|
|
2068
|
+
const doc = await openFixture$15(engine, opts);
|
|
2069
2069
|
try {
|
|
2070
2070
|
const page = doc.page(fix.pageObjectNumber);
|
|
2071
2071
|
const a = await page.annotations.create({
|
|
@@ -2083,13 +2083,13 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2083
2083
|
} finally {
|
|
2084
2084
|
await weakSession?.release();
|
|
2085
2085
|
}
|
|
2086
|
-
expect(require_fold.EngineError.is(caught,
|
|
2086
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidArg)).toBe(true);
|
|
2087
2087
|
} finally {
|
|
2088
2088
|
await doc.close();
|
|
2089
2089
|
}
|
|
2090
2090
|
});
|
|
2091
2091
|
test("move with duplicate refs rejects with InvalidArg", async () => {
|
|
2092
|
-
const doc = await openFixture$
|
|
2092
|
+
const doc = await openFixture$15(engine, opts);
|
|
2093
2093
|
try {
|
|
2094
2094
|
const page = doc.page(fix.pageObjectNumber);
|
|
2095
2095
|
const a = await page.annotations.create({
|
|
@@ -2106,13 +2106,13 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2106
2106
|
} finally {
|
|
2107
2107
|
await weakSession?.release();
|
|
2108
2108
|
}
|
|
2109
|
-
expect(require_fold.EngineError.is(caught,
|
|
2109
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidArg)).toBe(true);
|
|
2110
2110
|
} finally {
|
|
2111
2111
|
await doc.close();
|
|
2112
2112
|
}
|
|
2113
2113
|
});
|
|
2114
2114
|
test("abort on move rejects with AbortError", async () => {
|
|
2115
|
-
const doc = await openFixture$
|
|
2115
|
+
const doc = await openFixture$15(engine, opts);
|
|
2116
2116
|
try {
|
|
2117
2117
|
const page = doc.page(fix.pageObjectNumber);
|
|
2118
2118
|
const a = await page.annotations.create({
|
|
@@ -2133,7 +2133,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2133
2133
|
}
|
|
2134
2134
|
});
|
|
2135
2135
|
test("a page move does NOT bump per-page RevisionTokens (weak refs survive reorder)", async () => {
|
|
2136
|
-
const doc = await openFixture$
|
|
2136
|
+
const doc = await openFixture$15(engine, opts);
|
|
2137
2137
|
try {
|
|
2138
2138
|
const list = await doc.pages.list();
|
|
2139
2139
|
if (list.pages.length < 1) return;
|
|
@@ -2148,7 +2148,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2148
2148
|
}
|
|
2149
2149
|
});
|
|
2150
2150
|
test("create a reply links /IRT and defaults /RT to \"reply\", reporting the parent", async () => {
|
|
2151
|
-
const doc = await openFixture$
|
|
2151
|
+
const doc = await openFixture$15(engine, opts);
|
|
2152
2152
|
try {
|
|
2153
2153
|
const page = doc.page(fix.pageObjectNumber);
|
|
2154
2154
|
const parent = await page.annotations.create({
|
|
@@ -2182,7 +2182,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2182
2182
|
}
|
|
2183
2183
|
});
|
|
2184
2184
|
test("create a grouped subordinate writes /RT /Group", async () => {
|
|
2185
|
-
const doc = await openFixture$
|
|
2185
|
+
const doc = await openFixture$15(engine, opts);
|
|
2186
2186
|
try {
|
|
2187
2187
|
const page = doc.page(fix.pageObjectNumber);
|
|
2188
2188
|
const primary = await page.annotations.create({
|
|
@@ -2213,7 +2213,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2213
2213
|
}
|
|
2214
2214
|
});
|
|
2215
2215
|
test("create link annotations round-trip uri, goto/xyz, goto/fitH, and dead targets", async () => {
|
|
2216
|
-
const doc = await openFixture$
|
|
2216
|
+
const doc = await openFixture$15(engine, opts);
|
|
2217
2217
|
try {
|
|
2218
2218
|
const page = doc.page(fix.pageObjectNumber);
|
|
2219
2219
|
const uri = await page.annotations.create({
|
|
@@ -2290,7 +2290,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2290
2290
|
}
|
|
2291
2291
|
});
|
|
2292
2292
|
test("a link patch retargets in both directions (uri→goto, goto→uri) and moves the rect", async () => {
|
|
2293
|
-
const doc = await openFixture$
|
|
2293
|
+
const doc = await openFixture$15(engine, opts);
|
|
2294
2294
|
try {
|
|
2295
2295
|
const page = doc.page(fix.pageObjectNumber);
|
|
2296
2296
|
const created = await page.annotations.create({
|
|
@@ -2345,7 +2345,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2345
2345
|
}
|
|
2346
2346
|
});
|
|
2347
2347
|
test("a link patch clears the target with null — a dead link on re-read", async () => {
|
|
2348
|
-
const doc = await openFixture$
|
|
2348
|
+
const doc = await openFixture$15(engine, opts);
|
|
2349
2349
|
try {
|
|
2350
2350
|
const page = doc.page(fix.pageObjectNumber);
|
|
2351
2351
|
const created = await page.annotations.create({
|
|
@@ -2384,7 +2384,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2384
2384
|
}
|
|
2385
2385
|
});
|
|
2386
2386
|
test("a link grouped to a highlight round-trips /IRT + /RT /Group with its target", async () => {
|
|
2387
|
-
const doc = await openFixture$
|
|
2387
|
+
const doc = await openFixture$15(engine, opts);
|
|
2388
2388
|
try {
|
|
2389
2389
|
const page = doc.page(fix.pageObjectNumber);
|
|
2390
2390
|
const parent = await page.annotations.create({
|
|
@@ -2418,7 +2418,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2418
2418
|
}
|
|
2419
2419
|
});
|
|
2420
2420
|
test("replace-text round-trips /IT and groups StrikeOut under its Caret", async () => {
|
|
2421
|
-
const doc = await openFixture$
|
|
2421
|
+
const doc = await openFixture$15(engine, opts);
|
|
2422
2422
|
try {
|
|
2423
2423
|
const page = doc.page(fix.pageObjectNumber);
|
|
2424
2424
|
const caret = await page.annotations.create({
|
|
@@ -2470,7 +2470,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2470
2470
|
}
|
|
2471
2471
|
});
|
|
2472
2472
|
test("patch inReplyTo: null clears /IRT and /RT (back to top-level)", async () => {
|
|
2473
|
-
const doc = await openFixture$
|
|
2473
|
+
const doc = await openFixture$15(engine, opts);
|
|
2474
2474
|
try {
|
|
2475
2475
|
const page = doc.page(fix.pageObjectNumber);
|
|
2476
2476
|
const parent = await page.annotations.create({
|
|
@@ -2497,7 +2497,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2497
2497
|
}
|
|
2498
2498
|
});
|
|
2499
2499
|
test("create with a cross-page /IRT parent throws InvalidArg", async () => {
|
|
2500
|
-
const doc = await openFixture$
|
|
2500
|
+
const doc = await openFixture$15(engine, opts);
|
|
2501
2501
|
try {
|
|
2502
2502
|
const page = doc.page(fix.pageObjectNumber);
|
|
2503
2503
|
const parent = await page.annotations.create({
|
|
@@ -2522,7 +2522,7 @@ function runAnnotationMutationConformance(runner, opts) {
|
|
|
2522
2522
|
} catch (err) {
|
|
2523
2523
|
caught = err;
|
|
2524
2524
|
}
|
|
2525
|
-
expect(require_fold.EngineError.is(caught,
|
|
2525
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidArg)).toBe(true);
|
|
2526
2526
|
} finally {
|
|
2527
2527
|
await doc.close();
|
|
2528
2528
|
}
|
|
@@ -2533,7 +2533,7 @@ async function beginWeakEditIfRequired(doc, pageObjectNumber, fix) {
|
|
|
2533
2533
|
if (doc.capabilities.weakAnnotationEditSessions !== "required" || !fix.expectsWeakAnnotation) return null;
|
|
2534
2534
|
return doc.annotations.beginWeakEdit([pageObjectNumber]);
|
|
2535
2535
|
}
|
|
2536
|
-
async function openFixture$
|
|
2536
|
+
async function openFixture$15(engine, opts) {
|
|
2537
2537
|
if (opts.openKind === "bytes") {
|
|
2538
2538
|
const bytes = await opts.fixture.bytes();
|
|
2539
2539
|
return engine.open({
|
|
@@ -2699,7 +2699,7 @@ function runFormConformance(runner, opts) {
|
|
|
2699
2699
|
await expect(doc.forms.setValue(radioRef, {
|
|
2700
2700
|
type: "toggle",
|
|
2701
2701
|
state: null
|
|
2702
|
-
})).rejects.toMatchObject({ code:
|
|
2702
|
+
})).rejects.toMatchObject({ code: require_PageInsertBlankInput.EngineErrorCode.InvalidArg });
|
|
2703
2703
|
const check = await doc.forms.setValue({
|
|
2704
2704
|
kind: "fqn",
|
|
2705
2705
|
name: "opt_check"
|
|
@@ -2727,7 +2727,7 @@ function runFormConformance(runner, opts) {
|
|
|
2727
2727
|
}, {
|
|
2728
2728
|
type: "toggle",
|
|
2729
2729
|
state: "On"
|
|
2730
|
-
})).rejects.toMatchObject({ code:
|
|
2730
|
+
})).rejects.toMatchObject({ code: require_PageInsertBlankInput.EngineErrorCode.InvalidArg });
|
|
2731
2731
|
const field = await doc.forms.get({
|
|
2732
2732
|
kind: "fqn",
|
|
2733
2733
|
name: "maxlen_text"
|
|
@@ -2831,7 +2831,7 @@ function runFormConformance(runner, opts) {
|
|
|
2831
2831
|
}, {
|
|
2832
2832
|
type: "choice",
|
|
2833
2833
|
values: ["foo", "bar"]
|
|
2834
|
-
})).rejects.toMatchObject({ code:
|
|
2834
|
+
})).rejects.toMatchObject({ code: require_PageInsertBlankInput.EngineErrorCode.InvalidArg });
|
|
2835
2835
|
} finally {
|
|
2836
2836
|
await doc.close();
|
|
2837
2837
|
}
|
|
@@ -2901,7 +2901,7 @@ function runFormConformance(runner, opts) {
|
|
|
2901
2901
|
test("rejects garbage import payloads", async () => {
|
|
2902
2902
|
const doc = await open(opts.fixtures.toggleFields);
|
|
2903
2903
|
try {
|
|
2904
|
-
await expect(doc.forms.importData(new TextEncoder().encode("not a form payload"))).rejects.toMatchObject({ code:
|
|
2904
|
+
await expect(doc.forms.importData(new TextEncoder().encode("not a form payload"))).rejects.toMatchObject({ code: require_PageInsertBlankInput.EngineErrorCode.InvalidArg });
|
|
2905
2905
|
} finally {
|
|
2906
2906
|
await doc.close();
|
|
2907
2907
|
}
|
|
@@ -3008,7 +3008,7 @@ function runFormConformance(runner, opts) {
|
|
|
3008
3008
|
g: 247,
|
|
3009
3009
|
b: 219
|
|
3010
3010
|
});
|
|
3011
|
-
await expect(page.annotations.delete(widgetRef)).rejects.toMatchObject({ code:
|
|
3011
|
+
await expect(page.annotations.delete(widgetRef)).rejects.toMatchObject({ code: require_PageInsertBlankInput.EngineErrorCode.InvalidArg });
|
|
3012
3012
|
await doc.forms.detachWidget(field.field.ref, {
|
|
3013
3013
|
annotObjectNumber: widgetRef.annotObjectNumber,
|
|
3014
3014
|
pageObjectNumber: pon
|
|
@@ -3072,7 +3072,7 @@ function runFormConformance(runner, opts) {
|
|
|
3072
3072
|
await expect(doc.forms.updateField(created.field.ref, {
|
|
3073
3073
|
family: "radio",
|
|
3074
3074
|
name: "unison_radio"
|
|
3075
|
-
})).rejects.toMatchObject({ code:
|
|
3075
|
+
})).rejects.toMatchObject({ code: require_PageInsertBlankInput.EngineErrorCode.InvalidArg });
|
|
3076
3076
|
const before = await doc.page(pon).annotations.list();
|
|
3077
3077
|
const removed = await doc.forms.deleteField(created.field.ref);
|
|
3078
3078
|
expect(removed.removedWidgets.length).toBe(2);
|
|
@@ -3081,7 +3081,7 @@ function runFormConformance(runner, opts) {
|
|
|
3081
3081
|
await expect(doc.forms.get({
|
|
3082
3082
|
kind: "fqn",
|
|
3083
3083
|
name: "renamed_radio"
|
|
3084
|
-
})).rejects.toMatchObject({ code:
|
|
3084
|
+
})).rejects.toMatchObject({ code: require_PageInsertBlankInput.EngineErrorCode.NotFound });
|
|
3085
3085
|
} finally {
|
|
3086
3086
|
await doc.close();
|
|
3087
3087
|
}
|
|
@@ -3092,7 +3092,7 @@ function runFormConformance(runner, opts) {
|
|
|
3092
3092
|
await expect(doc.forms.get({
|
|
3093
3093
|
kind: "fqn",
|
|
3094
3094
|
name: "no.such.field"
|
|
3095
|
-
})).rejects.toMatchObject({ code:
|
|
3095
|
+
})).rejects.toMatchObject({ code: require_PageInsertBlankInput.EngineErrorCode.NotFound });
|
|
3096
3096
|
} finally {
|
|
3097
3097
|
await doc.close();
|
|
3098
3098
|
}
|
|
@@ -3123,7 +3123,7 @@ function runAnnotationAppearanceConformance(runner, opts) {
|
|
|
3123
3123
|
if (engine) await engine.destroy();
|
|
3124
3124
|
});
|
|
3125
3125
|
test("renders the expected set of appearances with valid output", async () => {
|
|
3126
|
-
const doc = await openFixture$
|
|
3126
|
+
const doc = await openFixture$14(engine, opts);
|
|
3127
3127
|
try {
|
|
3128
3128
|
const { pageState, appearances } = await collect(doc, opts, useRaw);
|
|
3129
3129
|
expect(pageState.pageObjectNumber).toBe(opts.fixture.pageObjectNumber);
|
|
@@ -3150,7 +3150,7 @@ function runAnnotationAppearanceConformance(runner, opts) {
|
|
|
3150
3150
|
}
|
|
3151
3151
|
});
|
|
3152
3152
|
if (opts.fixture.expectsWeakAppearance) test("weak (index-only) annotations are emitted, not dropped", async () => {
|
|
3153
|
-
const doc = await openFixture$
|
|
3153
|
+
const doc = await openFixture$14(engine, opts);
|
|
3154
3154
|
try {
|
|
3155
3155
|
const { appearances } = await collect(doc, opts, useRaw);
|
|
3156
3156
|
const weak = appearances.find((a) => a.ref.kind === "index");
|
|
@@ -3160,7 +3160,7 @@ function runAnnotationAppearanceConformance(runner, opts) {
|
|
|
3160
3160
|
}
|
|
3161
3161
|
});
|
|
3162
3162
|
if (useRaw) test("rendered appearances are not blank (non-zero alpha)", async () => {
|
|
3163
|
-
const doc = await openFixture$
|
|
3163
|
+
const doc = await openFixture$14(engine, opts);
|
|
3164
3164
|
try {
|
|
3165
3165
|
const { appearances } = await collect(doc, opts, useRaw);
|
|
3166
3166
|
const anyVisible = appearances.some((a) => a.raster !== null && hasOpaquePixel(a.raster));
|
|
@@ -3170,7 +3170,7 @@ function runAnnotationAppearanceConformance(runner, opts) {
|
|
|
3170
3170
|
}
|
|
3171
3171
|
});
|
|
3172
3172
|
test("abort() rejects with AbortError", async () => {
|
|
3173
|
-
const doc = await openFixture$
|
|
3173
|
+
const doc = await openFixture$14(engine, opts);
|
|
3174
3174
|
try {
|
|
3175
3175
|
const page = doc.page(opts.fixture.pageObjectNumber);
|
|
3176
3176
|
const p = useRaw ? page.annotations.renderAppearances({ scale: 1 }) : page.annotations.renderAppearanceImages({
|
|
@@ -3225,7 +3225,7 @@ function hasOpaquePixel(raster) {
|
|
|
3225
3225
|
}
|
|
3226
3226
|
return false;
|
|
3227
3227
|
}
|
|
3228
|
-
async function openFixture$
|
|
3228
|
+
async function openFixture$14(engine, opts) {
|
|
3229
3229
|
if (opts.openKind === "bytes") {
|
|
3230
3230
|
const bytes = await opts.fixture.bytes();
|
|
3231
3231
|
return engine.open({
|
|
@@ -3294,7 +3294,7 @@ function runPageReorderConformance(runner, opts) {
|
|
|
3294
3294
|
if (engine) await engine.destroy();
|
|
3295
3295
|
});
|
|
3296
3296
|
test("pages.list() returns every page in display order, durable PONs only", async () => {
|
|
3297
|
-
const doc = await openFixture$
|
|
3297
|
+
const doc = await openFixture$13(engine, opts);
|
|
3298
3298
|
try {
|
|
3299
3299
|
const list = await doc.pages.list();
|
|
3300
3300
|
expect(require_schemas.PageListSnapshotSchema.safeParse(list).success).toBe(true);
|
|
@@ -3313,7 +3313,7 @@ function runPageReorderConformance(runner, opts) {
|
|
|
3313
3313
|
}
|
|
3314
3314
|
});
|
|
3315
3315
|
test("pages.move() reorders pages and returns the full post-move order", async () => {
|
|
3316
|
-
const doc = await openFixture$
|
|
3316
|
+
const doc = await openFixture$13(engine, opts);
|
|
3317
3317
|
try {
|
|
3318
3318
|
const before = await doc.pages.list();
|
|
3319
3319
|
if (before.pages.length < 3) return;
|
|
@@ -3337,7 +3337,7 @@ function runPageReorderConformance(runner, opts) {
|
|
|
3337
3337
|
}
|
|
3338
3338
|
});
|
|
3339
3339
|
test("weak index-based annotation refs survive a page reorder", async () => {
|
|
3340
|
-
const doc = await openFixture$
|
|
3340
|
+
const doc = await openFixture$13(engine, opts);
|
|
3341
3341
|
try {
|
|
3342
3342
|
const list = await doc.pages.list();
|
|
3343
3343
|
if (list.pages.length < 2) return;
|
|
@@ -3374,7 +3374,7 @@ function runPageReorderConformance(runner, opts) {
|
|
|
3374
3374
|
}
|
|
3375
3375
|
});
|
|
3376
3376
|
test("pages.move() rejects duplicate PONs with InvalidArg", async () => {
|
|
3377
|
-
const doc = await openFixture$
|
|
3377
|
+
const doc = await openFixture$13(engine, opts);
|
|
3378
3378
|
try {
|
|
3379
3379
|
const list = await doc.pages.list();
|
|
3380
3380
|
if (list.pages.length < 1) return;
|
|
@@ -3385,13 +3385,13 @@ function runPageReorderConformance(runner, opts) {
|
|
|
3385
3385
|
} catch (err) {
|
|
3386
3386
|
caught = err;
|
|
3387
3387
|
}
|
|
3388
|
-
expect(require_fold.EngineError.is(caught,
|
|
3388
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidArg)).toBe(true);
|
|
3389
3389
|
} finally {
|
|
3390
3390
|
await doc.close();
|
|
3391
3391
|
}
|
|
3392
3392
|
});
|
|
3393
3393
|
test("pages.move() rejects out-of-range destIndex with InvalidArg", async () => {
|
|
3394
|
-
const doc = await openFixture$
|
|
3394
|
+
const doc = await openFixture$13(engine, opts);
|
|
3395
3395
|
try {
|
|
3396
3396
|
const list = await doc.pages.list();
|
|
3397
3397
|
if (list.pages.length < 1) return;
|
|
@@ -3402,13 +3402,13 @@ function runPageReorderConformance(runner, opts) {
|
|
|
3402
3402
|
} catch (err) {
|
|
3403
3403
|
caught = err;
|
|
3404
3404
|
}
|
|
3405
|
-
expect(require_fold.EngineError.is(caught,
|
|
3405
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidArg)).toBe(true);
|
|
3406
3406
|
} finally {
|
|
3407
3407
|
await doc.close();
|
|
3408
3408
|
}
|
|
3409
3409
|
});
|
|
3410
3410
|
test("pages.move() rejects unknown PON with NotFound or InvalidArg", async () => {
|
|
3411
|
-
const doc = await openFixture$
|
|
3411
|
+
const doc = await openFixture$13(engine, opts);
|
|
3412
3412
|
try {
|
|
3413
3413
|
const list = await doc.pages.list();
|
|
3414
3414
|
let bogus = 0;
|
|
@@ -3420,13 +3420,13 @@ function runPageReorderConformance(runner, opts) {
|
|
|
3420
3420
|
} catch (err) {
|
|
3421
3421
|
caught = err;
|
|
3422
3422
|
}
|
|
3423
|
-
expect(require_fold.EngineError.is(caught,
|
|
3423
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.NotFound) || require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidArg)).toBe(true);
|
|
3424
3424
|
} finally {
|
|
3425
3425
|
await doc.close();
|
|
3426
3426
|
}
|
|
3427
3427
|
});
|
|
3428
3428
|
test("abort on pages.move() rejects with AbortError", async () => {
|
|
3429
|
-
const doc = await openFixture$
|
|
3429
|
+
const doc = await openFixture$13(engine, opts);
|
|
3430
3430
|
try {
|
|
3431
3431
|
const list = await doc.pages.list();
|
|
3432
3432
|
if (list.pages.length < 1) return;
|
|
@@ -3440,7 +3440,7 @@ function runPageReorderConformance(runner, opts) {
|
|
|
3440
3440
|
});
|
|
3441
3441
|
});
|
|
3442
3442
|
}
|
|
3443
|
-
async function openFixture$
|
|
3443
|
+
async function openFixture$13(engine, opts) {
|
|
3444
3444
|
if (opts.openKind === "bytes") {
|
|
3445
3445
|
const bytes = await opts.fixture.bytes();
|
|
3446
3446
|
return engine.open({
|
|
@@ -3514,7 +3514,7 @@ function runPageRotateConformance(runner, opts) {
|
|
|
3514
3514
|
if (engine) await engine.destroy();
|
|
3515
3515
|
});
|
|
3516
3516
|
test("pages.rotate() sets the absolute rotation and returns the full layout", async () => {
|
|
3517
|
-
const doc = await openFixture$
|
|
3517
|
+
const doc = await openFixture$12(engine, opts);
|
|
3518
3518
|
try {
|
|
3519
3519
|
const before = await doc.pages.list();
|
|
3520
3520
|
const target = before.pages[0];
|
|
@@ -3533,7 +3533,7 @@ function runPageRotateConformance(runner, opts) {
|
|
|
3533
3533
|
}
|
|
3534
3534
|
});
|
|
3535
3535
|
test("absolute rotation is idempotent: setting the same value twice is a no-op", async () => {
|
|
3536
|
-
const doc = await openFixture$
|
|
3536
|
+
const doc = await openFixture$12(engine, opts);
|
|
3537
3537
|
try {
|
|
3538
3538
|
const pon = (await doc.pages.list()).pages[0].pageObjectNumber;
|
|
3539
3539
|
const first = await doc.pages.rotate([pon], 180);
|
|
@@ -3544,7 +3544,7 @@ function runPageRotateConformance(runner, opts) {
|
|
|
3544
3544
|
}
|
|
3545
3545
|
});
|
|
3546
3546
|
test("one rotation applies to EVERY listed page (the multi-select gesture)", async () => {
|
|
3547
|
-
const doc = await openFixture$
|
|
3547
|
+
const doc = await openFixture$12(engine, opts);
|
|
3548
3548
|
try {
|
|
3549
3549
|
const list = await doc.pages.list();
|
|
3550
3550
|
if (list.pages.length < 2) return;
|
|
@@ -3556,7 +3556,7 @@ function runPageRotateConformance(runner, opts) {
|
|
|
3556
3556
|
}
|
|
3557
3557
|
});
|
|
3558
3558
|
test("weak index-based annotation refs survive a rotate (no revision bump)", async () => {
|
|
3559
|
-
const doc = await openFixture$
|
|
3559
|
+
const doc = await openFixture$12(engine, opts);
|
|
3560
3560
|
try {
|
|
3561
3561
|
const hostPon = (await doc.pages.list()).pages[0].pageObjectNumber;
|
|
3562
3562
|
const hostPage = doc.page(hostPon);
|
|
@@ -3586,7 +3586,7 @@ function runPageRotateConformance(runner, opts) {
|
|
|
3586
3586
|
}
|
|
3587
3587
|
});
|
|
3588
3588
|
test("pages.rotate() rejects an invalid rotation value with InvalidArg", async () => {
|
|
3589
|
-
const doc = await openFixture$
|
|
3589
|
+
const doc = await openFixture$12(engine, opts);
|
|
3590
3590
|
try {
|
|
3591
3591
|
const pon = (await doc.pages.list()).pages[0].pageObjectNumber;
|
|
3592
3592
|
let caught;
|
|
@@ -3595,13 +3595,13 @@ function runPageRotateConformance(runner, opts) {
|
|
|
3595
3595
|
} catch (err) {
|
|
3596
3596
|
caught = err;
|
|
3597
3597
|
}
|
|
3598
|
-
expect(require_fold.EngineError.is(caught,
|
|
3598
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidArg)).toBe(true);
|
|
3599
3599
|
} finally {
|
|
3600
3600
|
await doc.close();
|
|
3601
3601
|
}
|
|
3602
3602
|
});
|
|
3603
3603
|
test("pages.rotate() rejects duplicate PONs with InvalidArg", async () => {
|
|
3604
|
-
const doc = await openFixture$
|
|
3604
|
+
const doc = await openFixture$12(engine, opts);
|
|
3605
3605
|
try {
|
|
3606
3606
|
const pon = (await doc.pages.list()).pages[0].pageObjectNumber;
|
|
3607
3607
|
let caught;
|
|
@@ -3610,13 +3610,13 @@ function runPageRotateConformance(runner, opts) {
|
|
|
3610
3610
|
} catch (err) {
|
|
3611
3611
|
caught = err;
|
|
3612
3612
|
}
|
|
3613
|
-
expect(require_fold.EngineError.is(caught,
|
|
3613
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidArg)).toBe(true);
|
|
3614
3614
|
} finally {
|
|
3615
3615
|
await doc.close();
|
|
3616
3616
|
}
|
|
3617
3617
|
});
|
|
3618
3618
|
test("pages.rotate() rejects unknown PON with NotFound or InvalidArg", async () => {
|
|
3619
|
-
const doc = await openFixture$
|
|
3619
|
+
const doc = await openFixture$12(engine, opts);
|
|
3620
3620
|
try {
|
|
3621
3621
|
const list = await doc.pages.list();
|
|
3622
3622
|
let bogus = 0;
|
|
@@ -3628,13 +3628,13 @@ function runPageRotateConformance(runner, opts) {
|
|
|
3628
3628
|
} catch (err) {
|
|
3629
3629
|
caught = err;
|
|
3630
3630
|
}
|
|
3631
|
-
expect(require_fold.EngineError.is(caught,
|
|
3631
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.NotFound) || require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidArg)).toBe(true);
|
|
3632
3632
|
} finally {
|
|
3633
3633
|
await doc.close();
|
|
3634
3634
|
}
|
|
3635
3635
|
});
|
|
3636
3636
|
test("abort on pages.rotate() rejects with AbortError", async () => {
|
|
3637
|
-
const doc = await openFixture$
|
|
3637
|
+
const doc = await openFixture$12(engine, opts);
|
|
3638
3638
|
try {
|
|
3639
3639
|
const pon = (await doc.pages.list()).pages[0].pageObjectNumber;
|
|
3640
3640
|
const p = doc.pages.rotate([pon], 90);
|
|
@@ -3646,7 +3646,7 @@ function runPageRotateConformance(runner, opts) {
|
|
|
3646
3646
|
});
|
|
3647
3647
|
});
|
|
3648
3648
|
}
|
|
3649
|
-
async function openFixture$
|
|
3649
|
+
async function openFixture$12(engine, opts) {
|
|
3650
3650
|
if (opts.openKind === "bytes") {
|
|
3651
3651
|
const bytes = await opts.fixture.bytes();
|
|
3652
3652
|
return engine.open({
|
|
@@ -3709,7 +3709,7 @@ function runPageDeleteConformance(runner, opts) {
|
|
|
3709
3709
|
if (engine) await engine.destroy();
|
|
3710
3710
|
});
|
|
3711
3711
|
test("pages.delete() removes the page and returns the surviving layout", async () => {
|
|
3712
|
-
const doc = await openFixture$
|
|
3712
|
+
const doc = await openFixture$11(engine, opts);
|
|
3713
3713
|
try {
|
|
3714
3714
|
const before = await doc.pages.list();
|
|
3715
3715
|
if (before.pages.length < 2) return;
|
|
@@ -3730,7 +3730,7 @@ function runPageDeleteConformance(runner, opts) {
|
|
|
3730
3730
|
}
|
|
3731
3731
|
});
|
|
3732
3732
|
test("addressing a deleted page afterwards is a clean NotFound", async () => {
|
|
3733
|
-
const doc = await openFixture$
|
|
3733
|
+
const doc = await openFixture$11(engine, opts);
|
|
3734
3734
|
try {
|
|
3735
3735
|
const before = await doc.pages.list();
|
|
3736
3736
|
if (before.pages.length < 2) return;
|
|
@@ -3742,13 +3742,13 @@ function runPageDeleteConformance(runner, opts) {
|
|
|
3742
3742
|
} catch (err) {
|
|
3743
3743
|
caught = err;
|
|
3744
3744
|
}
|
|
3745
|
-
expect(require_fold.EngineError.is(caught,
|
|
3745
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.NotFound)).toBe(true);
|
|
3746
3746
|
} finally {
|
|
3747
3747
|
await doc.close();
|
|
3748
3748
|
}
|
|
3749
3749
|
});
|
|
3750
3750
|
test("surviving pages keep their weak index-based annotation refs", async () => {
|
|
3751
|
-
const doc = await openFixture$
|
|
3751
|
+
const doc = await openFixture$11(engine, opts);
|
|
3752
3752
|
try {
|
|
3753
3753
|
const list = await doc.pages.list();
|
|
3754
3754
|
if (list.pages.length < 2) return;
|
|
@@ -3781,7 +3781,7 @@ function runPageDeleteConformance(runner, opts) {
|
|
|
3781
3781
|
}
|
|
3782
3782
|
});
|
|
3783
3783
|
test("deleting EVERY page is rejected with InvalidArg", async () => {
|
|
3784
|
-
const doc = await openFixture$
|
|
3784
|
+
const doc = await openFixture$11(engine, opts);
|
|
3785
3785
|
try {
|
|
3786
3786
|
const list = await doc.pages.list();
|
|
3787
3787
|
let caught;
|
|
@@ -3790,13 +3790,13 @@ function runPageDeleteConformance(runner, opts) {
|
|
|
3790
3790
|
} catch (err) {
|
|
3791
3791
|
caught = err;
|
|
3792
3792
|
}
|
|
3793
|
-
expect(require_fold.EngineError.is(caught,
|
|
3793
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidArg)).toBe(true);
|
|
3794
3794
|
} finally {
|
|
3795
3795
|
await doc.close();
|
|
3796
3796
|
}
|
|
3797
3797
|
});
|
|
3798
3798
|
test("pages.delete() rejects duplicate PONs with InvalidArg", async () => {
|
|
3799
|
-
const doc = await openFixture$
|
|
3799
|
+
const doc = await openFixture$11(engine, opts);
|
|
3800
3800
|
try {
|
|
3801
3801
|
const pon = (await doc.pages.list()).pages[0].pageObjectNumber;
|
|
3802
3802
|
let caught;
|
|
@@ -3805,13 +3805,13 @@ function runPageDeleteConformance(runner, opts) {
|
|
|
3805
3805
|
} catch (err) {
|
|
3806
3806
|
caught = err;
|
|
3807
3807
|
}
|
|
3808
|
-
expect(require_fold.EngineError.is(caught,
|
|
3808
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidArg)).toBe(true);
|
|
3809
3809
|
} finally {
|
|
3810
3810
|
await doc.close();
|
|
3811
3811
|
}
|
|
3812
3812
|
});
|
|
3813
3813
|
test("pages.delete() rejects unknown PON with NotFound or InvalidArg", async () => {
|
|
3814
|
-
const doc = await openFixture$
|
|
3814
|
+
const doc = await openFixture$11(engine, opts);
|
|
3815
3815
|
try {
|
|
3816
3816
|
const list = await doc.pages.list();
|
|
3817
3817
|
let bogus = 0;
|
|
@@ -3823,13 +3823,13 @@ function runPageDeleteConformance(runner, opts) {
|
|
|
3823
3823
|
} catch (err) {
|
|
3824
3824
|
caught = err;
|
|
3825
3825
|
}
|
|
3826
|
-
expect(require_fold.EngineError.is(caught,
|
|
3826
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.NotFound) || require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidArg)).toBe(true);
|
|
3827
3827
|
} finally {
|
|
3828
3828
|
await doc.close();
|
|
3829
3829
|
}
|
|
3830
3830
|
});
|
|
3831
3831
|
test("abort on pages.delete() rejects with AbortError", async () => {
|
|
3832
|
-
const doc = await openFixture$
|
|
3832
|
+
const doc = await openFixture$11(engine, opts);
|
|
3833
3833
|
try {
|
|
3834
3834
|
const list = await doc.pages.list();
|
|
3835
3835
|
if (list.pages.length < 2) return;
|
|
@@ -3843,7 +3843,7 @@ function runPageDeleteConformance(runner, opts) {
|
|
|
3843
3843
|
});
|
|
3844
3844
|
});
|
|
3845
3845
|
}
|
|
3846
|
-
async function openFixture$
|
|
3846
|
+
async function openFixture$11(engine, opts) {
|
|
3847
3847
|
if (opts.openKind === "bytes") {
|
|
3848
3848
|
const bytes = await opts.fixture.bytes();
|
|
3849
3849
|
return engine.open({
|
|
@@ -3871,7 +3871,7 @@ function runPageFlattenConformance(runner, opts) {
|
|
|
3871
3871
|
if (engine) await engine.destroy();
|
|
3872
3872
|
});
|
|
3873
3873
|
test("flattens eligible appearances once without changing layout", async () => {
|
|
3874
|
-
const doc = await openFixture$
|
|
3874
|
+
const doc = await openFixture$10(engine, opts);
|
|
3875
3875
|
try {
|
|
3876
3876
|
if (!doc.pages.flatten) return;
|
|
3877
3877
|
const layoutBefore = await doc.pages.list();
|
|
@@ -3898,14 +3898,14 @@ function runPageFlattenConformance(runner, opts) {
|
|
|
3898
3898
|
expect(noOp.meta).toBeNull();
|
|
3899
3899
|
expect(events).toHaveLength(1);
|
|
3900
3900
|
unsubscribe();
|
|
3901
|
-
await expect(doc.pages.flatten([pageObjectNumber, pageObjectNumber])).rejects.toMatchObject({ code:
|
|
3901
|
+
await expect(doc.pages.flatten([pageObjectNumber, pageObjectNumber])).rejects.toMatchObject({ code: require_PageInsertBlankInput.EngineErrorCode.InvalidArg });
|
|
3902
3902
|
} finally {
|
|
3903
3903
|
await doc.close();
|
|
3904
3904
|
}
|
|
3905
3905
|
});
|
|
3906
3906
|
});
|
|
3907
3907
|
}
|
|
3908
|
-
async function openFixture$
|
|
3908
|
+
async function openFixture$10(engine, opts) {
|
|
3909
3909
|
if (opts.openKind === "bytes") return engine.open({
|
|
3910
3910
|
kind: "bytes",
|
|
3911
3911
|
id: opts.fixture.id,
|
|
@@ -3960,7 +3960,7 @@ function runRedactionApplyConformance(runner, opts) {
|
|
|
3960
3960
|
if (engine) await engine.destroy();
|
|
3961
3961
|
});
|
|
3962
3962
|
test("annotations scope applies the marked redaction and counts collateral", async () => {
|
|
3963
|
-
const doc = await openFixture$
|
|
3963
|
+
const doc = await openFixture$9(engine, opts);
|
|
3964
3964
|
try {
|
|
3965
3965
|
if (!doc.redaction) return;
|
|
3966
3966
|
const layoutBefore = await doc.pages.list();
|
|
@@ -4014,7 +4014,7 @@ function runRedactionApplyConformance(runner, opts) {
|
|
|
4014
4014
|
}
|
|
4015
4015
|
});
|
|
4016
4016
|
test("pages scope applies everything once and validates its input", async () => {
|
|
4017
|
-
const doc = await openFixture$
|
|
4017
|
+
const doc = await openFixture$9(engine, opts);
|
|
4018
4018
|
try {
|
|
4019
4019
|
if (!doc.redaction) return;
|
|
4020
4020
|
const pageObjectNumber = (await doc.pages.list()).pages[0].pageObjectNumber;
|
|
@@ -4050,7 +4050,7 @@ function runRedactionApplyConformance(runner, opts) {
|
|
|
4050
4050
|
await expect(doc.redaction.apply({
|
|
4051
4051
|
kind: "pages",
|
|
4052
4052
|
pageObjectNumbers: [pageObjectNumber, pageObjectNumber]
|
|
4053
|
-
})).rejects.toMatchObject({ code:
|
|
4053
|
+
})).rejects.toMatchObject({ code: require_PageInsertBlankInput.EngineErrorCode.InvalidArg });
|
|
4054
4054
|
const notRedact = await page.annotations.create({
|
|
4055
4055
|
subtype: "highlight",
|
|
4056
4056
|
quadPoints: COLLATERAL_QUAD
|
|
@@ -4058,14 +4058,14 @@ function runRedactionApplyConformance(runner, opts) {
|
|
|
4058
4058
|
await expect(doc.redaction.apply({
|
|
4059
4059
|
kind: "annotations",
|
|
4060
4060
|
refs: [notRedact.created.ref]
|
|
4061
|
-
})).rejects.toMatchObject({ code:
|
|
4061
|
+
})).rejects.toMatchObject({ code: require_PageInsertBlankInput.EngineErrorCode.InvalidArg });
|
|
4062
4062
|
} finally {
|
|
4063
4063
|
await doc.close();
|
|
4064
4064
|
}
|
|
4065
4065
|
});
|
|
4066
4066
|
});
|
|
4067
4067
|
}
|
|
4068
|
-
async function openFixture$
|
|
4068
|
+
async function openFixture$9(engine, opts) {
|
|
4069
4069
|
if (opts.openKind === "bytes") return engine.open({
|
|
4070
4070
|
kind: "bytes",
|
|
4071
4071
|
id: opts.fixture.id,
|
|
@@ -4105,19 +4105,14 @@ function runPageExtractConformance(runner, opts) {
|
|
|
4105
4105
|
const { describe, test, beforeAll, afterAll, expect } = runner;
|
|
4106
4106
|
describe(`page extract conformance: ${opts.label}`, () => {
|
|
4107
4107
|
let engine;
|
|
4108
|
-
let supported = false;
|
|
4109
4108
|
beforeAll(async () => {
|
|
4110
4109
|
engine = await opts.makeEngine();
|
|
4111
|
-
const probe = await openFixture$7(engine, opts);
|
|
4112
|
-
supported = probe.pages.extract !== void 0;
|
|
4113
|
-
await probe.close();
|
|
4114
4110
|
});
|
|
4115
4111
|
afterAll(async () => {
|
|
4116
4112
|
if (engine) await engine.destroy();
|
|
4117
4113
|
});
|
|
4118
4114
|
test("pages.extract() returns standalone PDF bytes and leaves the source untouched", async () => {
|
|
4119
|
-
|
|
4120
|
-
const doc = await openFixture$7(engine, opts);
|
|
4115
|
+
const doc = await openFixture$8(engine, opts);
|
|
4121
4116
|
try {
|
|
4122
4117
|
const before = await doc.pages.list();
|
|
4123
4118
|
const target = before.pages[before.pages.length - 1];
|
|
@@ -4132,8 +4127,8 @@ function runPageExtractConformance(runner, opts) {
|
|
|
4132
4127
|
}
|
|
4133
4128
|
});
|
|
4134
4129
|
test("extracted bytes re-open as a document with the requested pages, in caller order", async () => {
|
|
4135
|
-
if (
|
|
4136
|
-
const doc = await openFixture$
|
|
4130
|
+
if (opts.openKind !== "bytes") return;
|
|
4131
|
+
const doc = await openFixture$8(engine, opts);
|
|
4137
4132
|
let extracted = null;
|
|
4138
4133
|
try {
|
|
4139
4134
|
const list = await doc.pages.list();
|
|
@@ -4156,8 +4151,7 @@ function runPageExtractConformance(runner, opts) {
|
|
|
4156
4151
|
}
|
|
4157
4152
|
});
|
|
4158
4153
|
test("pages.extract() rejects empty input with InvalidArg", async () => {
|
|
4159
|
-
|
|
4160
|
-
const doc = await openFixture$7(engine, opts);
|
|
4154
|
+
const doc = await openFixture$8(engine, opts);
|
|
4161
4155
|
try {
|
|
4162
4156
|
let caught;
|
|
4163
4157
|
try {
|
|
@@ -4165,14 +4159,13 @@ function runPageExtractConformance(runner, opts) {
|
|
|
4165
4159
|
} catch (err) {
|
|
4166
4160
|
caught = err;
|
|
4167
4161
|
}
|
|
4168
|
-
expect(require_fold.EngineError.is(caught,
|
|
4162
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidArg)).toBe(true);
|
|
4169
4163
|
} finally {
|
|
4170
4164
|
await doc.close();
|
|
4171
4165
|
}
|
|
4172
4166
|
});
|
|
4173
4167
|
test("pages.extract() rejects duplicate PONs with InvalidArg", async () => {
|
|
4174
|
-
|
|
4175
|
-
const doc = await openFixture$7(engine, opts);
|
|
4168
|
+
const doc = await openFixture$8(engine, opts);
|
|
4176
4169
|
try {
|
|
4177
4170
|
const pon = (await doc.pages.list()).pages[0].pageObjectNumber;
|
|
4178
4171
|
let caught;
|
|
@@ -4181,14 +4174,13 @@ function runPageExtractConformance(runner, opts) {
|
|
|
4181
4174
|
} catch (err) {
|
|
4182
4175
|
caught = err;
|
|
4183
4176
|
}
|
|
4184
|
-
expect(require_fold.EngineError.is(caught,
|
|
4177
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidArg)).toBe(true);
|
|
4185
4178
|
} finally {
|
|
4186
4179
|
await doc.close();
|
|
4187
4180
|
}
|
|
4188
4181
|
});
|
|
4189
4182
|
test("pages.extract() rejects unknown PON with NotFound or InvalidArg", async () => {
|
|
4190
|
-
|
|
4191
|
-
const doc = await openFixture$7(engine, opts);
|
|
4183
|
+
const doc = await openFixture$8(engine, opts);
|
|
4192
4184
|
try {
|
|
4193
4185
|
const list = await doc.pages.list();
|
|
4194
4186
|
let bogus = 0;
|
|
@@ -4200,14 +4192,13 @@ function runPageExtractConformance(runner, opts) {
|
|
|
4200
4192
|
} catch (err) {
|
|
4201
4193
|
caught = err;
|
|
4202
4194
|
}
|
|
4203
|
-
expect(require_fold.EngineError.is(caught,
|
|
4195
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.NotFound) || require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidArg)).toBe(true);
|
|
4204
4196
|
} finally {
|
|
4205
4197
|
await doc.close();
|
|
4206
4198
|
}
|
|
4207
4199
|
});
|
|
4208
4200
|
test("abort on pages.extract() rejects with AbortError", async () => {
|
|
4209
|
-
|
|
4210
|
-
const doc = await openFixture$7(engine, opts);
|
|
4201
|
+
const doc = await openFixture$8(engine, opts);
|
|
4211
4202
|
try {
|
|
4212
4203
|
const list = await doc.pages.list();
|
|
4213
4204
|
const p = doc.pages.extract([list.pages[0].pageObjectNumber]);
|
|
@@ -4219,7 +4210,7 @@ function runPageExtractConformance(runner, opts) {
|
|
|
4219
4210
|
});
|
|
4220
4211
|
});
|
|
4221
4212
|
}
|
|
4222
|
-
async function openFixture$
|
|
4213
|
+
async function openFixture$8(engine, opts) {
|
|
4223
4214
|
if (opts.openKind === "bytes") {
|
|
4224
4215
|
const bytes = await opts.fixture.bytes();
|
|
4225
4216
|
return engine.open({
|
|
@@ -4481,9 +4472,9 @@ function runAttachmentConformance(runner, opts) {
|
|
|
4481
4472
|
//#endregion
|
|
4482
4473
|
//#region src/conformance/runPageInsertConformance.ts
|
|
4483
4474
|
/**
|
|
4484
|
-
* Page insert conformance. `pages.insert
|
|
4485
|
-
*
|
|
4486
|
-
*
|
|
4475
|
+
* Page insert conformance. `pages.insert` is a REQUIRED member — this suite
|
|
4476
|
+
* runs unconditionally on every engine, so an implementation that loses the
|
|
4477
|
+
* verb fails loudly instead of being skipped past.
|
|
4487
4478
|
*
|
|
4488
4479
|
* Invariants:
|
|
4489
4480
|
* 1. Every page of the source bytes is COPIED in at `destIndex` (omitted →
|
|
@@ -4499,19 +4490,14 @@ function runPageInsertConformance(runner, opts) {
|
|
|
4499
4490
|
const { describe, test, beforeAll, afterAll, expect } = runner;
|
|
4500
4491
|
describe(`page insert conformance: ${opts.label}`, () => {
|
|
4501
4492
|
let engine;
|
|
4502
|
-
let supported = false;
|
|
4503
4493
|
beforeAll(async () => {
|
|
4504
4494
|
engine = await opts.makeEngine();
|
|
4505
|
-
const probe = await openFixture$6(engine, opts);
|
|
4506
|
-
supported = probe.pages.insert !== void 0 && probe.pages.extract !== void 0;
|
|
4507
|
-
await probe.close();
|
|
4508
4495
|
});
|
|
4509
4496
|
afterAll(async () => {
|
|
4510
4497
|
if (engine) await engine.destroy();
|
|
4511
4498
|
});
|
|
4512
4499
|
test("appends every source page with fresh PONs; existing pages keep identity", async () => {
|
|
4513
|
-
|
|
4514
|
-
const doc = await openFixture$6(engine, opts);
|
|
4500
|
+
const doc = await openFixture$7(engine, opts);
|
|
4515
4501
|
try {
|
|
4516
4502
|
const before = await doc.pages.list();
|
|
4517
4503
|
const beforePons = before.pages.map((p) => p.pageObjectNumber);
|
|
@@ -4529,8 +4515,7 @@ function runPageInsertConformance(runner, opts) {
|
|
|
4529
4515
|
}
|
|
4530
4516
|
});
|
|
4531
4517
|
test("destIndex places the block mid-document, in source order", async () => {
|
|
4532
|
-
|
|
4533
|
-
const doc = await openFixture$6(engine, opts);
|
|
4518
|
+
const doc = await openFixture$7(engine, opts);
|
|
4534
4519
|
try {
|
|
4535
4520
|
const before = await doc.pages.list();
|
|
4536
4521
|
if (before.pages.length < 2) return;
|
|
@@ -4547,8 +4532,8 @@ function runPageInsertConformance(runner, opts) {
|
|
|
4547
4532
|
}
|
|
4548
4533
|
});
|
|
4549
4534
|
test("the inserted pages persist through save → re-open", async () => {
|
|
4550
|
-
if (
|
|
4551
|
-
const doc = await openFixture$
|
|
4535
|
+
if (opts.openKind !== "bytes") return;
|
|
4536
|
+
const doc = await openFixture$7(engine, opts);
|
|
4552
4537
|
let reopened = null;
|
|
4553
4538
|
try {
|
|
4554
4539
|
const before = await doc.pages.list();
|
|
@@ -4568,8 +4553,7 @@ function runPageInsertConformance(runner, opts) {
|
|
|
4568
4553
|
}
|
|
4569
4554
|
});
|
|
4570
4555
|
test("empty bytes reject with InvalidArg; garbage rejects with MalformedPdf", async () => {
|
|
4571
|
-
|
|
4572
|
-
const doc = await openFixture$6(engine, opts);
|
|
4556
|
+
const doc = await openFixture$7(engine, opts);
|
|
4573
4557
|
try {
|
|
4574
4558
|
let caught;
|
|
4575
4559
|
try {
|
|
@@ -4577,14 +4561,14 @@ function runPageInsertConformance(runner, opts) {
|
|
|
4577
4561
|
} catch (err) {
|
|
4578
4562
|
caught = err;
|
|
4579
4563
|
}
|
|
4580
|
-
expect(require_fold.EngineError.is(caught,
|
|
4564
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidArg)).toBe(true);
|
|
4581
4565
|
caught = void 0;
|
|
4582
4566
|
try {
|
|
4583
4567
|
await doc.pages.insert(new TextEncoder().encode("not a pdf at all"));
|
|
4584
4568
|
} catch (err) {
|
|
4585
4569
|
caught = err;
|
|
4586
4570
|
}
|
|
4587
|
-
expect(require_fold.EngineError.is(caught,
|
|
4571
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.MalformedPdf)).toBe(true);
|
|
4588
4572
|
const list = await doc.pages.list();
|
|
4589
4573
|
expect(list.pageCount > 0).toBe(true);
|
|
4590
4574
|
} finally {
|
|
@@ -4592,8 +4576,7 @@ function runPageInsertConformance(runner, opts) {
|
|
|
4592
4576
|
}
|
|
4593
4577
|
});
|
|
4594
4578
|
test("out-of-range destIndex rejects with InvalidArg", async () => {
|
|
4595
|
-
|
|
4596
|
-
const doc = await openFixture$6(engine, opts);
|
|
4579
|
+
const doc = await openFixture$7(engine, opts);
|
|
4597
4580
|
try {
|
|
4598
4581
|
const before = await doc.pages.list();
|
|
4599
4582
|
const single = await doc.pages.extract([before.pages[0].pageObjectNumber]);
|
|
@@ -4603,7 +4586,160 @@ function runPageInsertConformance(runner, opts) {
|
|
|
4603
4586
|
} catch (err) {
|
|
4604
4587
|
caught = err;
|
|
4605
4588
|
}
|
|
4606
|
-
expect(require_fold.EngineError.is(caught,
|
|
4589
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidArg)).toBe(true);
|
|
4590
|
+
} finally {
|
|
4591
|
+
await doc.close();
|
|
4592
|
+
}
|
|
4593
|
+
});
|
|
4594
|
+
});
|
|
4595
|
+
}
|
|
4596
|
+
async function openFixture$7(engine, opts) {
|
|
4597
|
+
if (opts.openKind === "bytes") {
|
|
4598
|
+
const bytes = await opts.fixture.bytes();
|
|
4599
|
+
return engine.open({
|
|
4600
|
+
kind: "bytes",
|
|
4601
|
+
id: opts.fixture.id,
|
|
4602
|
+
bytes
|
|
4603
|
+
});
|
|
4604
|
+
}
|
|
4605
|
+
return engine.open({
|
|
4606
|
+
kind: "id",
|
|
4607
|
+
id: opts.fixture.cloudId ?? opts.fixture.id
|
|
4608
|
+
});
|
|
4609
|
+
}
|
|
4610
|
+
//#endregion
|
|
4611
|
+
//#region src/conformance/runPageInsertBlankConformance.ts
|
|
4612
|
+
/** An on-purpose non-default size so the assertions can't pass by accident. */
|
|
4613
|
+
const SIZE = {
|
|
4614
|
+
width: 396,
|
|
4615
|
+
height: 612
|
|
4616
|
+
};
|
|
4617
|
+
/**
|
|
4618
|
+
* Blank-page insert conformance. `pages.insertBlank` is a REQUIRED member —
|
|
4619
|
+
* the suite runs unconditionally on every engine (no fixture bytes are
|
|
4620
|
+
* needed at all, which is the point of the verb), so an implementation that
|
|
4621
|
+
* loses the verb fails loudly instead of being skipped past.
|
|
4622
|
+
*
|
|
4623
|
+
* Invariants:
|
|
4624
|
+
* 1. `count` blank pages of exactly `size` appear at `destIndex` (omitted
|
|
4625
|
+
* → append), rotation 0; the result lists their fresh PONs in insertion
|
|
4626
|
+
* order and they agree with the returned layout.
|
|
4627
|
+
* 2. Pre-existing pages keep their identity: same PONs before and after,
|
|
4628
|
+
* in the expected positions (an insert never invalidates neighbours).
|
|
4629
|
+
* 3. The mutation persists through save → re-open (bytes engines only).
|
|
4630
|
+
* 4. Non-positive size / count outside [1, PAGE_INSERT_BLANK_MAX_COUNT] /
|
|
4631
|
+
* out-of-range destIndex reject with InvalidArg, leaving the document
|
|
4632
|
+
* untouched.
|
|
4633
|
+
*/
|
|
4634
|
+
function runPageInsertBlankConformance(runner, opts) {
|
|
4635
|
+
const { describe, test, beforeAll, afterAll, expect } = runner;
|
|
4636
|
+
describe(`page insert-blank conformance: ${opts.label}`, () => {
|
|
4637
|
+
let engine;
|
|
4638
|
+
beforeAll(async () => {
|
|
4639
|
+
engine = await opts.makeEngine();
|
|
4640
|
+
});
|
|
4641
|
+
afterAll(async () => {
|
|
4642
|
+
if (engine) await engine.destroy();
|
|
4643
|
+
});
|
|
4644
|
+
test("appends one blank page of the requested size with a fresh PON", async () => {
|
|
4645
|
+
const doc = await openFixture$6(engine, opts);
|
|
4646
|
+
try {
|
|
4647
|
+
const before = await doc.pages.list();
|
|
4648
|
+
const beforePons = before.pages.map((p) => p.pageObjectNumber);
|
|
4649
|
+
const result = await doc.pages.insertBlank({ size: SIZE });
|
|
4650
|
+
expect(result.insertedPageObjectNumbers.length).toBe(1);
|
|
4651
|
+
expect(result.layout.pageCount).toBe(before.pageCount + 1);
|
|
4652
|
+
expect(result.layout.pages.slice(0, before.pageCount).map((p) => p.pageObjectNumber)).toEqual(beforePons);
|
|
4653
|
+
const newPon = result.insertedPageObjectNumbers[0];
|
|
4654
|
+
expect(beforePons.includes(newPon)).toBe(false);
|
|
4655
|
+
const appended = result.layout.pages[before.pageCount];
|
|
4656
|
+
expect(appended.pageObjectNumber).toBe(newPon);
|
|
4657
|
+
expect(appended.size).toEqual(SIZE);
|
|
4658
|
+
expect(appended.rotation).toBe(0);
|
|
4659
|
+
} finally {
|
|
4660
|
+
await doc.close();
|
|
4661
|
+
}
|
|
4662
|
+
});
|
|
4663
|
+
test("destIndex + count places the blank block mid-document", async () => {
|
|
4664
|
+
const doc = await openFixture$6(engine, opts);
|
|
4665
|
+
try {
|
|
4666
|
+
const before = await doc.pages.list();
|
|
4667
|
+
if (before.pages.length < 2) return;
|
|
4668
|
+
const beforePons = before.pages.map((p) => p.pageObjectNumber);
|
|
4669
|
+
const result = await doc.pages.insertBlank({
|
|
4670
|
+
size: SIZE,
|
|
4671
|
+
count: 2
|
|
4672
|
+
}, 1);
|
|
4673
|
+
expect(result.insertedPageObjectNumbers.length).toBe(2);
|
|
4674
|
+
expect(result.insertedPageObjectNumbers[0] === result.insertedPageObjectNumbers[1]).toBe(false);
|
|
4675
|
+
const pons = result.layout.pages.map((p) => p.pageObjectNumber);
|
|
4676
|
+
expect(pons[0]).toBe(beforePons[0]);
|
|
4677
|
+
expect(pons.slice(1, 3)).toEqual(result.insertedPageObjectNumbers);
|
|
4678
|
+
expect(pons.slice(3)).toEqual(beforePons.slice(1));
|
|
4679
|
+
expect(result.layout.pages[1].size).toEqual(SIZE);
|
|
4680
|
+
expect(result.layout.pages[2].size).toEqual(SIZE);
|
|
4681
|
+
} finally {
|
|
4682
|
+
await doc.close();
|
|
4683
|
+
}
|
|
4684
|
+
});
|
|
4685
|
+
test("the blank pages persist through save → re-open", async () => {
|
|
4686
|
+
if (opts.openKind !== "bytes") return;
|
|
4687
|
+
const doc = await openFixture$6(engine, opts);
|
|
4688
|
+
let reopened = null;
|
|
4689
|
+
try {
|
|
4690
|
+
const before = await doc.pages.list();
|
|
4691
|
+
await doc.pages.insertBlank({ size: SIZE });
|
|
4692
|
+
const bytes = await doc.download();
|
|
4693
|
+
reopened = await engine.open({
|
|
4694
|
+
kind: "bytes",
|
|
4695
|
+
id: `${opts.fixture.id}-insert-blank-reopen`,
|
|
4696
|
+
bytes
|
|
4697
|
+
});
|
|
4698
|
+
const after = await reopened.pages.list();
|
|
4699
|
+
expect(after.pageCount).toBe(before.pageCount + 1);
|
|
4700
|
+
const tail = after.pages[after.pageCount - 1];
|
|
4701
|
+
expect(Math.round(tail.size.width)).toBe(SIZE.width);
|
|
4702
|
+
expect(Math.round(tail.size.height)).toBe(SIZE.height);
|
|
4703
|
+
} finally {
|
|
4704
|
+
if (reopened) await reopened.close();
|
|
4705
|
+
await doc.close();
|
|
4706
|
+
}
|
|
4707
|
+
});
|
|
4708
|
+
test("non-positive size, bad count, and out-of-range destIndex reject with InvalidArg", async () => {
|
|
4709
|
+
const doc = await openFixture$6(engine, opts);
|
|
4710
|
+
try {
|
|
4711
|
+
const before = await doc.pages.list();
|
|
4712
|
+
const rejects = [
|
|
4713
|
+
() => doc.pages.insertBlank({ size: {
|
|
4714
|
+
width: 0,
|
|
4715
|
+
height: 612
|
|
4716
|
+
} }),
|
|
4717
|
+
() => doc.pages.insertBlank({ size: {
|
|
4718
|
+
width: 396,
|
|
4719
|
+
height: -10
|
|
4720
|
+
} }),
|
|
4721
|
+
() => doc.pages.insertBlank({
|
|
4722
|
+
size: SIZE,
|
|
4723
|
+
count: 0
|
|
4724
|
+
}),
|
|
4725
|
+
() => doc.pages.insertBlank({
|
|
4726
|
+
size: SIZE,
|
|
4727
|
+
count: 101
|
|
4728
|
+
}),
|
|
4729
|
+
() => doc.pages.insertBlank({ size: SIZE }, before.pageCount + 1)
|
|
4730
|
+
];
|
|
4731
|
+
for (const attempt of rejects) {
|
|
4732
|
+
let caught;
|
|
4733
|
+
try {
|
|
4734
|
+
await attempt();
|
|
4735
|
+
} catch (err) {
|
|
4736
|
+
caught = err;
|
|
4737
|
+
}
|
|
4738
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidArg)).toBe(true);
|
|
4739
|
+
}
|
|
4740
|
+
const list = await doc.pages.list();
|
|
4741
|
+
expect(list.pageCount).toBe(before.pageCount);
|
|
4742
|
+
expect(list.pages.map((p) => p.pageObjectNumber)).toEqual(before.pages.map((p) => p.pageObjectNumber));
|
|
4607
4743
|
} finally {
|
|
4608
4744
|
await doc.close();
|
|
4609
4745
|
}
|
|
@@ -4917,6 +5053,28 @@ function runDocumentEventsConformance(runner, opts) {
|
|
|
4917
5053
|
await doc.close();
|
|
4918
5054
|
}
|
|
4919
5055
|
});
|
|
5056
|
+
test("pages.inserted rides verbatim", async () => {
|
|
5057
|
+
const doc = await openFixture$4(engine, opts);
|
|
5058
|
+
try {
|
|
5059
|
+
const events = [];
|
|
5060
|
+
doc.events.subscribe((event) => events.push(event));
|
|
5061
|
+
const inserted = await doc.pages.insertBlank({ size: {
|
|
5062
|
+
width: 396,
|
|
5063
|
+
height: 612
|
|
5064
|
+
} }, 0);
|
|
5065
|
+
expect(events.map((event) => event.type)).toEqual(["pages.inserted"]);
|
|
5066
|
+
const [evInserted] = events;
|
|
5067
|
+
if (evInserted.type === "pages.inserted") {
|
|
5068
|
+
expect(evInserted.insertedPageObjectNumbers).toEqual(inserted.insertedPageObjectNumbers);
|
|
5069
|
+
expect(evInserted.layout).toEqual(inserted.layout);
|
|
5070
|
+
expect(evInserted.cache).toEqual(inserted.cache);
|
|
5071
|
+
expect(evInserted.destIndex).toBe(0);
|
|
5072
|
+
expect(evInserted.origin.kind).toBe("local");
|
|
5073
|
+
}
|
|
5074
|
+
} finally {
|
|
5075
|
+
await doc.close();
|
|
5076
|
+
}
|
|
5077
|
+
});
|
|
4920
5078
|
test("a FAILED mutation publishes nothing (events are ground truth)", async () => {
|
|
4921
5079
|
const doc = await openFixture$4(engine, opts);
|
|
4922
5080
|
try {
|
|
@@ -5005,7 +5163,7 @@ function runPageTextConformance(runner, opts) {
|
|
|
5005
5163
|
caught = err;
|
|
5006
5164
|
}
|
|
5007
5165
|
expect(caught).toBeTruthy();
|
|
5008
|
-
expect(require_fold.EngineError.is(caught,
|
|
5166
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.NotFound)).toBe(true);
|
|
5009
5167
|
} finally {
|
|
5010
5168
|
await doc.close();
|
|
5011
5169
|
}
|
|
@@ -5031,7 +5189,7 @@ function runPageTextConformance(runner, opts) {
|
|
|
5031
5189
|
caught = err;
|
|
5032
5190
|
}
|
|
5033
5191
|
expect(caught).toBeTruthy();
|
|
5034
|
-
expect(require_fold.EngineError.is(caught,
|
|
5192
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.DocNotOpen)).toBe(true);
|
|
5035
5193
|
});
|
|
5036
5194
|
});
|
|
5037
5195
|
}
|
|
@@ -5080,8 +5238,8 @@ function runTextDivergenceConformance(runner, opts) {
|
|
|
5080
5238
|
const doc = await openFixture$2(engine, opts);
|
|
5081
5239
|
try {
|
|
5082
5240
|
const snap = await doc.page(fixture.pageObjectNumber).text.read();
|
|
5083
|
-
expect(
|
|
5084
|
-
for (const s of fixture.slices ?? []) expect(
|
|
5241
|
+
expect(require_PageInsertBlankInput.sliceTextByChars(snap, 0, snap.charCount)).toBe(snap.text);
|
|
5242
|
+
for (const s of fixture.slices ?? []) expect(require_PageInsertBlankInput.sliceTextByChars(snap, s.from, s.to)).toBe(s.text);
|
|
5085
5243
|
} finally {
|
|
5086
5244
|
await doc.close();
|
|
5087
5245
|
}
|
|
@@ -5100,7 +5258,7 @@ function runTextDivergenceConformance(runner, opts) {
|
|
|
5100
5258
|
expect(hit.charCount).toBe(probe.charCount);
|
|
5101
5259
|
expect(hit.segments.length > 0).toBe(true);
|
|
5102
5260
|
const snap = await doc.page(fixture.pageObjectNumber).text.read();
|
|
5103
|
-
expect(
|
|
5261
|
+
expect(require_PageInsertBlankInput.sliceTextByChars(snap, hit.charStart, hit.charStart + hit.charCount)).toBe(probe.matchedText);
|
|
5104
5262
|
} finally {
|
|
5105
5263
|
await doc.close();
|
|
5106
5264
|
}
|
|
@@ -5524,7 +5682,7 @@ function runSearchConformance(runner, opts) {
|
|
|
5524
5682
|
} catch (err) {
|
|
5525
5683
|
caught = err;
|
|
5526
5684
|
}
|
|
5527
|
-
expect(require_fold.EngineError.is(caught,
|
|
5685
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidArg)).toBe(true);
|
|
5528
5686
|
} finally {
|
|
5529
5687
|
await doc.close();
|
|
5530
5688
|
}
|
|
@@ -5541,7 +5699,7 @@ function runSearchConformance(runner, opts) {
|
|
|
5541
5699
|
} catch (err) {
|
|
5542
5700
|
caught = err;
|
|
5543
5701
|
}
|
|
5544
|
-
expect(require_fold.EngineError.is(caught,
|
|
5702
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidArg)).toBe(true);
|
|
5545
5703
|
} finally {
|
|
5546
5704
|
await doc.close();
|
|
5547
5705
|
}
|
|
@@ -5597,7 +5755,7 @@ function runSearchConformance(runner, opts) {
|
|
|
5597
5755
|
} catch (err) {
|
|
5598
5756
|
caught = err;
|
|
5599
5757
|
}
|
|
5600
|
-
expect(require_fold.EngineError.is(caught,
|
|
5758
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidArg)).toBe(true);
|
|
5601
5759
|
} finally {
|
|
5602
5760
|
await doc.close();
|
|
5603
5761
|
}
|
|
@@ -5619,7 +5777,7 @@ function runSearchConformance(runner, opts) {
|
|
|
5619
5777
|
} catch (err) {
|
|
5620
5778
|
caught = err;
|
|
5621
5779
|
}
|
|
5622
|
-
expect(require_fold.EngineError.is(caught,
|
|
5780
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.InvalidArg)).toBe(true);
|
|
5623
5781
|
}
|
|
5624
5782
|
} finally {
|
|
5625
5783
|
await doc.close();
|
|
@@ -5654,7 +5812,7 @@ function runSearchConformance(runner, opts) {
|
|
|
5654
5812
|
} catch (err) {
|
|
5655
5813
|
caught = err;
|
|
5656
5814
|
}
|
|
5657
|
-
expect(require_fold.EngineError.is(caught,
|
|
5815
|
+
expect(require_fold.EngineError.is(caught, require_PageInsertBlankInput.EngineErrorCode.DocNotOpen)).toBe(true);
|
|
5658
5816
|
});
|
|
5659
5817
|
});
|
|
5660
5818
|
}
|
|
@@ -5736,6 +5894,7 @@ exports.runPageDeleteConformance = runPageDeleteConformance;
|
|
|
5736
5894
|
exports.runPageExtractConformance = runPageExtractConformance;
|
|
5737
5895
|
exports.runPageFlattenConformance = runPageFlattenConformance;
|
|
5738
5896
|
exports.runPageGeometryOrientationConformance = runPageGeometryOrientationConformance;
|
|
5897
|
+
exports.runPageInsertBlankConformance = runPageInsertBlankConformance;
|
|
5739
5898
|
exports.runPageInsertConformance = runPageInsertConformance;
|
|
5740
5899
|
exports.runPageReorderConformance = runPageReorderConformance;
|
|
5741
5900
|
exports.runPageRotateConformance = runPageRotateConformance;
|