mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Text annotations must use their own canvas when their appearance is generated (bug 1844576)
When a pdf has /NeedAppearances set to true, the annotation appearance must be generated from its value and we must take into account the hasOwnCanvas property.
This commit is contained in:
parent
2a508b95e1
commit
9277801493
4 changed files with 68 additions and 2 deletions
|
@ -1963,4 +1963,65 @@ describe("Interaction", () => {
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("in bug1844576.pdf", () => {
|
||||
let pages;
|
||||
|
||||
beforeAll(async () => {
|
||||
pages = await loadAndWait("bug1844576.pdf", getSelector("9R"));
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await closePages(pages);
|
||||
});
|
||||
|
||||
it("must check that a field has the correct formatted value", async () => {
|
||||
await Promise.all(
|
||||
pages.map(async ([browserName, page]) => {
|
||||
const hasVisibleCanvas = await page.evaluate(_ => {
|
||||
const elem = document.querySelector(
|
||||
`[data-annotation-id="9R"] > canvas`
|
||||
);
|
||||
return elem && !elem.hasAttribute("hidden");
|
||||
});
|
||||
expect(hasVisibleCanvas)
|
||||
.withContext(`In ${browserName}`)
|
||||
.toEqual(true);
|
||||
|
||||
const hasHiddenInput = await page.evaluate(_ => {
|
||||
const elem = document.querySelector(
|
||||
`[data-annotation-id="9R"] > input`
|
||||
);
|
||||
return elem?.hasAttribute("hidden");
|
||||
});
|
||||
|
||||
expect(hasHiddenInput).withContext(`In ${browserName}`).toEqual(true);
|
||||
|
||||
await page.click(getSelector("12R"));
|
||||
await page.waitForTimeout(10);
|
||||
|
||||
const hasHiddenCanvas = await page.evaluate(_ => {
|
||||
const elem = document.querySelector(
|
||||
`[data-annotation-id="9R"] > canvas`
|
||||
);
|
||||
return elem?.hasAttribute("hidden");
|
||||
});
|
||||
expect(hasHiddenCanvas)
|
||||
.withContext(`In ${browserName}`)
|
||||
.toEqual(true);
|
||||
|
||||
const hasVisibleInput = await page.evaluate(_ => {
|
||||
const elem = document.querySelector(
|
||||
`[data-annotation-id="9R"] > input`
|
||||
);
|
||||
return elem && !elem.hasAttribute("hidden");
|
||||
});
|
||||
|
||||
expect(hasVisibleInput)
|
||||
.withContext(`In ${browserName}`)
|
||||
.toEqual(true);
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
|
@ -604,3 +604,4 @@
|
|||
!empty.pdf
|
||||
!rotated_freetexts.pdf
|
||||
!issue16633.pdf
|
||||
!bug1844576.pdf
|
||||
|
|
BIN
test/pdfs/bug1844576.pdf
Executable file
BIN
test/pdfs/bug1844576.pdf
Executable file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue