feat(web): Outliner Data menu selects a collection's objects
Wire the desktop OUTLINER_OT_collection_objects_select/deselect pair into the Data menu for collection rows. The engine call site now copies the operator idname the way wm_operator_create does, so the shared exec reads the right branch and Deselect really deselects; the two operations also join the id-operation whitelist, protocol union, worker gate and feedback messages. Headed case [outliner-collection-select-web] opens Mount (Payload and KeyLight nest under their parent row like the desktop tree), checks the fixture's initial Payload selection, then deselects, re-selects and deselects Parts' objects through data-selected on the rows. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -909,4 +909,63 @@ test.describe("Outliner headed baseline", () => {
|
||||
await expect(status).toContainText("已新建集合", { timeout: 30_000 });
|
||||
await expect(nestedCollections).toHaveCount(before + 1, { timeout: 30_000 });
|
||||
});
|
||||
|
||||
test("[outliner-collection-select-web] the Data menu selects and deselects a collection's objects", 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();
|
||||
await expect(page.locator(".outliner-tree").first()).toBeVisible({ timeout: 20_000 });
|
||||
|
||||
/* Collections come up open; Parts' other objects nest under their parent
|
||||
* row like the desktop tree (KeyLight and Payload hang under Mount), so
|
||||
* Mount must be open too. Its children only land with the next engine
|
||||
* snapshot, which the Payload assertion below waits for. */
|
||||
for (let pass = 0; pass < 3; pass++) {
|
||||
for (const name of ["Scene Collection", "Assembly", "Parts", "Mount"]) {
|
||||
const toggle = page.getByRole("button", { name: `展开 ${name}`, exact: true }).first();
|
||||
if (await toggle.count()) await toggle.click();
|
||||
}
|
||||
}
|
||||
const partsRow = page.locator('.tree-row[aria-label="Parts"]').first();
|
||||
await expect(partsRow).toBeVisible({ timeout: 30_000 });
|
||||
const partObjects = ["Mount", "Payload", "InspectionCamera", "KeyLight"];
|
||||
/* The fixture ships with only Payload selected; the row must say so
|
||||
* before the deselect below runs (and this waits for Mount's children). */
|
||||
await expect(page.locator('.tree-row[aria-label="Payload"]').first()).toHaveAttribute("data-selected", "true", { timeout: 30_000 });
|
||||
|
||||
/* Desktop OUTLINER_OT_collection_objects_deselect walks the selected
|
||||
* LayerCollection and clears BASE_SELECTED on its objects
|
||||
* (outliner_collections.cc collection_objects_select_exec). */
|
||||
await partsRow.locator(".tree-node-name").first().click({ button: "right" });
|
||||
const deselectObjects = page.getByRole("menuitem", { name: "取消选择对象 (Deselect Objects)", exact: true });
|
||||
await expect(deselectObjects).toBeEnabled();
|
||||
await deselectObjects.click();
|
||||
await expect(status).toContainText("已取消选择集合对象", { timeout: 30_000 });
|
||||
for (const name of partObjects) {
|
||||
await expect(page.locator(`.tree-row[aria-label="${name}"]`).first()).toHaveAttribute("data-selected", "false", { timeout: 15_000 });
|
||||
}
|
||||
|
||||
/* Desktop OUTLINER_OT_collection_objects_select sets BASE_SELECTED on
|
||||
* every object of the selected LayerCollection, recursively. */
|
||||
await partsRow.locator(".tree-node-name").first().click({ button: "right" });
|
||||
const selectObjects = page.getByRole("menuitem", { name: "选择对象 (Select Objects)", exact: true });
|
||||
await expect(selectObjects).toBeEnabled();
|
||||
await selectObjects.click();
|
||||
await expect(status).toContainText("已选择集合对象", { timeout: 30_000 });
|
||||
for (const name of partObjects) {
|
||||
await expect(page.locator(`.tree-row[aria-label="${name}"]`).first()).toHaveAttribute("data-selected", "true", { timeout: 15_000 });
|
||||
}
|
||||
|
||||
/* Deselect again to prove the toggle is not one-way. */
|
||||
await partsRow.locator(".tree-node-name").first().click({ button: "right" });
|
||||
await page.getByRole("menuitem", { name: "取消选择对象 (Deselect Objects)", exact: true }).click();
|
||||
for (const name of partObjects) {
|
||||
await expect(page.locator(`.tree-row[aria-label="${name}"]`).first()).toHaveAttribute("data-selected", "false", { timeout: 15_000 });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user