fix: 统一十四套主题DOCX字体映射

This commit is contained in:
SkyJourney
2026-08-03 12:47:14 +08:00
parent 6a6972ae48
commit 9dee7e8605
23 changed files with 325 additions and 63 deletions
@@ -67,6 +67,19 @@ test("字体门禁区分缺少声明、缺少嵌入和 Office 未实际采用",
assert.deepEqual(embedded, []);
});
test("14 套内置主题都声明字体且中文字体面不超过三个", () => {
const { themes } = matrix();
const cjkFamilies = /(?:Fandol|MdTP|Song|Hei|Kai|Fang|Sim|YaHei|CJK|Han)/iu;
for (const theme of themes) {
assert.ok(theme.docxFontFaces.length > 0, `${theme.id} 缺少 DOCX 字体声明`);
assert.ok(theme.docxFontFaces.length <= 16, `${theme.id} 字体面超过协议上限`);
const cjkFaces = theme.docxFontFaces.filter((face) =>
[face.family, ...face.aliases].some((family) => cjkFamilies.test(family))
);
assert.ok(cjkFaces.length <= 3, `${theme.id} 中文字体面超过三个`);
}
});
test("每套主题都覆盖两个方向和五组边距", () => {
const { themes, cases } = matrix();
for (const theme of themes) {