|
|
|
@ -1,7 +1,8 @@
@@ -1,7 +1,8 @@
|
|
|
|
|
/* globals expect, it, describe, Dict, Name, Annotation, AnnotationBorderStyle, |
|
|
|
|
AnnotationBorderStyleType, AnnotationType, AnnotationFlag, PDFJS, |
|
|
|
|
beforeEach, afterEach, stringToBytes, AnnotationFactory, Ref, isRef, |
|
|
|
|
beforeAll, afterAll, AnnotationFieldFlag */ |
|
|
|
|
beforeAll, afterAll, AnnotationFieldFlag, stringToUTF8String, |
|
|
|
|
StringStream, Lexer, Parser */ |
|
|
|
|
|
|
|
|
|
'use strict'; |
|
|
|
|
|
|
|
|
@ -302,6 +303,38 @@ describe('Annotation layer', function() {
@@ -302,6 +303,38 @@ describe('Annotation layer', function() {
|
|
|
|
|
expect(data.dest).toBeUndefined(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('should correctly parse a URI action, where the URI entry ' + |
|
|
|
|
'has an incorrect encoding (bug 1122280)', function () { |
|
|
|
|
var actionStream = new StringStream( |
|
|
|
|
'<<\n' + |
|
|
|
|
'/Type /Action\n' + |
|
|
|
|
'/S /URI\n' + |
|
|
|
|
'/URI (http://www.example.com/\\303\\274\\303\\266\\303\\244)\n' + |
|
|
|
|
'>>\n' |
|
|
|
|
); |
|
|
|
|
var lexer = new Lexer(actionStream); |
|
|
|
|
var parser = new Parser(lexer); |
|
|
|
|
var actionDict = parser.getObj(); |
|
|
|
|
|
|
|
|
|
var annotationDict = new Dict(); |
|
|
|
|
annotationDict.set('Type', Name.get('Annot')); |
|
|
|
|
annotationDict.set('Subtype', Name.get('Link')); |
|
|
|
|
annotationDict.set('A', actionDict); |
|
|
|
|
|
|
|
|
|
var annotationRef = new Ref(8, 0); |
|
|
|
|
var xref = new XRefMock([ |
|
|
|
|
{ ref: annotationRef, data: annotationDict, } |
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
var annotation = annotationFactory.create(xref, annotationRef); |
|
|
|
|
var data = annotation.data; |
|
|
|
|
expect(data.annotationType).toEqual(AnnotationType.LINK); |
|
|
|
|
|
|
|
|
|
expect(data.url).toEqual( |
|
|
|
|
stringToUTF8String('http://www.example.com/üöä')); |
|
|
|
|
expect(data.dest).toBeUndefined(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('should correctly parse a GoTo action', function() { |
|
|
|
|
var actionDict = new Dict(); |
|
|
|
|
actionDict.set('Type', Name.get('Action')); |
|
|
|
|