feat: 完成 DOCX R4 元素级视觉门禁
建立 Chromium、Word 与 WPS 的可编辑内容、段落几何、页眉页脚、封面、媒体和逐页视觉比较链路。 支持封面独立分节、正文页码重启、主题页边距与横向纸张,并将自然分页差异降为诊断项。 修正代码块内边距和折叠表格单元格边框映射,14 套主题生产矩阵与六组布局视觉矩阵通过。
This commit is contained in:
@@ -27,8 +27,23 @@ describe("导出配置", () => {
|
||||
A3: { width: 297, height: 420 },
|
||||
A4: { width: 210, height: 297 },
|
||||
A5: { width: 148, height: 210 },
|
||||
Letter: { width: 216, height: 279 },
|
||||
Legal: { width: 216, height: 356 }
|
||||
Letter: { width: 215.9, height: 279.4 },
|
||||
Legal: { width: 215.9, height: 355.6 }
|
||||
});
|
||||
});
|
||||
|
||||
it("保持英制纸张的标准尺寸精度", () => {
|
||||
expect(getPaperDimensionsMm("Letter", "portrait")).toEqual({
|
||||
width: 215.9,
|
||||
height: 279.4
|
||||
});
|
||||
expect(getPaperDimensionsMm("Letter", "landscape")).toEqual({
|
||||
width: 279.4,
|
||||
height: 215.9
|
||||
});
|
||||
expect(getPaperDimensionsMm("Legal", "portrait")).toEqual({
|
||||
width: 215.9,
|
||||
height: 355.6
|
||||
});
|
||||
});
|
||||
|
||||
@@ -51,7 +66,8 @@ describe("导出配置", () => {
|
||||
|
||||
it("提供可由主题推荐的页眉和页码配置", () => {
|
||||
expect(defaultExportConfig.header).toMatchObject({
|
||||
fontFamily: '"Segoe UI", "Microsoft YaHei", sans-serif'
|
||||
fontFamily: '"Segoe UI", "Microsoft YaHei", sans-serif',
|
||||
showOnFirstPage: true
|
||||
});
|
||||
expect(defaultExportConfig.footer).toMatchObject({
|
||||
fontFamily: '"Segoe UI", "Microsoft YaHei", sans-serif',
|
||||
@@ -65,7 +81,8 @@ describe("导出配置", () => {
|
||||
pageDecorationsMode: undefined,
|
||||
header: {
|
||||
...defaultExportConfig.header,
|
||||
fontFamily: undefined
|
||||
fontFamily: undefined,
|
||||
showOnFirstPage: undefined
|
||||
},
|
||||
footer: {
|
||||
...defaultExportConfig.footer,
|
||||
@@ -76,10 +93,29 @@ describe("导出配置", () => {
|
||||
|
||||
expect(parsedLegacyV4.pageDecorationsMode).toBe("theme");
|
||||
expect(parsedLegacyV4.header.fontFamily).toContain("Microsoft YaHei");
|
||||
expect(parsedLegacyV4.header.showOnFirstPage).toBe(true);
|
||||
expect(parsedLegacyV4.footer.fontFamily).toContain("Microsoft YaHei");
|
||||
expect(parsedLegacyV4.footer.showOnFirstPage).toBe(true);
|
||||
});
|
||||
|
||||
it("允许页眉和页码独立控制正文首页可见性", () => {
|
||||
const parsed = exportConfigSchema.parse({
|
||||
...defaultExportConfig,
|
||||
header: {
|
||||
...defaultExportConfig.header,
|
||||
enabled: true,
|
||||
showOnFirstPage: false
|
||||
},
|
||||
footer: {
|
||||
...defaultExportConfig.footer,
|
||||
showOnFirstPage: true
|
||||
}
|
||||
});
|
||||
|
||||
expect(parsed.header.showOnFirstPage).toBe(false);
|
||||
expect(parsed.footer.showOnFirstPage).toBe(true);
|
||||
});
|
||||
|
||||
it("支持公文页码格式和奇偶页外侧对齐", () => {
|
||||
expect(
|
||||
exportConfigSchema.safeParse({
|
||||
|
||||
Reference in New Issue
Block a user