feat(web): Outliner filter popover exposes the Collections and Objects toggles
The engine already maps showCollections/showObjects onto SO_FILTER_NO_COLLECTION and SO_FILTER_NO_OBJECT (OUTLINER_SET_FILTER); the popover now renders both checkboxes, and the Data menu hides Unlink in View Layer mode while the Collections filter is off, matching space_outliner.py. The filter case counts the two new toggles. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -19,7 +19,7 @@ import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const REPO_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
||||
const EXPECTED_CASES = ["outliner-tree-baseline-web", "outliner-tools-baseline-web", "outliner-mirror-baseline-web", "outliner-metrics-web", "outliner-display-mode-web", "outliner-filter-web", "outliner-restrict-web", "outliner-select-keys-web", "outliner-delete-web", "outliner-box-select-web", "outliner-id-operation-web", "outliner-id-clipboard-web", "outliner-collection-delete-web", "outliner-mode-dot-web", "outliner-rename-bone-web", "outliner-eyedropper-web", "outliner-fake-user-purge-web", "outliner-asset-ops-web", "outliner-liboverride-web", "outliner-make-local-web", "outliner-select-hierarchy-web", "outliner-delete-hierarchy-web", "outliner-collection-new-web", "outliner-collection-select-web", "outliner-object-select-web", "outliner-collection-duplicate-web", "outliner-collection-instance-web", "outliner-collection-color-tag-web", "outliner-view-ops-web", "outliner-show-active-web", "outliner-collection-visibility-web", "outliner-collection-view-layer-web", "outliner-collection-link-web", "outliner-select-linked-web", "outliner-edit-menu-web", "outliner-collection-view-layer-gate-web"];
|
||||
const EXPECTED_CASES = ["outliner-tree-baseline-web", "outliner-tools-baseline-web", "outliner-mirror-baseline-web", "outliner-metrics-web", "outliner-display-mode-web", "outliner-filter-web", "outliner-restrict-web", "outliner-select-keys-web", "outliner-delete-web", "outliner-box-select-web", "outliner-id-operation-web", "outliner-id-clipboard-web", "outliner-collection-delete-web", "outliner-mode-dot-web", "outliner-rename-bone-web", "outliner-eyedropper-web", "outliner-fake-user-purge-web", "outliner-asset-ops-web", "outliner-liboverride-web", "outliner-make-local-web", "outliner-select-hierarchy-web", "outliner-delete-hierarchy-web", "outliner-collection-new-web", "outliner-collection-select-web", "outliner-object-select-web", "outliner-collection-duplicate-web", "outliner-collection-instance-web", "outliner-collection-color-tag-web", "outliner-view-ops-web", "outliner-show-active-web", "outliner-collection-visibility-web", "outliner-collection-view-layer-web", "outliner-collection-link-web", "outliner-select-linked-web", "outliner-edit-menu-web", "outliner-collection-view-layer-gate-web", "outliner-filter-collection-toggle-web"];
|
||||
/* Desktop Layout geometry the metrics case must reproduce (batch 2: UI sizes). */
|
||||
const GEOMETRY_GOLDEN = path.join(REPO_ROOT, "tests/golden/OUTLINER-DESKTOP-METRICS/outliner-metrics.json");
|
||||
const errors = [];
|
||||
|
||||
@@ -67,6 +67,7 @@ const KNOWN_CASES = [
|
||||
{ id: "outliner-select-linked-web", title: /\[outliner-select-linked-web\]/ },
|
||||
{ id: "outliner-edit-menu-web", title: /\[outliner-edit-menu-web\]/ },
|
||||
{ id: "outliner-collection-view-layer-gate-web", title: /\[outliner-collection-view-layer-gate-web\]/ },
|
||||
{ id: "outliner-filter-collection-toggle-web", title: /\[outliner-filter-collection-toggle-web\]/ },
|
||||
];
|
||||
|
||||
function usage() {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -183,8 +183,11 @@ test.describe("Outliner headed baseline", () => {
|
||||
const menu = page.locator(".outliner-filter-menu").first();
|
||||
await expect(menu).toBeVisible();
|
||||
const checkboxes = menu.locator('input[type="checkbox"]');
|
||||
/* Four filter-state toggles plus the seven View Layer restriction toggles. */
|
||||
await expect(checkboxes).toHaveCount(11);
|
||||
/* Six filter toggles (visible / selected / collections / objects / invert /
|
||||
* sync) plus the seven View Layer restriction toggles. */
|
||||
await expect(checkboxes).toHaveCount(13);
|
||||
await expect(menu.getByLabel("集合")).toHaveCount(1);
|
||||
await expect(menu.getByLabel("物体")).toHaveCount(1);
|
||||
await expect(menu.getByLabel("反转")).toHaveCount(1);
|
||||
await expect(menu.getByLabel("同步选择")).toHaveCount(1);
|
||||
await filterButton.click();
|
||||
@@ -1407,4 +1410,47 @@ test.describe("Outliner headed baseline", () => {
|
||||
await expect(page.getByRole("menuitem", { name: "可见性 (Visibility)", exact: true })).toHaveCount(1, { timeout: 15_000 });
|
||||
await expect(viewLayerItem).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("[outliner-filter-collection-toggle-web] the filter hides collections and gates Unlink", async ({ page }) => {
|
||||
test.setTimeout(180_000);
|
||||
await page.goto("/?ui=web");
|
||||
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 partsRow = page.locator('.tree-row[aria-label="Parts"]').first();
|
||||
await expect(partsRow).toBeVisible({ timeout: 30_000 });
|
||||
|
||||
/* Desktop default (use_filter_collection on) keeps Unlink in the menu. */
|
||||
await partsRow.locator(".tree-node-name").first().click({ button: "right" });
|
||||
await expect(page.getByRole("menuitem", { name: "取消链接", exact: true })).toHaveCount(1, { timeout: 15_000 });
|
||||
await page.keyboard.press("Escape");
|
||||
|
||||
/* Unchecking Collections sets SO_FILTER_NO_COLLECTION; the view-layer tree
|
||||
* then stops emitting collection rows (tree_display_view_layer.cc). */
|
||||
const filterButton = page.locator('button[aria-label="筛选"]').first();
|
||||
await filterButton.click();
|
||||
const menu = page.locator(".outliner-filter-menu").first();
|
||||
await expect(menu).toBeVisible();
|
||||
await menu.getByLabel("集合").uncheck();
|
||||
await filterButton.click();
|
||||
await expect.poll(async () => page.locator('.tree-row[aria-label="Parts"]').count(), { timeout: 30_000 }).toBe(0);
|
||||
|
||||
/* space_outliner.py hides Unlink when display_mode == 'VIEW_LAYER' and
|
||||
* use_filter_collection is off. */
|
||||
const rootRig = page.locator('.tree-row[aria-label="RootRig"]').first();
|
||||
await expect(rootRig).toBeVisible({ timeout: 15_000 });
|
||||
await rootRig.locator(".tree-node-name").first().click({ button: "right" });
|
||||
await expect(page.getByRole("menuitem", { name: "取消链接", exact: true })).toHaveCount(0, { timeout: 15_000 });
|
||||
await page.keyboard.press("Escape");
|
||||
|
||||
/* Re-enabling collections restores the rows and the menu entry. */
|
||||
await filterButton.click();
|
||||
await menu.getByLabel("集合").check();
|
||||
await filterButton.click();
|
||||
await expect.poll(async () => page.locator('.tree-row[aria-label="Parts"]').count(), { timeout: 30_000 }).toBeGreaterThan(0);
|
||||
await page.locator('.tree-row[aria-label="Parts"]').first().locator(".tree-node-name").first().click({ button: "right" });
|
||||
await expect(page.getByRole("menuitem", { name: "取消链接", exact: true })).toHaveCount(1, { timeout: 15_000 });
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user