Fix compilation error and failing unit test
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <AzCore/std/containers/unordered_set.h>
|
||||
#include <AzToolsFramework/Prefab/Spawnable/SpawnableUtils.h>
|
||||
|
||||
#pragma optimize("", off)
|
||||
namespace UnitTest
|
||||
{
|
||||
using SpawnableCreateTest = PrefabTestFixture;
|
||||
@@ -71,24 +72,29 @@ namespace UnitTest
|
||||
m_prefabSystemComponent->CreatePrefab({ entitiesCreated[0] }, {}, "test/path1"));
|
||||
ASSERT_TRUE(firstInstance);
|
||||
|
||||
ASSERT_TRUE(firstInstance->HasContainerEntity());
|
||||
expectedEntityNameSet.insert(firstInstance->GetContainerEntity()->get().GetName());
|
||||
|
||||
AZStd::unique_ptr<AzToolsFramework::Prefab::Instance> secondInstance(
|
||||
m_prefabSystemComponent->CreatePrefab({ entitiesCreated[1] }, MakeInstanceList(AZStd::move(firstInstance)), "test/path2"));
|
||||
ASSERT_TRUE(secondInstance);
|
||||
|
||||
ASSERT_TRUE(secondInstance->HasContainerEntity());
|
||||
expectedEntityNameSet.insert(secondInstance->GetContainerEntity()->get().GetName());
|
||||
|
||||
AZStd::unique_ptr<AzToolsFramework::Prefab::Instance> thirdInstance(
|
||||
m_prefabSystemComponent->CreatePrefab({ entitiesCreated[2] }, MakeInstanceList(AZStd::move(secondInstance)), "test/path3"));
|
||||
ASSERT_TRUE(thirdInstance);
|
||||
|
||||
ASSERT_TRUE(thirdInstance->HasContainerEntity());
|
||||
auto& containerEntity = thirdInstance->GetContainerEntity()->get();
|
||||
expectedEntityNameSet.insert(containerEntity.GetName());
|
||||
expectedEntityNameSet.insert(thirdInstance->GetContainerEntity()->get().GetName());
|
||||
|
||||
//Create Spawnable
|
||||
auto& prefabDom = m_prefabSystemComponent->FindTemplateDom(thirdInstance->GetTemplateId());
|
||||
AzFramework::Spawnable spawnable;
|
||||
AzToolsFramework::Prefab::SpawnableUtils::CreateSpawnable(spawnable, prefabDom);
|
||||
|
||||
EXPECT_EQ(spawnable.GetEntities().size() - 1, normalEntityCount); // 1 for container entity
|
||||
EXPECT_EQ(spawnable.GetEntities().size(), normalEntityCount + 3); // +1 for each container entity
|
||||
const auto& spawnableEntities = spawnable.GetEntities();
|
||||
AZStd::unordered_set<AZStd::string> actualEntityNameSet;
|
||||
|
||||
@@ -97,6 +103,6 @@ namespace UnitTest
|
||||
actualEntityNameSet.insert(spawnableEntity->GetName());
|
||||
}
|
||||
|
||||
EXPECT_EQ(expectedEntityNameSet, actualEntityNameSet);
|
||||
EXPECT_EQ(actualEntityNameSet, expectedEntityNameSet);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user