1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

Don't print hidden annotatons (bug 1815196)

and handle correctly the NoView and NoPrint flags when they're changed
from JS.
This commit is contained in:
Calixte Denizet 2023-07-30 15:52:27 +02:00
parent 0e6d141edf
commit 71960bea64
9 changed files with 124 additions and 18 deletions

View file

@ -2042,4 +2042,60 @@ describe("Interaction", () => {
);
});
});
describe("in annotation_hidden_noview.pdf", () => {
let pages;
beforeAll(async () => {
pages = await loadAndWait(
"annotation_hidden_noview.pdf",
getSelector("11R")
);
});
afterAll(async () => {
await closePages(pages);
});
it("must check that invisible fields are made visible", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await page.waitForFunction(
"window.PDFViewerApplication.scriptingReady === true"
);
let visibility = await page.$eval(
getSelector("7R"),
el => getComputedStyle(el).visibility
);
expect(visibility).withContext(`In ${browserName}`).toEqual("hidden");
visibility = await page.$eval(
getSelector("8R"),
el => getComputedStyle(el).visibility
);
expect(visibility).withContext(`In ${browserName}`).toEqual("hidden");
await page.click(getSelector("11R"));
await page.waitForTimeout(10);
visibility = await page.$eval(
getSelector("7R"),
el => getComputedStyle(el).visibility
);
expect(visibility)
.withContext(`In ${browserName}`)
.toEqual("visible");
visibility = await page.$eval(
getSelector("8R"),
el => getComputedStyle(el).visibility
);
expect(visibility)
.withContext(`In ${browserName}`)
.toEqual("visible");
})
);
});
});
});

View file

@ -606,3 +606,6 @@
!issue16633.pdf
!bug1844576.pdf
!bug1844583.pdf
!annotation_hidden_print.pdf
!annotation_hidden_noview.pdf
!widget_hidden_print.pdf

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -3420,7 +3420,7 @@
"print": true,
"annotationStorage": {
"427R": {
"hidden": false,
"noPrint": false,
"value": "hello world"
}
}
@ -8054,5 +8054,21 @@
"rotation": 0
}
}
},
{
"id": "widget_hidden_print",
"file": "pdfs/widget_hidden_print.pdf",
"md5": "0b8d5a8e8c7c7598232a79044c312cbb",
"rounds": 1,
"type": "eq",
"print": true
},
{
"id": "annotation_hidden_print",
"file": "pdfs/annotation_hidden_print.pdf",
"md5": "5cfa86df9b080feeb4aa320ad68d6cbd",
"rounds": 1,
"type": "eq",
"print": true
}
]