Add a unit-test for annotations where the URI
action has an incorrect encoding (bug 1122280, PR 5999)
This commit is contained in:
parent
1564dc311a
commit
93830032ac
@ -1,7 +1,8 @@
|
|||||||
/* globals expect, it, describe, Dict, Name, Annotation, AnnotationBorderStyle,
|
/* globals expect, it, describe, Dict, Name, Annotation, AnnotationBorderStyle,
|
||||||
AnnotationBorderStyleType, AnnotationType, AnnotationFlag, PDFJS,
|
AnnotationBorderStyleType, AnnotationType, AnnotationFlag, PDFJS,
|
||||||
beforeEach, afterEach, stringToBytes, AnnotationFactory, Ref, isRef,
|
beforeEach, afterEach, stringToBytes, AnnotationFactory, Ref, isRef,
|
||||||
beforeAll, afterAll, AnnotationFieldFlag */
|
beforeAll, afterAll, AnnotationFieldFlag, stringToUTF8String,
|
||||||
|
StringStream, Lexer, Parser */
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
@ -302,6 +303,38 @@ describe('Annotation layer', function() {
|
|||||||
expect(data.dest).toBeUndefined();
|
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() {
|
it('should correctly parse a GoTo action', function() {
|
||||||
var actionDict = new Dict();
|
var actionDict = new Dict();
|
||||||
actionDict.set('Type', Name.get('Action'));
|
actionDict.set('Type', Name.get('Action'));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user