Skip to content

Commit ac8757f

Browse files
committed
Add regression test for negative LW normalization in gs operator
Ensure that negative “LW” entries in an ExtGState dictionary are converted to their absolute values when the “gs” operator is processed. See PR #19639
1 parent bfc2025 commit ac8757f

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/unit/evaluator_spec.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,4 +423,30 @@ describe("evaluator", function () {
423423
expect(operatorList.length).toEqual(0);
424424
});
425425
});
426+
427+
describe("graphics-state operators", function () {
428+
it("should convert negative line width to absolute value in the graphic state", async function () {
429+
const gState = new Dict();
430+
gState.set("LW", -5);
431+
const extGState = new Dict();
432+
extGState.set("GSneg", gState);
433+
434+
const resources = new ResourcesMock();
435+
resources.ExtGState = extGState;
436+
437+
const stream = new StringStream("/GSneg gs");
438+
const result = await runOperatorListCheck(
439+
partialEvaluator,
440+
stream,
441+
resources
442+
);
443+
444+
expect(result.fnArray).toEqual([OPS.setGState]);
445+
446+
const stateEntries = result.argsArray[0][0];
447+
const lwEntry = stateEntries.find(([key]) => key === "LW");
448+
expect(lwEntry).toBeDefined();
449+
expect(lwEntry[1]).toEqual(5);
450+
});
451+
});
426452
});

0 commit comments

Comments
 (0)