mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 09:38:06 +02:00
[Editor] Set the canvas in the stamp editor at the right position in odd spread mode
This commit is contained in:
parent
4c041586fb
commit
acf8600a3d
3 changed files with 52 additions and 0 deletions
|
@ -751,4 +751,48 @@ describe("Stamp Editor", () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Add a stamp in odd spread mode", () => {
|
||||
let pages;
|
||||
|
||||
beforeAll(async () => {
|
||||
pages = await loadAndWait(
|
||||
"empty.pdf",
|
||||
".annotationEditorLayer",
|
||||
null,
|
||||
null,
|
||||
{
|
||||
spreadModeOnLoad: 1,
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await closePages(pages);
|
||||
});
|
||||
|
||||
it("must check that the stamp has its canvas at the right position", async () => {
|
||||
await Promise.all(
|
||||
pages.map(async ([browserName, page]) => {
|
||||
await switchToStamp(page);
|
||||
|
||||
await copyImage(page, "../images/firefox_logo.png", 0);
|
||||
await page.waitForSelector(getEditorSelector(0));
|
||||
await waitForSerialized(page, 1);
|
||||
|
||||
const canvasRect = await getRect(
|
||||
page,
|
||||
`${getEditorSelector(0)} canvas`
|
||||
);
|
||||
const stampRect = await getRect(page, getEditorSelector(0));
|
||||
|
||||
expect(
|
||||
["x", "y", "width", "height"].every(
|
||||
key => Math.abs(canvasRect[key] - stampRect[key]) <= 10
|
||||
)
|
||||
).toBeTrue();
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue