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:
parent
41a75b1423
commit
e8ad6c9d13
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -114,6 +114,7 @@
|
|||||||
!bug1065245.pdf
|
!bug1065245.pdf
|
||||||
!bug1151216.pdf
|
!bug1151216.pdf
|
||||||
!bug1175962.pdf
|
!bug1175962.pdf
|
||||||
|
!bug1020226.pdf
|
||||||
!basicapi.pdf
|
!basicapi.pdf
|
||||||
!mixedfonts.pdf
|
!mixedfonts.pdf
|
||||||
!shading_extend.pdf
|
!shading_extend.pdf
|
||||||
|
24
test/pdfs/bug1020226.pdf
Normal file
24
test/pdfs/bug1020226.pdf
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
%PDF-1.4
|
||||||
|
1 0 obj
|
||||||
|
<<
|
||||||
|
/Pages 2 0 R
|
||||||
|
2 0 obj
|
||||||
|
<<
|
||||||
|
/Resources
|
||||||
|
>>
|
||||||
|
/Contents 811 0 R
|
||||||
|
811 0 obj
|
||||||
|
<<
|
||||||
|
/Length 17863
|
||||||
|
>>
|
||||||
|
stream
|
||||||
|
BI
|
||||||
|
/W 62
|
||||||
|
/H 62
|
||||||
|
/D[1
|
||||||
|
0]
|
||||||
|
/F/CCFŠ/DP<</K -1
|
||||||
|
trailer
|
||||||
|
<<
|
||||||
|
/Root 1 0 R
|
||||||
|
>>
|
@ -1,7 +1,8 @@
|
|||||||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||||
/* globals PDFJS, expect, it, describe, Promise, combineUrl, waitsFor,
|
/* globals PDFJS, expect, it, describe, Promise, combineUrl, waitsFor,
|
||||||
MissingPDFException, StreamType, FontType, PDFPageProxy */
|
InvalidPDFException, MissingPDFException, StreamType, FontType,
|
||||||
|
PDFPageProxy */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
@ -79,6 +80,15 @@ describe('api', function() {
|
|||||||
expect(true).toEqual(true);
|
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() {
|
it('creates pdf doc from non-existent URL', function() {
|
||||||
var nonExistentUrl = combineUrl(window.location.href,
|
var nonExistentUrl = combineUrl(window.location.href,
|
||||||
'../pdfs/non-existent.pdf');
|
'../pdfs/non-existent.pdf');
|
||||||
|
Loading…
Reference in New Issue
Block a user