feat(web): Outliner Data menu runs the desktop View operators

Desktop OUTLINER_MT_context_menu_view's Expand/Collapse All, Show Hierarchy
and Show One Level now run OUTLINER_OT_expanded_toggle, show_hierarchy and
show_one_level[open] on the native tree store through an
OUTLINER_VIEW_OPERATION editor-context action.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
mes123456
2026-12-01 05:19:07 +08:00
parent f73318acfa
commit 07f7c842b8
12 changed files with 155 additions and 14 deletions

View File

@@ -1107,4 +1107,53 @@ test.describe("Outliner headed baseline", () => {
await page.getByRole("menuitemcheckbox", { name: "无颜色 (None)", exact: true }).click();
await expect(archiveRow).toHaveAttribute("data-colortag", "-1", { timeout: 30_000 });
});
test("[outliner-view-ops-web] the Data menu runs the Outliner view operators", async ({ page }) => {
test.setTimeout(180_000);
await page.goto("/?ui=web");
const status = page.locator('[data-testid="engine-status"]');
await page.locator('[data-testid="blend-file-input"]').setInputFiles(HIERARCHY_SCENE);
await expect(page.locator(".blender-app")).toHaveAttribute("data-project-id", /.+/, { timeout: 60_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 keyLightRow = page.locator('.tree-row[aria-label="KeyLight"]');
const partsRow = page.locator('.tree-row[aria-label="Parts"]');
await expect(page.locator('.tree-row[aria-label="Scene Collection"]').first()).toBeVisible({ timeout: 30_000 });
/* Objects start closed, so Mount's child row is not in the tree yet. */
await expect(keyLightRow).toHaveCount(0);
const viewOperation = async (label: string) => {
await page.getByRole("button", { name: "Data", exact: true }).click();
await page.getByRole("menuitem", { name: "视图 (View)", exact: true }).click();
await page.getByRole("menuitem", { name: label, exact: true }).click();
};
/* Desktop OUTLINER_OT_expanded_toggle: opens every closed element. */
await viewOperation("展开/折叠全部 (Expand/Collapse All)");
await expect(status).toContainText("已展开或折叠全部", { timeout: 30_000 });
/* KeyLight shows twice once open: under Parts > Mount and under the
* RootRig object hierarchy (its parent lives in another collection). */
await expect(keyLightRow.first()).toBeVisible({ timeout: 30_000 });
/* A second call finds nothing closed and collapses the whole tree. */
await viewOperation("展开/折叠全部 (Expand/Collapse All)");
await expect(keyLightRow).toHaveCount(0, { timeout: 30_000 });
await expect(partsRow).toHaveCount(0, { timeout: 30_000 });
/* Desktop OUTLINER_OT_show_one_level opens the first closed level;
* follow-up refresh snapshots overwrite the transient status feedback, so
* the tree state is the durable user-visible check. */
await viewOperation("展开一层 (Show One Level)");
await expect(partsRow.first()).toBeVisible({ timeout: 30_000 });
await expect(keyLightRow).toHaveCount(0, { timeout: 30_000 });
/* Desktop OUTLINER_OT_show_hierarchy opens every object entry. */
await viewOperation("显示层级 (Show Object Hierarchy)");
await expect(keyLightRow.first()).toBeVisible({ timeout: 30_000 });
/* Desktop OUTLINER_OT_show_one_level with open=False closes one level. */
await viewOperation("折叠一层 (Hide One Level)");
await expect(keyLightRow).toHaveCount(0, { timeout: 30_000 });
});
});