fix: 增强DOCX字体实际使用门禁
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
createDocxLayoutVisualMatrixCases,
|
||||
DOCX_LAYOUT_MATRIX_MARGIN_SCENARIOS,
|
||||
DOCX_LAYOUT_MATRIX_ORIENTATIONS,
|
||||
getDocxFontGateFailures,
|
||||
readBundledThemeMatrixDefinitions,
|
||||
summarizeDocxLayoutVisualMatrix
|
||||
} from "./docx-layout-visual-matrix-cases.mjs";
|
||||
@@ -34,6 +35,38 @@ test("生成 14×2×5 的完整 DOCX 布局视觉矩阵", () => {
|
||||
assert.deepEqual(summary.orientations, ["portrait", "landscape"]);
|
||||
});
|
||||
|
||||
test("字体门禁区分缺少声明、缺少嵌入和 Office 未实际采用", () => {
|
||||
const missing = getDocxFontGateFailures({
|
||||
theme: { id: "missing", docxFontFaces: [] },
|
||||
inspection: { embeddedFontPartCount: 0, embeddedFontNames: [] },
|
||||
renderedFonts: [],
|
||||
engine: "word"
|
||||
});
|
||||
assert.equal(missing.length, 2);
|
||||
|
||||
const fallback = getDocxFontGateFailures({
|
||||
theme: {
|
||||
id: "declared",
|
||||
docxFontFaces: [{ family: "FandolSong", aliases: [], weight: 400, style: "normal" }]
|
||||
},
|
||||
inspection: { embeddedFontPartCount: 1, embeddedFontNames: ["MdTP Serif SC"] },
|
||||
renderedFonts: [{ name: "SimSun" }],
|
||||
engine: "word"
|
||||
});
|
||||
assert.deepEqual(fallback, ["Microsoft Word 输出未实际使用 DOCX 嵌入字体"]);
|
||||
|
||||
const embedded = getDocxFontGateFailures({
|
||||
theme: {
|
||||
id: "declared",
|
||||
docxFontFaces: [{ family: "FandolSong", aliases: [], weight: 400, style: "normal" }]
|
||||
},
|
||||
inspection: { embeddedFontPartCount: 1, embeddedFontNames: ["MdTP Serif SC"] },
|
||||
renderedFonts: [{ name: "___WRD_EMBED_SUB_65" }],
|
||||
engine: "word"
|
||||
});
|
||||
assert.deepEqual(embedded, []);
|
||||
});
|
||||
|
||||
test("每套主题都覆盖两个方向和五组边距", () => {
|
||||
const { themes, cases } = matrix();
|
||||
for (const theme of themes) {
|
||||
|
||||
Reference in New Issue
Block a user