修复画布提示与图片尺寸一致性
提示弹窗三秒后自动消失并保留手动关闭 统一 nanobanana2 与 gpt-image-2 同规格图片的交付像素 补充尺寸归一和提示生命周期回归测试 同步图片画布生成契约文档
This commit is contained in:
@@ -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] =
|
||||
|
||||
Reference in New Issue
Block a user