Browse Source

Enable regression testing for interactive forms

Tim van der Meij 9 years ago
parent
commit
e281ce7c73
  1. 11
      test/annotation_layer_test.css
  2. 11
      test/driver.js
  3. 8
      test/test_manifest.json

11
test/annotation_layer_test.css

@ -43,6 +43,17 @@
position: absolute; position: absolute;
} }
.annotationLayer .textWidgetAnnotation input {
background-color: rgba(0, 54, 255, 0.13);
border: 1px solid transparent;
box-sizing: border-box;
font-size: 9px;
height: 100%;
padding: 0 3px;
vertical-align: top;
width: 100%;
}
.annotationLayer .popupAnnotation { .annotationLayer .popupAnnotation {
display: block !important; display: block !important;
} }

11
test/driver.js

@ -161,7 +161,8 @@ var rasterizeAnnotationLayer = (function rasterizeAnnotationLayerClosure() {
return imagePromises; return imagePromises;
} }
function rasterizeAnnotationLayer(ctx, viewport, annotations, page) { function rasterizeAnnotationLayer(ctx, viewport, annotations, page,
renderInteractiveForms) {
return new Promise(function (resolve) { return new Promise(function (resolve) {
// Building SVG with size of the viewport. // Building SVG with size of the viewport.
var svg = document.createElementNS(SVG_NS, 'svg:svg'); var svg = document.createElementNS(SVG_NS, 'svg:svg');
@ -190,7 +191,8 @@ var rasterizeAnnotationLayer = (function rasterizeAnnotationLayerClosure() {
div: div, div: div,
annotations: annotations, annotations: annotations,
page: page, page: page,
linkService: new LinkServiceMock() linkService: new LinkServiceMock(),
renderInteractiveForms: renderInteractiveForms,
}; };
PDFJS.AnnotationLayer.render(parameters); PDFJS.AnnotationLayer.render(parameters);
@ -483,7 +485,7 @@ var Driver = (function DriverClosure() {
textLayerCanvas = null; textLayerCanvas = null;
// Render the annotation layer if necessary. // Render the annotation layer if necessary.
if (task.annotations) { if (task.annotations || task.forms) {
// Create a dummy canvas for the drawing operations. // Create a dummy canvas for the drawing operations.
annotationLayerCanvas = self.annotationLayerCanvas; annotationLayerCanvas = self.annotationLayerCanvas;
if (!annotationLayerCanvas) { if (!annotationLayerCanvas) {
@ -501,9 +503,10 @@ var Driver = (function DriverClosure() {
initPromise = initPromise =
page.getAnnotations({ intent: 'display' }).then( page.getAnnotations({ intent: 'display' }).then(
function(annotations) { function(annotations) {
var forms = task.forms || false;
return rasterizeAnnotationLayer(annotationLayerContext, return rasterizeAnnotationLayer(annotationLayerContext,
viewport, annotations, viewport, annotations,
page); page, forms);
}); });
} else { } else {
annotationLayerCanvas = null; annotationLayerCanvas = null;

8
test/test_manifest.json

@ -732,6 +732,14 @@
"rounds": 1, "rounds": 1,
"type": "load" "type": "load"
}, },
{ "id": "f1040-forms",
"file": "pdfs/f1040.pdf",
"md5": "7323b50c6d28d959b8b4b92c469b2469",
"link": true,
"rounds": 1,
"type": "eq",
"forms": true
},
{ "id": "bug1046314", { "id": "bug1046314",
"file": "pdfs/bug1046314.pdf", "file": "pdfs/bug1046314.pdf",
"md5": "fc658439f44cd2dd27c8bee7e7a8344e", "md5": "fc658439f44cd2dd27c8bee7e7a8344e",

Loading…
Cancel
Save