test(editor): cover reparent selection undo state

This commit is contained in:
ayuan9957 2026-06-23 22:06:30 +08:00
parent 9c7c0a1798
commit fcffd651f4

View File

@ -406,12 +406,15 @@ void MetaCoreTestHierarchyEditingCommandsDirtyAndUndo() {
editorContext.SelectOnly(*createdId);
MetaCoreExpect(sceneEditingService->ReparentSelection(editorContext, *parentId), "ReparentSelection command should reparent selected object");
MetaCoreExpect(scene.FindGameObject(*createdId).GetParentId() == *parentId, "ReparentSelection should set parent id");
MetaCoreExpect(editorContext.GetActiveObjectId() == *createdId, "ReparentSelection should keep moved object selected");
MetaCoreExpect(scenePersistenceService->IsSceneDirty(), "ReparentSelection command should mark scene dirty");
MetaCoreExpect(editorContext.UndoCommand(), "Undo ReparentSelection should succeed");
MetaCoreExpect(scene.FindGameObject(*createdId).GetParentId() == 0, "Undo ReparentSelection should restore root parent");
MetaCoreExpect(editorContext.GetActiveObjectId() == *createdId, "Undo ReparentSelection should restore moved object selection");
MetaCoreExpect(!scenePersistenceService->IsSceneDirty(), "Undo ReparentSelection should restore clean baseline");
MetaCoreExpect(editorContext.RedoCommand(), "Redo ReparentSelection should succeed");
MetaCoreExpect(scene.FindGameObject(*createdId).GetParentId() == *parentId, "Redo ReparentSelection should restore parent id");
MetaCoreExpect(editorContext.GetActiveObjectId() == *createdId, "Redo ReparentSelection should restore moved object selection");
MetaCoreExpect(scenePersistenceService->SaveCurrentScene(editorContext), "Hierarchy command scene should save after reparent");
editorContext.SelectOnly(*createdId);