fix: 修复DOCX独立封面视觉门禁
统一 Chromium 与 DOCX 的受限高度封面布局,补齐可编辑边框、装饰边和 Office 页面舍入适配。 按四套独立封面主题、纵横方向及五组页边距执行 40 个 Word/WPS 真实视觉场景,严格失败为 0,并保留正文诊断供 D4 修复。
This commit is contained in:
@@ -50,6 +50,31 @@ function assert(condition, message) {
|
||||
}
|
||||
}
|
||||
|
||||
function newestModifiedAt(targetPath) {
|
||||
const stat = fs.statSync(targetPath);
|
||||
if (stat.isFile()) {
|
||||
return stat.mtimeMs;
|
||||
}
|
||||
return fs.readdirSync(targetPath, { withFileTypes: true }).reduce(
|
||||
(newest, entry) =>
|
||||
Math.max(
|
||||
newest,
|
||||
newestModifiedAt(path.join(targetPath, entry.name))
|
||||
),
|
||||
stat.mtimeMs
|
||||
);
|
||||
}
|
||||
|
||||
function assertFreshArtifact(label, sourcePaths, artifactPath) {
|
||||
assert(fs.existsSync(artifactPath), `${label} 构建产物不存在:${artifactPath}`);
|
||||
const newestSource = Math.max(...sourcePaths.map(newestModifiedAt));
|
||||
const artifactModifiedAt = fs.statSync(artifactPath).mtimeMs;
|
||||
assert(
|
||||
artifactModifiedAt + 1_500 >= newestSource,
|
||||
`${label} 构建产物早于源码;请按依赖顺序重新构建后再执行门禁`
|
||||
);
|
||||
}
|
||||
|
||||
function sha256(content) {
|
||||
return createHash("sha256").update(content).digest("hex");
|
||||
}
|
||||
@@ -271,6 +296,42 @@ function responseDiagnostics(response, kind) {
|
||||
}
|
||||
|
||||
assert(fs.existsSync(standardReportPath), "缺少本轮标准 DOCX 主题矩阵报告");
|
||||
assertFreshArtifact(
|
||||
"Preview Engine",
|
||||
[path.join(repositoryDirectory, "packages", "preview-engine", "src")],
|
||||
path.join(
|
||||
repositoryDirectory,
|
||||
"packages",
|
||||
"preview-engine",
|
||||
"dist",
|
||||
"semantic-cover-fit.js"
|
||||
)
|
||||
);
|
||||
assertFreshArtifact(
|
||||
"DOCX Engine",
|
||||
[path.join(repositoryDirectory, "packages", "docx-engine", "src")],
|
||||
path.join(
|
||||
repositoryDirectory,
|
||||
"packages",
|
||||
"docx-engine",
|
||||
"dist",
|
||||
"document-structure-transform.js"
|
||||
)
|
||||
);
|
||||
assertFreshArtifact(
|
||||
"Web Preview Runtime",
|
||||
[
|
||||
path.join(repositoryDirectory, "apps", "web", "src"),
|
||||
path.join(
|
||||
repositoryDirectory,
|
||||
"packages",
|
||||
"preview-engine",
|
||||
"dist",
|
||||
"semantic-cover-fit.js"
|
||||
)
|
||||
],
|
||||
path.join(webDirectory, "preview-frame.html")
|
||||
);
|
||||
assert(
|
||||
fs.statSync(fontPackRoot).isDirectory(),
|
||||
`缺少有效字体包根目录:${fontPackRoot}`
|
||||
|
||||
Reference in New Issue
Block a user