1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Merge pull request #16433 from calixteman/bug1825002

For text widgets, get the text from the AP stream instead of from the format callback (bug 1825002)
This commit is contained in:
calixteman 2023-05-17 16:48:59 +02:00 committed by GitHub
commit 839be801a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 93 additions and 35 deletions

View file

@ -1897,4 +1897,70 @@ describe("Interaction", () => {
);
});
});
describe("in bug1825002.pdf", () => {
let pages;
beforeAll(async () => {
pages = await loadAndWait("bug1825002.pdf", getSelector("23R"));
});
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]) => {
await page.waitForFunction(
"window.PDFViewerApplication.scriptingReady === true"
);
let text = await page.$eval(getSelector("23R"), el => el.value);
expect(text)
.withContext(`In ${browserName}`)
.toEqual("ABCDEFGHIJKLMN");
await page.click(getSelector("23R"));
await page.waitForFunction(
`${getQuerySelector("23R")}.value !== "ABCDEFGHIJKLMN"`
);
text = await page.$eval(getSelector("23R"), el => el.value);
expect(text).withContext(`In ${browserName}`).toEqual("123,45.7A");
})
);
});
it("must check that a field is empty", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await page.waitForFunction(
"window.PDFViewerApplication.scriptingReady === true"
);
let text = await page.$eval(getSelector("26R"), el => el.value);
expect(text).withContext(`In ${browserName}`).toEqual("");
await page.click(getSelector("26R"));
await page.type(getSelector("26R"), "abcde", { delay: 10 });
await page.click(getSelector("23R"));
await page.waitForTimeout(10);
await page.click(getSelector("26R"));
await page.keyboard.down("Control");
await page.keyboard.press("A");
await page.keyboard.up("Control");
await page.keyboard.press("Backspace");
await page.click(getSelector("23R"));
await page.waitForTimeout(10);
text = await page.$eval(getSelector("26R"), el => el.value);
expect(text).withContext(`In ${browserName}`).toEqual("");
})
);
});
});
});

View file

@ -591,3 +591,4 @@
!issue16316.pdf
!issue14565.pdf
!multiline.pdf
!bug1825002.pdf

BIN
test/pdfs/bug1825002.pdf Executable file

Binary file not shown.