test: drop PDF tests (#2744)

We fully rely on upstream PDF functionality. Our PDF tests are inferior
to those upstream and inconvenient to write.
This commit is contained in:
Andrey Lushnikov
2018-06-14 16:42:10 -07:00
committed by GitHub
parent 861f070738
commit c430138845
3 changed files with 1 additions and 101 deletions

View File

@@ -81,37 +81,4 @@ const utils = module.exports = {
waitEvent: function(emitter, eventName) {
return new Promise(fulfill => emitter.once(eventName, fulfill));
},
/**
* @param {!Buffer} pdfBuffer
* @return {!Promise<!Array<!Object>>}
*/
getPDFPages: async function(pdfBuffer) {
const PDFJS = require('pdfjs-dist');
PDFJS.disableWorker = true;
const data = new Uint8Array(pdfBuffer);
const doc = await PDFJS.getDocument(data);
const pages = [];
for (let i = 0; i < doc.numPages; ++i) {
const page = await doc.getPage(i + 1);
const viewport = page.getViewport(1);
// Viewport width and height is in PDF points, which is
// 1/72 of an inch.
pages.push({
width: viewport.width / 72,
height: viewport.height / 72,
});
page.cleanup();
}
doc.cleanup();
return pages;
},
/**
* @param {number} px
* @return {number}
*/
cssPixelsToInches: function(px) {
return px / 96;
},
};