From 13e44c07762fd69b36d9e73432d7648d75eb46ad Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 4 Aug 2020 22:31:24 +0200 Subject: [PATCH] Attempt to reduce intermittent failures in the "multiple render() on the same canvas" unit-test This patch should *hopefully* remove the intermittent unit-test failure, by using the *same* `optionalContentConfigPromise` for both `renderTask`s and thus get more predictable timing behaviour. --- test/unit/api_spec.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/unit/api_spec.js b/test/unit/api_spec.js index ee66e0c5c..75c14813c 100644 --- a/test/unit/api_spec.js +++ b/test/unit/api_spec.js @@ -1826,6 +1826,8 @@ describe("api", function () { }); it("multiple render() on the same canvas", function (done) { + const optionalContentConfigPromise = pdfDocument.getOptionalContentConfig(); + var viewport = page.getViewport({ scale: 1 }); var canvasAndCtx = CanvasFactory.create(viewport.width, viewport.height); @@ -1833,11 +1835,13 @@ describe("api", function () { canvasContext: canvasAndCtx.context, canvasFactory: CanvasFactory, viewport, + optionalContentConfigPromise, }); var renderTask2 = page.render({ canvasContext: canvasAndCtx.context, canvasFactory: CanvasFactory, viewport, + optionalContentConfigPromise, }); Promise.all([