验收完成40%

This commit is contained in:
2026-07-17 08:08:31 +08:00
parent 23cfd365a1
commit 887481a4ab
172 changed files with 855 additions and 577 deletions
@@ -9,20 +9,22 @@ const workspace = path.resolve(testDirectory, '..', '..')
const manifestPath = path.join(workspace, 'design-pipeline', 'manifests', 'g01-background-candidates.json')
const wrapperPath = path.join(workspace, 'design-pipeline', 'scripts', 'build-g01-backgrounds.mjs')
test('G01 background candidate manifest preserves three portable masters', async () => {
test('G01 background candidate manifest preserves four portable masters and selects the approved long background', async () => {
const manifest = JSON.parse(await readFile(manifestPath, 'utf8'))
assert.equal(manifest.schemaVersion, 1)
assert.equal(manifest.page, 'G01')
assert.equal(manifest.status, 'candidates-pending-user-selection')
assert.equal(manifest.candidates.length, 3)
assert.equal(manifest.status, 'long-flagship-selected-for-genealogy-module')
assert.equal(manifest.selectedCandidateId, 'g01-list-background-long-flagship')
assert.equal(manifest.runtimeOutput, 'static/assets/modules/genealogy/opaque/genealogy-page-background-long.png')
assert.equal(manifest.candidates.length, 4)
const ids = new Set()
for (const candidate of manifest.candidates) {
assert.ok(!ids.has(candidate.id), `duplicate candidate id: ${candidate.id}`)
ids.add(candidate.id)
assert.match(candidate.prompt, /1024x1536/)
assert.deepEqual(candidate.sourcePixels, { width: 1024, height: 1536 })
assert.ok(['chroma-key', 'opaque-paper'].includes(candidate.processingMode))
assert.match(candidate.prompt, /\d+x\d+/)
assert.ok(candidate.sourcePixels.width > 0 && candidate.sourcePixels.height > 0)
assert.ok(['chroma-key', 'opaque-paper', 'opaque-paper-resize'].includes(candidate.processingMode))
for (const key of ['master', 'generatedOutput']) {
const absolute = path.resolve(workspace, candidate[key])
@@ -30,10 +32,16 @@ test('G01 background candidate manifest preserves three portable masters', async
assert.ok(!relative.startsWith('..') && !path.isAbsolute(relative), `${key} escapes workspace`)
}
}
const selected = manifest.candidates.find(({ id }) => id === manifest.selectedCandidateId)
assert.deepEqual(selected.sourcePixels, { width: 1536, height: 3840 })
assert.deepEqual(selected.outputPixels, { width: 1440, height: 3600 })
assert.equal(selected.processingMode, 'opaque-paper-resize')
})
test('G01 Node wrapper delegates pixel decoding to locked Pillow without Sharp', async () => {
const wrapper = await readFile(wrapperPath, 'utf8')
assert.doesNotMatch(wrapper, /from ['"]sharp['"]/)
assert.match(wrapper, /build_g01_backgrounds\.py/)
assert.match(wrapper, /candidates\?\.length !== 4/)
})