30 lines
976 B
JavaScript
30 lines
976 B
JavaScript
import assert from 'node:assert/strict'
|
|
import { build } from 'esbuild'
|
|
|
|
const bundled = await build({
|
|
bundle: true,
|
|
entryPoints: ['src/editor/exportTimeline.ts'],
|
|
format: 'esm',
|
|
platform: 'node',
|
|
write: false,
|
|
})
|
|
const { prepareTimelineForExport } = await import(
|
|
`data:text/javascript;base64,${Buffer.from(bundled.outputFiles[0].contents).toString('base64')}`
|
|
)
|
|
|
|
let recalculated = 0
|
|
const store = {
|
|
systems: [{ frames: [[{ active: true }]] }],
|
|
timeline: { playing: false, frame: 17, recorded: true },
|
|
recalcTotalFrames() { recalculated++ },
|
|
}
|
|
|
|
prepareTimelineForExport(store)
|
|
assert.equal(store.timeline.playing, true, '导出准备必须在下一次界面刷新前恢复播放')
|
|
assert.equal(store.timeline.frame, 0)
|
|
assert.equal(store.timeline.recorded, false)
|
|
assert.equal(store.systems[0].frames, undefined)
|
|
assert.equal(recalculated, 1)
|
|
|
|
console.log('导出时间轴校验通过:恢复播放后才会等待首帧录制,避免无跟随补烘焙')
|