From 7d029f8bfe803b1c628f0a79e61f1a3651bda880 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Wed, 16 Nov 2022 12:39:35 +0100 Subject: [PATCH] Add a basic `stringToUTF16HexString` unit-test --- test/unit/core_utils_spec.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/unit/core_utils_spec.js b/test/unit/core_utils_spec.js index 7723e6f66..1a8da5a7c 100644 --- a/test/unit/core_utils_spec.js +++ b/test/unit/core_utils_spec.js @@ -23,6 +23,7 @@ import { isWhiteSpace, log2, parseXFAPath, + stringToUTF16HexString, stringToUTF16String, toRomanNumerals, validateCSSFont, @@ -355,6 +356,18 @@ describe("core_utils", function () { }); }); + describe("stringToUTF16HexString", function () { + it("should encode a string in UTF16 hexadecimal format", function () { + expect(stringToUTF16HexString("hello world")).toEqual( + "00680065006c006c006f00200077006f0072006c0064" + ); + + expect(stringToUTF16HexString("こんにちは世界の")).toEqual( + "30533093306b3061306f4e16754c306e" + ); + }); + }); + describe("stringToUTF16String", function () { it("should encode a string in UTF16", function () { expect(stringToUTF16String("hello world")).toEqual(