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

Text widget annotations: improve unit and reference tests

This patch improves the unit tests by testing the support for read-only
and multiline fields. Moreover, we add a reference test to ensure that
the text widgets are not only rendered, but also that their contents are
styled properly.

Finally, we perform minor improvements in `src/core/annotation.js`, for
example adding missing comments.
This commit is contained in:
Tim van der Meij 2016-09-14 21:51:21 +02:00
parent f6965fadc0
commit adf0972ca5
6 changed files with 45 additions and 12 deletions

View file

@ -66,6 +66,8 @@ AnnotationFactory.prototype = /** @lends AnnotationFactory.prototype */ {
/**
* @param {XRef} xref
* @param {Object} ref
* @param {string} uniquePrefix
* @param {Object} idCounters
* @returns {Annotation}
*/
create: function AnnotationFactory_create(xref, ref,
@ -717,20 +719,19 @@ var TextWidgetAnnotation = (function TextWidgetAnnotationClosure() {
return Annotation.prototype.getOperatorList.call(this, evaluator, task);
}
var opList = new OperatorList();
var data = this.data;
var operatorList = new OperatorList();
// Even if there is an appearance stream, ignore it. This is the
// behaviour used by Adobe Reader.
if (!data.defaultAppearance) {
return Promise.resolve(opList);
if (!this.data.defaultAppearance) {
return Promise.resolve(operatorList);
}
var stream = new Stream(stringToBytes(data.defaultAppearance));
return evaluator.getOperatorList(stream, task,
this.fieldResources, opList).
var stream = new Stream(stringToBytes(this.data.defaultAppearance));
return evaluator.getOperatorList(stream, task, this.fieldResources,
operatorList).
then(function () {
return opList;
return operatorList;
});
}
});