1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

[JS] Fix a rounding issue in printf (bug 1802888)

This commit is contained in:
Calixte Denizet 2022-11-28 14:27:50 +01:00
parent 67741aeaa9
commit 4ee0c83548
2 changed files with 16 additions and 3 deletions

View file

@ -280,6 +280,18 @@ describe("Scripting", function () {
`util.printf("Decimal number: %,0.2f", -12.34567)`
);
expect(value).toEqual("Decimal number: -12.35");
value = await myeval(`util.printf("Decimal number: %,0.0f", 4.95)`);
expect(value).toEqual("Decimal number: 5");
value = await myeval(`util.printf("Decimal number: %,0.0f", 4.49)`);
expect(value).toEqual("Decimal number: 4");
value = await myeval(`util.printf("Decimal number: %,0.0f", -4.95)`);
expect(value).toEqual("Decimal number: -5");
value = await myeval(`util.printf("Decimal number: %,0.0f", -4.49)`);
expect(value).toEqual("Decimal number: -4");
});
it("should print a string with no argument", async () => {