mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Respect maxCanvasPixels
when computing canvas dimensions
Ensure that we never round the canvas dimensions above `maxCanvasPixels` by rounding them to the preceeding multiple of the display ratio rather than the succeeding one.
This commit is contained in:
parent
12692d2e39
commit
de23bb9b82
3 changed files with 20 additions and 15 deletions
|
@ -279,12 +279,13 @@ describe("PDF viewer", () => {
|
|||
.withContext(`In ${browserName}`)
|
||||
.toBeLessThan(originalCanvasSize * factor ** 2);
|
||||
|
||||
// Disabled because `canvasSize` is `4_012_800`, which is
|
||||
// close to the limit but somehow a bit more.
|
||||
//
|
||||
// expect(canvasSize)
|
||||
// .withContext(`In ${browserName}, MAX_CANVAS_PIXELS`)
|
||||
// .toBeLessThan(MAX_CANVAS_PIXELS.get(browserName));
|
||||
expect(canvasSize)
|
||||
.withContext(`In ${browserName}, <= MAX_CANVAS_PIXELS`)
|
||||
.toBeLessThanOrEqual(MAX_CANVAS_PIXELS.get(browserName));
|
||||
|
||||
expect(canvasSize)
|
||||
.withContext(`In ${browserName}, > MAX_CANVAS_PIXELS * 0.99`)
|
||||
.toBeGreaterThan(MAX_CANVAS_PIXELS.get(browserName) * 0.99);
|
||||
})
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue