Fix Prefab builder test (#5377)

We were destructively moving the DOM template into the builder, leaving the Prefab system with an invalid DOM when teardown occurs. For now, this just copies the document to fix this specific test failure, but we may want to consider making `FindTemplateDom` return a const document and requiring that mutations get routed through the prefab system component to avoid similar situations in the future.

Signed-off-by: nvsickle <nvsickle@amazon.com>
monroegm-disable-blank-issue-2
Nicholas Van Sickle 4 years ago committed by GitHub
parent 652e35b0ca
commit 16f5980983
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -102,7 +102,9 @@ namespace UnitTest
prefabBuilderComponent.Activate();
AZStd::vector<AssetBuilderSDK::JobProduct> jobProducts;
auto&& prefabDom = prefabSystemComponentInterface->FindTemplateDom(parentInstance->GetTemplateId());
// Make a copy of the template DOM, as the prefab system still owns the existing template
AzToolsFramework::Prefab::PrefabDom prefabDom;
prefabDom.CopyFrom(prefabSystemComponentInterface->FindTemplateDom(parentInstance->GetTemplateId()), prefabDom.GetAllocator(), false);
ASSERT_TRUE(prefabBuilderComponent.ProcessPrefab({AZ::Crc32("pc")}, "parent.prefab", "unused", AZ::Uuid(), prefabDom, jobProducts));

Loading…
Cancel
Save