修复画布提示与图片尺寸一致性
Project CI / Repository checks (push) Successful in 1m3s
Project CI / Frontend tests (push) Successful in 2m5s
Project CI / Native shell tests (push) Successful in 2m33s
Project CI / Backend tests (push) Successful in 3m9s

提示弹窗三秒后自动消失并保留手动关闭
统一 nanobanana2 与 gpt-image-2 同规格图片的交付像素
补充尺寸归一和提示生命周期回归测试
同步图片画布生成契约文档
This commit is contained in:
2026-07-27 20:24:07 +08:00
parent 38c5a1a11a
commit 25ee537e39
5 changed files with 147 additions and 50 deletions
@@ -1417,7 +1417,7 @@ describe('useImageCanvasGenerationWorkflow', () => {
expect(screen.getByTestId('reference-pick-warning').textContent).toBe('-');
});
it('keeps reference pick warnings visible until the user takes a follow-up action', () => {
it('dismisses reference pick warnings after three seconds', () => {
vi.useFakeTimers();
try {
render(<GenerationWorkflowHarness />);
@@ -1430,12 +1430,18 @@ describe('useImageCanvasGenerationWorkflow', () => {
);
act(() => {
vi.advanceTimersByTime(10_000);
vi.advanceTimersByTime(2_999);
});
expect(screen.getByTestId('reference-pick-warning').textContent).toBe(
'选择的图片不是角色规范图,请选择生成规范里的角色规范。',
);
act(() => {
vi.advanceTimersByTime(1);
});
expect(screen.getByTestId('reference-pick-warning').textContent).toBe('-');
} finally {
vi.useRealTimers();
}
@@ -720,6 +720,20 @@ export function useImageCanvasGenerationWorkflow({
const [generationWarning, setGenerationWarning] = useState<string | null>(
null,
);
useEffect(() => {
if (!generationWarning) {
return;
}
const timer = window.setTimeout(() => {
setGenerationWarning(null);
}, 3_000);
return () => {
window.clearTimeout(timer);
};
}, [generationWarning]);
const [cropExpandPanel, setCropExpandPanel] =
useState<CropExpandPanelState | null>(null);
const [uiAssetExtractionState, setUiAssetExtractionState] =