修复宣发素材生成器刷新恢复

恢复画布布局中的 publication 生成器快照

补齐宣发素材卡片类型、游戏信息和参考图 hydrate

增加模型、面板和编辑器加载链路回归测试

更新图片画布持久化文档和共享踩坑记录
This commit is contained in:
2026-06-19 17:23:34 +08:00
parent 1b1caf13b8
commit aa67e72ec5
6 changed files with 228 additions and 2 deletions
@@ -276,6 +276,79 @@ describe('ImageCanvasEditorView generation integration', () => {
);
});
it('restores publication material composer fields and references from saved generator snapshots', async () => {
loadOrCreateRecentEditorProjectMock.mockResolvedValueOnce({
projectId: 'editor-project-publication-dialog',
title: '宣发画布',
viewport: { x: 0, y: 0, scale: 1 },
layers: [
{
itemType: 'generation-dialog',
layerId: 'generation-dialog:generation-dialog-publication',
resourceId: 'generation-dialog:generation-dialog-publication',
dialog: {
id: 'generation-dialog-publication',
mode: 'publication',
prompt: '马戏团午夜惊魂|非对称对抗|找到钥匙逃离',
status: 'idle',
composerOpen: true,
publicationWorkflowId: 'publication-promo-poster',
publicationGameInfo: {
gameName: '马戏团午夜惊魂',
gameCategories: '非对称对抗',
gameDescription: '找到钥匙,开门逃离马戏团',
},
publicationReferences: [
{
id: 'publication-reference-1',
label: '首图参考',
src: '/generated-character-drafts/editor/reference.png',
objectKey: 'generated-character-drafts/editor/reference.png',
assetObjectId: 'asset-object-publication-reference',
},
],
imageModel: 'gpt-image-2',
aspectRatio: '16:9',
imageSize: '2K',
placeholder: {
x: 282,
y: 112,
width: 1280,
height: 720,
originalWidth: 1280,
originalHeight: 720,
},
},
},
],
resources: [],
updatedAt: '2026-06-17T00:00:00.000Z',
});
render(<ImageCanvasEditorView />);
const publicationDialog = await screen.findByRole('dialog', {
name: '运营海报生成卡片',
});
expect(
(within(publicationDialog).getByRole('textbox', {
name: '运营海报游戏名',
}) as HTMLInputElement).value,
).toBe('马戏团午夜惊魂');
expect(
(within(publicationDialog).getByRole('textbox', {
name: '运营海报游戏分类',
}) as HTMLInputElement).value,
).toBe('非对称对抗');
expect(
(within(publicationDialog).getByRole('textbox', {
name: '运营海报一句话描述游戏',
}) as HTMLTextAreaElement).value,
).toBe('找到钥匙,开门逃离马戏团');
expect(within(publicationDialog).getByLabelText('首图参考')).toBeTruthy();
expect(screen.getByLabelText('宣发素材生成占位图')).toBeTruthy();
});
it('opens a canvas generation frame and composer before creating a generated layer', async () => {
generateEditorImageMock.mockResolvedValueOnce({
imageSrc: 'data:image/png;base64,ZmFrZS1pbWFnZQ==',