1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-21 15:48:06 +02:00

Merge pull request #9576 from timvandermeij/versions

Update packages
This commit is contained in:
Tim van der Meij 2018-03-25 17:52:26 +02:00 committed by GitHub
commit 6cc0efe1cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 61 additions and 37 deletions

View file

@ -76,9 +76,9 @@ function initializePDFJS(callback) {
},
});
var catchingExceptions = queryString.getParam('catch');
env.catchExceptions(typeof catchingExceptions === 'undefined' ?
true : catchingExceptions);
var stoppingOnSpecFailure = queryString.getParam('failFast');
env.stopOnSpecFailure(typeof stoppingOnSpecFailure === 'undefined' ?
false : stoppingOnSpecFailure);
var throwingExpectationFailures = queryString.getParam('throwFailures');
env.throwOnExpectationFailure(throwingExpectationFailures);
@ -94,8 +94,9 @@ function initializePDFJS(callback) {
// Reporters
var htmlReporter = new jasmine.HtmlReporter({
env,
onRaiseExceptionsClick() {
queryString.navigateWithNewParam('catch', !env.catchingExceptions());
onStopExecutionClick() {
queryString.navigateWithNewParam('failFast',
env.stoppingOnSpecFailure());
},
onThrowExpectationsClick() {
queryString.navigateWithNewParam('throwFailures',

View file

@ -318,11 +318,11 @@ describe('api', function() {
});
describe('PDFWorker', function() {
if (isNodeJS()) {
pending('Worker is not supported in Node.js.');
}
it('worker created or destroyed', function (done) {
if (isNodeJS()) {
pending('Worker is not supported in Node.js.');
}
var worker = new PDFWorker({ name: 'test1', });
worker.promise.then(function () {
expect(worker.name).toEqual('test1');
@ -340,6 +340,10 @@ describe('api', function() {
});
});
it('worker created or destroyed by getDocument', function (done) {
if (isNodeJS()) {
pending('Worker is not supported in Node.js.');
}
var loadingTask = getDocument(basicApiGetDocumentParams);
var worker;
loadingTask.promise.then(function () {
@ -360,6 +364,10 @@ describe('api', function() {
});
});
it('worker created and can be used in getDocument', function (done) {
if (isNodeJS()) {
pending('Worker is not supported in Node.js.');
}
var worker = new PDFWorker({ name: 'test1', });
var loadingTask = getDocument(
buildGetDocumentParams(basicApiFileName, {
@ -385,6 +393,10 @@ describe('api', function() {
});
});
it('creates more than one worker', function (done) {
if (isNodeJS()) {
pending('Worker is not supported in Node.js.');
}
var worker1 = new PDFWorker({ name: 'test1', });
var worker2 = new PDFWorker({ name: 'test2', });
var worker3 = new PDFWorker({ name: 'test3', });
@ -403,6 +415,10 @@ describe('api', function() {
});
});
it('gets current workerSrc', function() {
if (isNodeJS()) {
pending('Worker is not supported in Node.js.');
}
let workerSrc = PDFWorker.getWorkerSrc();
expect(typeof workerSrc).toEqual('string');
expect(workerSrc).toEqual(GlobalWorkerOptions.workerSrc);
@ -1198,10 +1214,7 @@ describe('api', function() {
]).then(done);
});
});
describe('Multiple PDFJS instances', function() {
if (isNodeJS()) {
pending('TODO: Support Canvas testing in Node.js.');
}
describe('Multiple `getDocument` instances', function() {
// Regression test for https://github.com/mozilla/pdf.js/issues/6205
// A PDF using the Helvetica font.
var pdf1 = buildGetDocumentParams('tracemonkey.pdf');
@ -1255,6 +1268,10 @@ describe('api', function() {
});
it('should correctly render PDFs in parallel', function(done) {
if (isNodeJS()) {
pending('TODO: Support Canvas testing in Node.js.');
}
var baseline1, baseline2, baseline3;
var promiseDone = renderPDF(pdf1).then(function(data1) {
baseline1 = data1;
@ -1283,12 +1300,9 @@ describe('api', function() {
});
});
describe('PDFDataRangeTransport', function () {
if (isNodeJS()) {
pending('XMLHttpRequest is not supported in Node.js.');
}
var pdfPath = new URL('../pdfs/tracemonkey.pdf', window.location).href;
var loadPromise;
function getDocumentData() {
const pdfPath = new URL('../pdfs/tracemonkey.pdf', window.location).href;
if (loadPromise) {
return loadPromise;
}
@ -1307,6 +1321,10 @@ describe('api', function() {
return loadPromise;
}
it('should fetch document info and page using ranges', function (done) {
if (isNodeJS()) {
pending('XMLHttpRequest is not supported in Node.js.');
}
var transport;
var initialDataLength = 4000;
var fetches = 0;
@ -1341,6 +1359,10 @@ describe('api', function() {
});
it('should fetch document info and page using range and streaming',
function (done) {
if (isNodeJS()) {
pending('XMLHttpRequest is not supported in Node.js.');
}
var transport;
var initialDataLength = 4000;
var fetches = 0;

View file

@ -83,7 +83,7 @@ describe('evaluator', function() {
});
});
it('should handle one operations', function(done) {
it('should handle one operation', function(done) {
var stream = new StringStream('Q');
runOperatorListCheck(partialEvaluator, stream, new ResourcesMock(),
function(result) {
@ -108,7 +108,7 @@ describe('evaluator', function() {
});
});
it('should handle tree glued operations', function(done) {
it('should handle three glued operations', function(done) {
var stream = new StringStream('fff');
runOperatorListCheck(partialEvaluator, stream, new ResourcesMock(),
function (result) {

View file

@ -124,9 +124,9 @@ function initializePDFJS(callback) {
},
});
var catchingExceptions = queryString.getParam('catch');
env.catchExceptions(typeof catchingExceptions === 'undefined' ?
true : catchingExceptions);
var stoppingOnSpecFailure = queryString.getParam('failFast');
env.stopOnSpecFailure(typeof stoppingOnSpecFailure === 'undefined' ?
false : stoppingOnSpecFailure);
var throwingExpectationFailures = queryString.getParam('throwFailures');
env.throwOnExpectationFailure(throwingExpectationFailures);
@ -142,8 +142,9 @@ function initializePDFJS(callback) {
// Reporters
var htmlReporter = new jasmine.HtmlReporter({
env,
onRaiseExceptionsClick() {
queryString.navigateWithNewParam('catch', !env.catchingExceptions());
onStopExecutionClick() {
queryString.navigateWithNewParam('failFast',
env.stoppingOnSpecFailure());
},
onThrowExpectationsClick() {
queryString.navigateWithNewParam('throwFailures',