mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
[Editor] Avoid to have a selected stamp annotation on top of the secondary toolbar (bug 1911980)
This commit is contained in:
parent
3902a148e2
commit
ec01af6b38
5 changed files with 50 additions and 3 deletions
|
@ -47,6 +47,7 @@ import {
|
|||
import { fileURLToPath } from "url";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { PNG } from "pngjs";
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
|
@ -1235,4 +1236,49 @@ describe("Stamp Editor", () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("A stamp musn't be on top of the secondary toolbar", () => {
|
||||
let pages;
|
||||
|
||||
beforeAll(async () => {
|
||||
pages = await loadAndWait("empty.pdf", ".annotationEditorLayer", 600);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await closePages(pages);
|
||||
});
|
||||
|
||||
it("must check that a stamp editor isn't on top of the secondary toolbar", async () => {
|
||||
// Run sequentially to avoid clipboard issues.
|
||||
const editorSelector = getEditorSelector(0);
|
||||
|
||||
for (const [, page] of pages) {
|
||||
await switchToStamp(page);
|
||||
|
||||
await copyImage(page, "../images/red.png", 0);
|
||||
|
||||
await page.waitForSelector(editorSelector);
|
||||
await waitForSerialized(page, 1);
|
||||
}
|
||||
|
||||
await Promise.all(
|
||||
pages.map(async ([browserName, page]) => {
|
||||
const debug = false;
|
||||
|
||||
await page.click("#secondaryToolbarToggleButton");
|
||||
await page.waitForSelector("#secondaryToolbar", { visible: true });
|
||||
const secondary = await page.$("#secondaryToolbar");
|
||||
const png = await secondary.screenshot({
|
||||
type: "png",
|
||||
path: debug ? `foo.png` : "",
|
||||
});
|
||||
const secondaryImage = PNG.sync.read(Buffer.from(png));
|
||||
const buffer = new Uint32Array(secondaryImage.data.buffer);
|
||||
expect(buffer.every(x => x === 0xff0000ff))
|
||||
.withContext(`In ${browserName}`)
|
||||
.toBeFalse();
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue