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

Merge pull request #16551 from Snuffleupagus/page-destroyed-complete

Ensure that `cleanup` during rendering is actually ignored, to prevent a blank canvas
This commit is contained in:
Jonas Jenwald 2023-06-15 12:26:57 +02:00 committed by GitHub
commit 877884029d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -3203,6 +3203,7 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
const renderTask = pdfPage.render({
canvasContext: canvasAndCtx.context,
viewport,
background: "#FF0000", // See comment below.
});
expect(renderTask instanceof RenderTask).toEqual(true);
@ -3225,6 +3226,11 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
await renderTask.promise;
expect(renderTask.separateAnnots).toEqual(false);
// Use the red background-color to, more easily, tell that the page was
// actually rendered successfully.
const { data } = canvasAndCtx.context.getImageData(0, 0, 1, 1);
expect(data).toEqual(new Uint8ClampedArray([255, 0, 0, 255]));
CanvasFactory.destroy(canvasAndCtx);
await loadingTask.destroy();
});