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

Use the SimpleLinkService when running "annotations" reference tests

Rather than (basically) duplicating the `SimpleLinkService` in `test/driver.js`, with potential test failuires if you forget to update the test mock, it seems much nicer to just re-use the viewer component.

Note that `SimpleLinkService` is already bundled into the `build/components/pdf_viewer.js` file. Hence we only need to expose it similar to the other viewer components in that file, and make sure that the `gulp components` command runs as part of the test-setup.
This commit is contained in:
Jonas Jenwald 2017-09-12 14:29:23 +02:00
parent f2618eb2e4
commit 1ebbdc253a
4 changed files with 9 additions and 42 deletions

View file

@ -21,41 +21,6 @@ var PDF_TO_CSS_UNITS = 96.0 / 72.0;
var StatTimer = pdfjsDistBuildPdf.StatTimer;
/**
* @class
*/
var LinkServiceMock = (function LinkServiceMockClosure() {
function LinkServiceMock() {}
LinkServiceMock.prototype = {
get page() {
return 0;
},
set page(value) {},
navigateTo(dest) {},
getDestinationHash(dest) {
return '#';
},
getAnchorUrl(hash) {
return '#';
},
setHash(hash) {},
executeNamedAction(action) {},
onFileAttachmentAnnotation(params) {},
cachePageRef(pageNum, pageRef) {},
};
return LinkServiceMock;
})();
/**
* @class
*/
@ -230,7 +195,7 @@ var rasterizeAnnotationLayer = (function rasterizeAnnotationLayerClosure() {
div,
annotations,
page,
linkService: new LinkServiceMock(),
linkService: new PDFJS.SimpleLinkService(),
renderInteractiveForms,
};
PDFJS.AnnotationLayer.render(parameters);

View file

@ -19,6 +19,7 @@ limitations under the License.
<title>PDF.js test slave</title>
<meta charset="utf-8">
<script src="../build/generic/build/pdf.js"></script>
<script src="../build/components/pdf_viewer.js"></script>
<script src="driver.js"></script>
</head>
<body>