feat(web): Outliner header exposes the desktop controls and drops the web-only ones

LIBRARIES/ORPHAN_DATA gain the ID-type filter, LIBRARY_OVERRIDES the
lib_override_view_mode selector, VIEW_LAYER the header collection_new
button, ORPHAN_DATA Purge, and DATA_API the keying-set selector with
keyframe insert/delete. The web-only refresh and select/clear/invert/
toggle buttons are removed; selection stays on the keyboard.

The active filter_id_type stays in the ID-type menu after opening a file
whose Main has no data of that type, matching rna_enum_id_type_items,
so the snapshot decoder no longer rejects the open.

Headed case [outliner-header-controls-web] passes; full outliner suite
43/43.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
mes123456
2026-12-02 04:23:53 +08:00
parent 8173426da2
commit 44ce5cf402
12 changed files with 403 additions and 31 deletions

View File

@@ -1713,4 +1713,81 @@ test.describe("Outliner headed baseline", () => {
await filterButton.click();
await expect(menu).toBeHidden();
});
test("[outliner-header-controls-web] the header exposes the desktop controls and drops the web-only ones", async ({ page }) => {
test.setTimeout(360_000);
await openWorkbench(page);
const items = page.getByRole("treeitem");
await expect.poll(async () => items.count(), { timeout: 20_000 }).toBeGreaterThan(1);
/* Web-only header extras must be gone: desktop exposes none of them. */
await expect(page.locator('button[aria-label="刷新大纲树"]')).toHaveCount(0);
await expect(page.locator('button[aria-label="全选大纲对象"]')).toHaveCount(0);
/* View Layer header: collection_new (nested=True) adds a collection row. */
const before = await items.count();
await page.locator('button[aria-label="新建集合(头部)"]').click();
await expect.poll(async () => items.count(), { timeout: 20_000 }).toBeGreaterThan(before);
/* Unused Data header: orphans_purge and the ID type filter. */
const mode = page.locator('select[aria-label="大纲显示模式"]').first();
await mode.selectOption("ORPHAN_DATA");
await expect(page.locator('button[aria-label="清理未使用数据"]')).toHaveCount(1, { timeout: 20_000 });
const idToggle = page.locator('button[aria-label="按 ID 类型过滤"]').first();
await expect(idToggle).toBeVisible({ timeout: 20_000 });
const idSelect = page.locator('select[aria-label="ID 类型"]').first();
await expect(idSelect).toBeDisabled();
await idToggle.click();
await expect.poll(() => idSelect.isDisabled(), { timeout: 15_000 }).toBe(false);
const typeValue = await idSelect.locator("option").nth(1).getAttribute("value");
if (typeValue) await idSelect.selectOption(typeValue);
await expect.poll(async () => idSelect.inputValue(), { timeout: 15_000 }).toBe(typeValue ?? "");
await idToggle.click();
await expect.poll(() => idSelect.isDisabled(), { timeout: 15_000 }).toBe(true);
/* Data API header: keying-set selector and keyframe buttons. */
await mode.selectOption("DATA_API");
const keyingSet = page.locator('select[aria-label="活动关键帧集合"]').first();
if (await keyingSet.count()) {
const names = await keyingSet.locator("option")
.evaluateAll(nodes => nodes.map(node => (node as HTMLOptionElement).value).filter(Boolean));
expect(names.length).toBeGreaterThan(0);
await keyingSet.selectOption(names[0]);
await expect.poll(() => keyingSet.inputValue(), { timeout: 15_000 }).toBe(names[0]);
await expect(page.locator('button[aria-label="插入关键帧"]')).toBeEnabled();
} else {
await expect(page.getByText("无活动关键帧集合")).toBeVisible();
}
/* Library Overrides header: the view mode selector gates the search box
* exactly like OUTLINER_HT_header's filter_text_supported. */
await page.locator('[data-testid="blend-file-input"]').setInputFiles(LIBRARY_TARGET);
/* The collection created above counts as an unsaved change, so opening the
* library fixture asks first; discard like desktop's "open anyway". The
* retry reopens over the still-unsaved project, so it asks again. */
const discardUnsaved = () => page.getByRole('dialog', { name: '保存当前工程的修改?' })
.getByRole('button', { name: '不保存,继续', exact: true })
.click({ timeout: 15_000 }).catch(() => undefined);
await discardUnsaved();
const libraryPath = page.locator('input[aria-label="原始库路径 1"]');
await expect(libraryPath).toBeVisible({ timeout: 60_000 });
if (!(await libraryPath.inputValue()).trim()) await libraryPath.fill(LIBRARY_SOURCE_PATH);
await page.locator('input[aria-label="恢复库文件 1"]').setInputFiles(LIBRARY_SOURCE);
await page.getByRole("button", { name: "读取候选 / 重试打开" }).click();
await discardUnsaved();
await expect(libraryPath).toHaveCount(0, { timeout: 120_000 });
await expect(page.getByText(/Engine: SceneIR/).first()).toBeVisible({ timeout: 60_000 });
const webTools = page.locator('[data-testid="native-web-tools-toggle"]');
if (await webTools.count()) await webTools.click();
const overrideMode = page.locator('select[aria-label="大纲显示模式"]').first();
await overrideMode.selectOption("LIBRARY_OVERRIDES");
const viewMode = page.locator('select[aria-label="库覆盖视图模式"]').first();
await expect(viewMode).toBeVisible({ timeout: 20_000 });
await viewMode.selectOption("HIERARCHIES");
await expect.poll(() => viewMode.inputValue(), { timeout: 15_000 }).toBe("HIERARCHIES");
await expect(page.locator('input[aria-label="搜索场景"]')).toHaveCount(0, { timeout: 20_000 });
await viewMode.selectOption("PROPERTIES");
await expect.poll(() => viewMode.inputValue(), { timeout: 15_000 }).toBe("PROPERTIES");
await expect(page.locator('input[aria-label="搜索场景"]').first()).toBeVisible({ timeout: 20_000 });
});
});