mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +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:
parent
f6965fadc0
commit
adf0972ca5
6 changed files with 45 additions and 12 deletions
|
@ -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;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue