Skip to content

Commit e96a1c9

Browse files
committed
Add regression test for font mapping
Verifies that sans-serif is mapped to Calibri and monospace to Lucida Console on Windows/Firefox See PR #18844
1 parent e9a4830 commit e96a1c9

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

test/unit/text_layer_spec.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
* limitations under the License.
1414
*/
1515

16+
import { FeatureTest, isNodeJS } from "../../src/shared/util.js";
1617
import { buildGetDocumentParams } from "./test_utils.js";
1718
import { getDocument } from "../../src/display/api.js";
18-
import { isNodeJS } from "../../src/shared/util.js";
1919
import { TextLayer } from "../../src/display/text_layer.js";
2020

2121
describe("textLayer", function () {
@@ -250,4 +250,21 @@ describe("textLayer", function () {
250250

251251
await loadingTask.destroy();
252252
});
253+
254+
it("should use Calibri and Lucida Console on Windows with Firefox", async function () {
255+
spyOnProperty(FeatureTest, "platform", "get").and.returnValue({
256+
isWindows: true,
257+
isFirefox: true,
258+
});
259+
260+
const fontFamilyMap = TextLayer.fontFamilyMap;
261+
const expectedSansSerif = "Calibri, sans-serif";
262+
const expectedMonospace = "Lucida Console, monospace";
263+
264+
const actualSansSerif = fontFamilyMap.get("sans-serif");
265+
const actualMonospace = fontFamilyMap.get("monospace");
266+
267+
expect(actualSansSerif).toBe(expectedSansSerif);
268+
expect(actualMonospace).toBe(expectedMonospace);
269+
});
253270
});

0 commit comments

Comments
 (0)