diff --git a/tests/MetaCoreSmokeTests.cpp b/tests/MetaCoreSmokeTests.cpp index 819fde6..77d3734 100644 --- a/tests/MetaCoreSmokeTests.cpp +++ b/tests/MetaCoreSmokeTests.cpp @@ -425,6 +425,43 @@ void MetaCoreTestHierarchyEditingCommandsDirtyAndUndo() { MetaCoreExpect(editorContext.GetActiveObjectId() == *createdId, "Redo ReparentSelection should restore moved object selection"); MetaCoreExpect(scenePersistenceService->SaveCurrentScene(editorContext), "Hierarchy command scene should save after reparent"); + + const auto multiReparentFirstId = sceneEditingService->CreateGameObject( + editorContext, + "MultiReparentFirst", + false, + std::optional{0} + ); + const auto multiReparentSecondId = sceneEditingService->CreateGameObject( + editorContext, + "MultiReparentSecond", + false, + std::optional{0} + ); + MetaCoreExpect(multiReparentFirstId.has_value(), "CreateGameObject command should create first multi-reparent object"); + MetaCoreExpect(multiReparentSecondId.has_value(), "CreateGameObject command should create second multi-reparent object"); + MetaCoreExpect(scenePersistenceService->SaveCurrentScene(editorContext), "Hierarchy command scene should save before multi-reparent"); + const std::vector multiReparentSelection{*multiReparentFirstId, *multiReparentSecondId}; + editorContext.SetSelection(multiReparentSelection, *multiReparentSecondId); + MetaCoreExpect(sceneEditingService->ReparentSelection(editorContext, *parentId), "ReparentSelection command should reparent multiple selected objects"); + MetaCoreExpect(scene.FindGameObject(*multiReparentFirstId).GetParentId() == *parentId, "ReparentSelection should set first selected object parent id"); + MetaCoreExpect(scene.FindGameObject(*multiReparentSecondId).GetParentId() == *parentId, "ReparentSelection should set second selected object parent id"); + MetaCoreExpect(editorContext.GetActiveObjectId() == *multiReparentSecondId, "ReparentSelection should keep multi-selection active object"); + MetaCoreExpect(editorContext.GetSelectedObjectIds() == multiReparentSelection, "ReparentSelection should keep multi-selection list"); + MetaCoreExpect(scenePersistenceService->IsSceneDirty(), "Multi ReparentSelection command should mark scene dirty"); + MetaCoreExpect(editorContext.UndoCommand(), "Undo multi ReparentSelection should succeed"); + MetaCoreExpect(scene.FindGameObject(*multiReparentFirstId).GetParentId() == 0, "Undo multi ReparentSelection should restore first selected object root parent"); + MetaCoreExpect(scene.FindGameObject(*multiReparentSecondId).GetParentId() == 0, "Undo multi ReparentSelection should restore second selected object root parent"); + MetaCoreExpect(editorContext.GetActiveObjectId() == *multiReparentSecondId, "Undo multi ReparentSelection should restore active object"); + MetaCoreExpect(editorContext.GetSelectedObjectIds() == multiReparentSelection, "Undo multi ReparentSelection should restore selection list"); + MetaCoreExpect(!scenePersistenceService->IsSceneDirty(), "Undo multi ReparentSelection should restore clean baseline"); + MetaCoreExpect(editorContext.RedoCommand(), "Redo multi ReparentSelection should succeed"); + MetaCoreExpect(scene.FindGameObject(*multiReparentFirstId).GetParentId() == *parentId, "Redo multi ReparentSelection should restore first selected object parent id"); + MetaCoreExpect(scene.FindGameObject(*multiReparentSecondId).GetParentId() == *parentId, "Redo multi ReparentSelection should restore second selected object parent id"); + MetaCoreExpect(editorContext.GetActiveObjectId() == *multiReparentSecondId, "Redo multi ReparentSelection should restore active object"); + MetaCoreExpect(editorContext.GetSelectedObjectIds() == multiReparentSelection, "Redo multi ReparentSelection should restore selection list"); + + MetaCoreExpect(scenePersistenceService->SaveCurrentScene(editorContext), "Hierarchy command scene should save after multi-reparent"); editorContext.SelectOnly(*createdId); const std::size_t countBeforeDuplicate = scene.GetGameObjects().size(); MetaCoreExpect(clipboardService->DuplicateSelection(editorContext), "DuplicateSelection command should duplicate selected object");