Merge branch 'fix/agc-resource-layout-manual' into fix/agc-canvas-acceptance-batch

This commit is contained in:
2026-09-14 19:07:45 +08:00
2 changed files with 68 additions and 15 deletions
@@ -7626,22 +7626,27 @@ export default function ProjectDevelopmentView({
<ListFilter size={15} aria-hidden="true" />
</button>
{/*
/
/
*/}
<button
type="button"
aria-label="整理画布"
disabled={!resourceLayoutReady}
aria-busy={resourceLayoutSaving}
onClick={() => activeResourceLayout.rederiveNow()}
>
<LayoutGrid size={15} aria-hidden="true" />
</button>
</div>
{/*
`game-workbench-view-actions`
+ secondary pill
CSS
/
/
*/}
<button
type="button"
aria-label="整理画布"
disabled={!resourceLayoutReady}
aria-busy={resourceLayoutSaving}
onClick={() => activeResourceLayout.rederiveNow()}
>
<LayoutGrid size={15} aria-hidden="true" />
</button>
</>
) : null}
</div>
@@ -23,6 +23,7 @@ import {
React,
render,
screen,
within,
} from './appSurface/harness';
/**
@@ -752,6 +753,53 @@ describe('资源画布手动重排口径', () => {
expect(typeWrites(tauri)).toHaveLength(1);
});
it('「整理画布」不属于「资源排列方式」这组模式切换,而是一枚独立动作按钮', async () => {
const projectPath = '/tmp/manual-layout-surface-project';
const tauri = installLayoutTauri({
projectIdsByPath: { [projectPath]: 'manual-layout-surface-project' },
});
render(
<LayoutWorkbench
projects={[
{
projectId: 'manual-layout-surface-project',
projectPath,
assets: [pngAsset('asset-art-b', 'art-b.png')],
},
]}
/>,
);
const sortGroup = await screen.findByRole('group', {
name: '资源排列方式',
});
// 这组里只有两种排列方式:用户不该把「整理画布」读成第三种排列方式。
expect(
within(sortGroup)
.getAllByRole('button')
.map((button) => button.getAttribute('aria-label')),
).toEqual(['按依赖', '按类型']);
expect(
within(sortGroup).queryByRole('button', { name: '整理画布' }),
).toBeNull();
// 它仍在同一行、仍是同一枚动作按钮,只是搬出了那个 group。
const rederiveButton = screen.getByRole('button', { name: '整理画布' });
expect(sortGroup.contains(rederiveButton)).toBe(false);
expect(rederiveButton.closest('.game-resource-sort-tabs')).toBeNull();
expect(
rederiveButton.closest('.game-workbench-view-actions'),
).not.toBeNull();
// 语义没变:可点性只跟布局就绪绑定,布局读完后它就是可点的。
await waitFor(() =>
expect(
screen
.getByRole('button', { name: '整理画布' })
.hasAttribute('disabled'),
).toBe(false),
);
});
it('首次打开项目与切项目都不触发新素材聚焦跳转', async () => {
const tauri = installLayoutTauri({
projectIdsByPath: {