From 8d4d7ecc950529af16e678a147b877f7e8d52f9a Mon Sep 17 00:00:00 2001 From: kdletters Date: Sat, 8 Aug 2026 22:25:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E5=8E=86=E5=8F=B2=20UI=20?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E7=9A=84=E7=BB=9F=E4=B8=80=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将历史 spec.generate 的 ui 类型映射到 icon\n补充 GenerationInputs V2 恢复回归测试 --- .../ImageCanvasGenerationDialogModel.test.ts | 32 +++++++++++++++++++ .../ImageCanvasGenerationDialogModel.ts | 10 +++--- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/src/components/image-editor/ImageCanvasGenerationDialogModel.test.ts b/src/components/image-editor/ImageCanvasGenerationDialogModel.test.ts index 7cd0757be..235b3f282 100644 --- a/src/components/image-editor/ImageCanvasGenerationDialogModel.test.ts +++ b/src/components/image-editor/ImageCanvasGenerationDialogModel.test.ts @@ -1206,6 +1206,38 @@ describe('ImageCanvasGenerationDialogModel', () => { }); }); + it('maps legacy ui spec.generate inputs to the unified icon spec composer', () => { + expect( + createSameSourceGenerationDialogDraft({ + sourceLayer: createLayer({ + sourceType: 'generated', + assetKind: 'icon-spec', + generationInputs: { + version: 2, + action: 'spec.generate', + fields: [ + { id: 'specType', title: '规范类型', value: 'ui' }, + { id: 'playSetting', title: '玩法设定', value: '消除玩法' }, + { id: 'artStyle', title: '美术风格', value: '糖果玻璃' }, + ], + references: [], + }, + }), + availableLayers: [], + canvasSize: { width: 960, height: 720 }, + viewport: { x: 0, y: 0, scale: 1 }, + mode: 'redraw', + }), + ).toMatchObject({ + mode: 'spec', + specType: 'icon', + specValues: { + playSetting: '消除玩法', + artStyle: '糖果玻璃', + }, + }); + }); + it('restores the narrowly scoped legacy scene recipe into the scene composer', () => { expect( createSameSourceGenerationDialogDraft({ diff --git a/src/components/image-editor/ImageCanvasGenerationDialogModel.ts b/src/components/image-editor/ImageCanvasGenerationDialogModel.ts index e9707888d..b13778570 100644 --- a/src/components/image-editor/ImageCanvasGenerationDialogModel.ts +++ b/src/components/image-editor/ImageCanvasGenerationDialogModel.ts @@ -1001,11 +1001,11 @@ function createNormalizedGenerationDialogDraft({ 'custom', ); const specType: SpecGenerationType = - specTypeValue === 'character' || - specTypeValue === 'ui' || - specTypeValue === 'icon' - ? specTypeValue - : 'custom'; + specTypeValue === 'ui' + ? 'icon' + : specTypeValue === 'character' || specTypeValue === 'icon' + ? specTypeValue + : 'custom'; return placeDraftBesideSourceLayer( { ...createSpecDialogDraft({ canvasSize, viewport, specType }),