Integrating latest 47acbe8

This commit is contained in:
alexpete
2021-03-25 13:57:57 -07:00
parent 448c549698
commit 75dc720198
10312 changed files with 2711566 additions and 671451 deletions
@@ -38,6 +38,11 @@ namespace UnitTest
AZStd::unique_ptr<Instance> firstInstance = m_prefabSystemComponent->CreatePrefab({ newEntity }, {}, "test/path");
ASSERT_TRUE(firstInstance);
EntityAliasOptionalReference newEntityAliasReference = firstInstance->GetEntityAlias(entityId);
ASSERT_TRUE(newEntityAliasReference);
EntityAlias newEntityAlias = newEntityAliasReference.value();
//get template id
TemplateId templateId = firstInstance->GetTemplateId();
@@ -69,22 +74,14 @@ namespace UnitTest
secondInstance->ActivateNestedEntities();
//get the entity id
AZStd::vector<AZ::EntityId> entityIdVector;
secondInstance->GetEntityIds([&entityIdVector](const AZ::EntityId& entityId)
{
entityIdVector.push_back(entityId);
return true;
});
EXPECT_EQ(entityIdVector.size(), 1);
AZStd::optional<AZ::EntityId> secondEntityId = entityIdVector[0];
AZ::EntityId secondEntityId = secondInstance->GetEntityId(newEntityAlias);
ASSERT_TRUE(secondEntityId.IsValid());
//verify template updated correctly
//get the values from the transform on the entity
float confirmXValue = 0.0f;
AZ::TransformBus::EventResult(confirmXValue, entityId, &AZ::TransformInterface::GetWorldX);
AZ::TransformBus::EventResult(confirmXValue, secondEntityId.value(), &AZ::TransformInterface::GetWorldX);
AZ::TransformBus::EventResult(confirmXValue, secondEntityId, &AZ::TransformInterface::GetWorldX);
ASSERT_TRUE(confirmXValue == updatedXValue);
}
@@ -128,20 +125,21 @@ namespace UnitTest
//get the entity id
AZStd::vector<AZ::EntityId> entityIdVector;
secondInstance->GetEntityIds([&entityIdVector](const AZ::EntityId& entityId)
secondInstance->GetEntityIds([&entityIdVector](AZ::EntityId entityId)
{
entityIdVector.push_back(entityId);
return true;
});
EXPECT_EQ(entityIdVector.size(), 1);
// There should be 2 entities in the instance, the container entity and the one we added
EXPECT_EQ(entityIdVector.size(), 2);
}
TEST_F(PrefabInstanceToTemplateTests, PrefabUpdateTemplate_RemoveEntityFromInstance)
{
//create template with single entity
const char* newEntityName = "New Entity";
AZ::Entity* newEntity = CreateEntity(newEntityName, false);
AZ::Entity* newEntity = CreateEntity("New Entity", false);
ASSERT_TRUE(newEntity);
AZ::EntityId entityId = newEntity->GetId();
@@ -177,13 +175,14 @@ namespace UnitTest
//get the entity id
AZStd::vector<AZ::EntityId> entityIdVector;
secondInstance->GetEntityIds([&entityIdVector](const AZ::EntityId& entityId)
secondInstance->GetEntityIds([&entityIdVector](AZ::EntityId entityId)
{
entityIdVector.push_back(entityId);
return true;
});
EXPECT_EQ(entityIdVector.size(), 0);
// There should be 1 entity, the container and no others since we removed the other
EXPECT_EQ(entityIdVector.size(), 1);
}
TEST_F(PrefabInstanceToTemplateTests, PrefabUpdateTemplate_AddInstanceToInstance)
@@ -207,8 +206,8 @@ namespace UnitTest
AZStd::unique_ptr<Instance> addedInstance = m_prefabSystemComponent->CreatePrefab({}, {}, "test/pathtest");
//add instance to instance
InstanceOptionalConstReference addedInstanceRef { firstInstance->AddInstance(AZStd::move(addedInstance)) };
const AzToolsFramework::Prefab::InstanceAlias addedAlias = addedInstanceRef->get().GetInstanceAlias();
Instance& addedInstanceRef = firstInstance->AddInstance(AZStd::move(addedInstance));
const AzToolsFramework::Prefab::InstanceAlias addedAlias = addedInstanceRef.GetInstanceAlias();
//create document with after change snapshot
PrefabDom instanceDomAfterUpdate;