1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Add a unit-test for bug 1020226

For reference, see PR 4902 and https://bugzilla.mozilla.org/show_bug.cgi?id=1020226.
This commit is contained in:
Jonas Jenwald 2015-10-02 18:04:08 +02:00
parent 41a75b1423
commit e8ad6c9d13
3 changed files with 36 additions and 1 deletions

View file

@ -1,7 +1,8 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* globals PDFJS, expect, it, describe, Promise, combineUrl, waitsFor,
MissingPDFException, StreamType, FontType, PDFPageProxy */
InvalidPDFException, MissingPDFException, StreamType, FontType,
PDFPageProxy */
'use strict';
@ -79,6 +80,15 @@ describe('api', function() {
expect(true).toEqual(true);
});
});
it('creates pdf doc from invalid PDF file', function() {
// A severely corrupt PDF file (even Adobe Reader fails to open it).
var url = combineUrl(window.location.href, '../pdfs/bug1020226.pdf');
var promise = PDFJS.getDocument(url);
waitsForPromiseRejected(promise, function (error) {
expect(error instanceof InvalidPDFException).toEqual(true);
});
});
it('creates pdf doc from non-existent URL', function() {
var nonExistentUrl = combineUrl(window.location.href,
'../pdfs/non-existent.pdf');