mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-11 04:31:08 +02:00
Merge pull request #21361 from timvandermeij/is-canvas-monochrome
Fix intermittent failure in the "must check that a freetext is still here after having updated it and scroll the doc" freetext editor integration test
This commit is contained in:
commit
27b345a61e
@ -3204,16 +3204,13 @@ describe("FreeText Editor", () => {
|
||||
.toEqual("Hello World and edited in Firefox");
|
||||
|
||||
// Check that the canvas has nothing drawn at the annotation position.
|
||||
await page.$eval(selector, el => (el.hidden = true));
|
||||
let editorPng = await page.screenshot({
|
||||
clip: editorRect,
|
||||
type: "png",
|
||||
});
|
||||
await page.$eval(selector, el => (el.hidden = false));
|
||||
let editorImage = PNG.sync.read(Buffer.from(editorPng));
|
||||
expect(editorImage.data.every(x => x === 0xff))
|
||||
.withContext(`In ${browserName}`)
|
||||
.toBeTrue();
|
||||
let isWhite = await isCanvasMonochrome(
|
||||
page,
|
||||
1,
|
||||
editorRect,
|
||||
0xffffffff
|
||||
);
|
||||
expect(isWhite).withContext(`In ${browserName}`).toBeTrue();
|
||||
|
||||
const oneToThirteen = Array.from(new Array(13).keys(), n => n + 2);
|
||||
for (const pageNumber of oneToThirteen) {
|
||||
@ -3253,14 +3250,8 @@ describe("FreeText Editor", () => {
|
||||
|
||||
await awaitPromise(handlePromise);
|
||||
|
||||
editorPng = await page.screenshot({
|
||||
clip: editorRect,
|
||||
type: "png",
|
||||
});
|
||||
editorImage = PNG.sync.read(Buffer.from(editorPng));
|
||||
expect(editorImage.data.every(x => x === 0xff))
|
||||
.withContext(`In ${browserName}`)
|
||||
.toBeFalse();
|
||||
isWhite = await isCanvasMonochrome(page, 1, editorRect, 0xffffffff);
|
||||
expect(isWhite).withContext(`In ${browserName}`).toBeFalse();
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user