Use the same kind of strings for radio values
This commit is contained in:
parent
558d3870d3
commit
d51e7e86ff
@ -1760,7 +1760,7 @@ class ButtonWidgetAnnotation extends WidgetAnnotation {
|
|||||||
}
|
}
|
||||||
for (const key of normalAppearance.getKeys()) {
|
for (const key of normalAppearance.getKeys()) {
|
||||||
if (key !== "Off") {
|
if (key !== "Off") {
|
||||||
this.data.buttonValue = key;
|
this.data.buttonValue = this._decodeFormValue(key);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2133,6 +2133,40 @@ describe("annotation", function () {
|
|||||||
}, done.fail);
|
}, done.fail);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should handle radio buttons with a field value not an ascii string", function (done) {
|
||||||
|
const parentDict = new Dict();
|
||||||
|
parentDict.set("V", Name.get("\x91I=\x91\xf0\x93\xe0\x97e3"));
|
||||||
|
|
||||||
|
const normalAppearanceStateDict = new Dict();
|
||||||
|
normalAppearanceStateDict.set("\x91I=\x91\xf0\x93\xe0\x97e3", null);
|
||||||
|
|
||||||
|
const appearanceStatesDict = new Dict();
|
||||||
|
appearanceStatesDict.set("N", normalAppearanceStateDict);
|
||||||
|
|
||||||
|
buttonWidgetDict.set("Ff", AnnotationFieldFlag.RADIO);
|
||||||
|
buttonWidgetDict.set("Parent", parentDict);
|
||||||
|
buttonWidgetDict.set("AP", appearanceStatesDict);
|
||||||
|
|
||||||
|
const buttonWidgetRef = Ref.get(124, 0);
|
||||||
|
const xref = new XRefMock([
|
||||||
|
{ ref: buttonWidgetRef, data: buttonWidgetDict },
|
||||||
|
]);
|
||||||
|
|
||||||
|
AnnotationFactory.create(
|
||||||
|
xref,
|
||||||
|
buttonWidgetRef,
|
||||||
|
pdfManagerMock,
|
||||||
|
idFactoryMock
|
||||||
|
).then(({ data }) => {
|
||||||
|
expect(data.annotationType).toEqual(AnnotationType.WIDGET);
|
||||||
|
expect(data.checkBox).toEqual(false);
|
||||||
|
expect(data.radioButton).toEqual(true);
|
||||||
|
expect(data.fieldValue).toEqual("‚I=‚ðfiàŠe3");
|
||||||
|
expect(data.buttonValue).toEqual("‚I=‚ðfiàŠe3");
|
||||||
|
done();
|
||||||
|
}, done.fail);
|
||||||
|
});
|
||||||
|
|
||||||
it("should handle radio buttons without a field value", function (done) {
|
it("should handle radio buttons without a field value", function (done) {
|
||||||
const normalAppearanceStateDict = new Dict();
|
const normalAppearanceStateDict = new Dict();
|
||||||
normalAppearanceStateDict.set("2", null);
|
normalAppearanceStateDict.set("2", null);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user