1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Ensure that the isUsingOwnCanvas-parameter is consistently included in operatorLists (PR 14247 follow-up)

Currently some `OPS.beginAnnotation` arguments will contain a `Number` value for the `isUsingOwnCanvas`-parameter, or in some cases an `undefined` value, which is inconsistent from an API perspective.
This commit is contained in:
Jonas Jenwald 2022-07-28 13:37:37 +02:00
parent b06d190451
commit 2fb083f3e2
2 changed files with 22 additions and 2 deletions

View file

@ -2506,6 +2506,12 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
expect(opListAnnotEnable.argsArray.length).toBeGreaterThan(140);
expect(opListAnnotEnable.lastChunk).toEqual(true);
let firstAnnotIndex = opListAnnotEnable.fnArray.indexOf(
OPS.beginAnnotation
);
let isUsingOwnCanvas = opListAnnotEnable.argsArray[firstAnnotIndex][4];
expect(isUsingOwnCanvas).toEqual(false);
const opListAnnotEnableForms = await pdfPage.getOperatorList({
annotationMode: AnnotationMode.ENABLE_FORMS,
});
@ -2513,6 +2519,12 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
expect(opListAnnotEnableForms.argsArray.length).toBeGreaterThan(30);
expect(opListAnnotEnableForms.lastChunk).toEqual(true);
firstAnnotIndex = opListAnnotEnableForms.fnArray.indexOf(
OPS.beginAnnotation
);
isUsingOwnCanvas = opListAnnotEnableForms.argsArray[firstAnnotIndex][4];
expect(isUsingOwnCanvas).toEqual(true);
const opListAnnotEnableStorage = await pdfPage.getOperatorList({
annotationMode: AnnotationMode.ENABLE_STORAGE,
});
@ -2520,6 +2532,12 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
expect(opListAnnotEnableStorage.argsArray.length).toBeGreaterThan(170);
expect(opListAnnotEnableStorage.lastChunk).toEqual(true);
firstAnnotIndex = opListAnnotEnableStorage.fnArray.indexOf(
OPS.beginAnnotation
);
isUsingOwnCanvas = opListAnnotEnableStorage.argsArray[firstAnnotIndex][4];
expect(isUsingOwnCanvas).toEqual(false);
// Sanity check to ensure that the `annotationMode` is correctly applied.
expect(opListAnnotDisable.fnArray.length).toBeLessThan(
opListAnnotEnableForms.fnArray.length