Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement reference testing for printing #12230

Merged
merged 2 commits into from
Aug 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion test/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,8 @@ var Driver = (function DriverClosure() {

// Initialize various `eq` test subtypes, see comment below.
var renderAnnotations = false,
renderForms = false;
renderForms = false,
renderPrint = false;

var textLayerCanvas, annotationLayerCanvas;
var initPromise;
Expand Down Expand Up @@ -559,6 +560,7 @@ var Driver = (function DriverClosure() {
// accidentally changing the behaviour for other types of tests.
renderAnnotations = !!task.annotations;
renderForms = !!task.forms;
renderPrint = !!task.print;

// Render the annotation layer if necessary.
if (renderAnnotations || renderForms) {
Expand Down Expand Up @@ -604,6 +606,19 @@ var Driver = (function DriverClosure() {
viewport,
renderInteractiveForms: renderForms,
};
if (renderPrint) {
const annotationStorage = task.annotationStorage;
if (annotationStorage) {
const docAnnotationStorage = task.pdfDoc.annotationStorage;
const entries = Object.entries(annotationStorage);
for (const [key, value] of entries) {
docAnnotationStorage.setValue(key, value);
}
renderContext.annotationStorage = docAnnotationStorage;
}
renderContext.intent = "print";
}

var completeRender = function (error) {
// if text layer is present, compose it on top of the page
if (textLayerCanvas) {
Expand Down
48 changes: 48 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4448,6 +4448,22 @@
"type": "eq",
"forms": true
},
{ "id": "annotation-text-widget-print",
"file": "pdfs/annotation-text-widget.pdf",
"md5": "b7b8923a12998fca8603fae53f73f19b",
"rounds": 1,
"type": "eq",
"print": true,
"annotationStorage": {
"61R": "Single line, unlimited length",
"62R": "Single lin",
"63R": "Single line, center aligned",
"64R": "Single line, right aligned",
"65R": "",
"66R": "zyxwvutsrqponmlkjihgfedcba",
"67R": "Multiline\nstring"
}
},
{ "id": "annotation-choice-widget-annotations",
"file": "pdfs/annotation-choice-widget.pdf",
"md5": "7dfb0d743a0da0f4a71b209ab43b0be5",
Expand All @@ -4462,6 +4478,20 @@
"type": "eq",
"forms": true
},
{ "id": "annotation-choice-widget-print",
"file": "pdfs/annotation-choice-widget.pdf",
"md5": "7dfb0d743a0da0f4a71b209ab43b0be5",
"rounds": 1,
"type": "eq",
"print": true,
"annotationStorage": {
"57R": "Ipsum",
"58R": "Lorem",
"59R": "Dolor",
"62R": "Sit",
"63R": ""
}
},
{ "id": "issue11931",
"file": "pdfs/issue11931.pdf",
"md5": "9ea233037992e1f10280420a49e72845",
Expand All @@ -4488,6 +4518,24 @@
"type": "eq",
"forms": true
},
{ "id": "annotation-button-widget-print",
"file": "pdfs/annotation-button-widget.pdf",
"md5": "5cf23adfff84256d9cfe261bea96dade",
"rounds": 1,
"type": "eq",
"print": true,
"annotationStorage": {
"105R": true,
"106R": false,
"107R": false,
"108R": true,
"109R": false,
"110R": false,
"111R": true,
"112R": false,
"113R": false
}
},
{ "id": "annotation-polyline-polygon",
"file": "pdfs/annotation-polyline-polygon.pdf",
"md5": "e68611602f58c8ca70cc40575ba3b04e",
Expand Down