mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-29 15:47:57 +02:00
Rotate annotations based on the MK::R value (bug 1675139)
- it aims to fix: https://bugzilla.mozilla.org/show_bug.cgi?id=1675139; - An annotation can be rotated (counterclockwise); - the rotation can be set in using JS.
This commit is contained in:
parent
54777b42c2
commit
cdc58b7a52
10 changed files with 562 additions and 78 deletions
|
@ -1401,4 +1401,47 @@ describe("Interaction", () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("in bug1675139.pdf", () => {
|
||||
let pages;
|
||||
|
||||
beforeAll(async () => {
|
||||
pages = await loadAndWait("bug1675139.pdf", getSelector("48R"));
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await closePages(pages);
|
||||
});
|
||||
|
||||
it("must check that data-annotation-rotation is correc", async () => {
|
||||
await Promise.all(
|
||||
pages.map(async ([browserName, page]) => {
|
||||
await page.waitForFunction(
|
||||
"window.PDFViewerApplication.scriptingReady === true"
|
||||
);
|
||||
|
||||
let base = 0;
|
||||
|
||||
while (base !== 360) {
|
||||
for (const [ref, angle] of [
|
||||
[47, 0],
|
||||
[42, 90],
|
||||
[45, 180],
|
||||
[46, 270],
|
||||
]) {
|
||||
const rotation = await page.$eval(
|
||||
`[data-annotation-id='${ref}R']`,
|
||||
el => parseInt(el.getAttribute("data-annotation-rotation") || 0)
|
||||
);
|
||||
expect(rotation)
|
||||
.withContext(`In ${browserName}`)
|
||||
.toEqual((360 + ((360 - (base + angle)) % 360)) % 360);
|
||||
}
|
||||
base += 90;
|
||||
await page.click(getSelector("48R"));
|
||||
}
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue