Write boolean value when saving a form (bug 1729971)
- it aims to fix https://bugzilla.mozilla.org/show_bug.cgi?id=1729971#c4.
This commit is contained in:
parent
8a79f13e5a
commit
474ab7c86d
@ -83,10 +83,14 @@ function writeValue(value, buffer, transform) {
|
|||||||
buffer.push(`(${escapeString(value)})`);
|
buffer.push(`(${escapeString(value)})`);
|
||||||
} else if (typeof value === "number") {
|
} else if (typeof value === "number") {
|
||||||
buffer.push(numberToString(value));
|
buffer.push(numberToString(value));
|
||||||
|
} else if (typeof value === "boolean") {
|
||||||
|
buffer.push(`${value.toString()}`);
|
||||||
} else if (isDict(value)) {
|
} else if (isDict(value)) {
|
||||||
writeDict(value, buffer, transform);
|
writeDict(value, buffer, transform);
|
||||||
} else if (isStream(value)) {
|
} else if (isStream(value)) {
|
||||||
writeStream(value, buffer, transform);
|
writeStream(value, buffer, transform);
|
||||||
|
} else {
|
||||||
|
warn(`Unhandled value in writer: ${typeof value}, please file a bug.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,6 +114,8 @@ describe("Writer", function () {
|
|||||||
gdict.set("I", stream);
|
gdict.set("I", stream);
|
||||||
|
|
||||||
dict.set("G", gdict);
|
dict.set("G", gdict);
|
||||||
|
dict.set("J", true);
|
||||||
|
dict.set("K", false);
|
||||||
|
|
||||||
const buffer = [];
|
const buffer = [];
|
||||||
writeDict(dict, buffer, null);
|
writeDict(dict, buffer, null);
|
||||||
@ -123,7 +125,7 @@ describe("Writer", function () {
|
|||||||
"/E (\\(hello\\\\world\\)) /F [1.23 4.5 6] " +
|
"/E (\\(hello\\\\world\\)) /F [1.23 4.5 6] " +
|
||||||
"/G << /H 123 /I << /Length 8>> stream\n" +
|
"/G << /H 123 /I << /Length 8>> stream\n" +
|
||||||
"a stream\n" +
|
"a stream\n" +
|
||||||
"endstream\n>>>>";
|
"endstream\n>> /J true /K false>>";
|
||||||
|
|
||||||
expect(buffer.join("")).toEqual(expected);
|
expect(buffer.join("")).toEqual(expected);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user