Add tests for FocusOnParentOfFocusedPrefab. Refactor tests to match, and re-enable disabled tests as the fixture now correctly supports the Prefab EOS. (#7372)

Signed-off-by: Danilo Aimini <82231674+AMZN-daimini@users.noreply.github.com>
monroegm-disable-blank-issue-2
Danilo Aimini 4 years ago committed by GitHub
parent e85ec9baf8
commit 65e651388c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -114,9 +114,7 @@ namespace UnitTest
inline static const char* Passenger2EntityName = "Passenger2"; inline static const char* Passenger2EntityName = "Passenger2";
}; };
// Test was disabled because the implementation of GetFocusedPrefabInstance now relies on the Prefab EOS, TEST_F(PrefabFocusTests, FocusOnOwningPrefabRootContainer)
// which is not used by our test environment. This can be restored once Instance handles are implemented.
TEST_F(PrefabFocusTests, DISABLED_PrefabFocus_FocusOnOwningPrefab_RootContainer)
{ {
// Verify FocusOnOwningPrefab works when passing the container entity of the root prefab. // Verify FocusOnOwningPrefab works when passing the container entity of the root prefab.
{ {
@ -131,9 +129,7 @@ namespace UnitTest
} }
} }
// Test was disabled because the implementation of GetFocusedPrefabInstance now relies on the Prefab EOS, TEST_F(PrefabFocusTests, FocusOnOwningPrefabRootEntity)
// which is not used by our test environment. This can be restored once Instance handles are implemented.
TEST_F(PrefabFocusTests, DISABLED_PrefabFocus_FocusOnOwningPrefab_RootEntity)
{ {
// Verify FocusOnOwningPrefab works when passing a nested entity of the root prefab. // Verify FocusOnOwningPrefab works when passing a nested entity of the root prefab.
{ {
@ -148,7 +144,7 @@ namespace UnitTest
} }
} }
TEST_F(PrefabFocusTests, PrefabFocus_FocusOnOwningPrefab_NestedContainer) TEST_F(PrefabFocusTests, FocusOnOwningPrefabNestedContainer)
{ {
// Verify FocusOnOwningPrefab works when passing the container entity of a nested prefab. // Verify FocusOnOwningPrefab works when passing the container entity of a nested prefab.
{ {
@ -162,7 +158,7 @@ namespace UnitTest
} }
} }
TEST_F(PrefabFocusTests, PrefabFocus_FocusOnOwningPrefab_NestedEntity) TEST_F(PrefabFocusTests, FocusOnOwningPrefabNestedEntity)
{ {
// Verify FocusOnOwningPrefab works when passing a nested entity of the a nested prefab. // Verify FocusOnOwningPrefab works when passing a nested entity of the a nested prefab.
{ {
@ -176,7 +172,7 @@ namespace UnitTest
} }
} }
TEST_F(PrefabFocusTests, PrefabFocus_FocusOnOwningPrefab_Clear) TEST_F(PrefabFocusTests, FocusOnOwningPrefabClear)
{ {
// Verify FocusOnOwningPrefab points to the root prefab when the focus is cleared. // Verify FocusOnOwningPrefab points to the root prefab when the focus is cleared.
{ {
@ -196,7 +192,32 @@ namespace UnitTest
} }
} }
TEST_F(PrefabFocusTests, PrefabFocus_IsOwningPrefabBeingFocused_Content) TEST_F(PrefabFocusTests, FocusOnParentOfFocusedPrefabLeaf)
{
// Call FocusOnParentOfFocusedPrefab on a leaf instance and verify the parent is focused correctly.
{
m_prefabFocusPublicInterface->FocusOnOwningPrefab(m_instanceMap[CarEntityName]->GetContainerEntityId());
m_prefabFocusPublicInterface->FocusOnParentOfFocusedPrefab(m_editorEntityContextId);
EXPECT_EQ(
&m_prefabFocusInterface->GetFocusedPrefabInstance(m_editorEntityContextId)->get(),
m_instanceMap[StreetEntityName]
);
}
}
TEST_F(PrefabFocusTests, FocusOnParentOfFocusedPrefabRoot)
{
// Call FocusOnParentOfFocusedPrefab on the root instance and verify the operation fails.
{
m_prefabFocusPublicInterface->FocusOnOwningPrefab(m_instanceMap[CityEntityName]->GetContainerEntityId());
auto outcome = m_prefabFocusPublicInterface->FocusOnParentOfFocusedPrefab(m_editorEntityContextId);
EXPECT_FALSE(outcome.IsSuccess());
}
}
TEST_F(PrefabFocusTests, IsOwningPrefabBeingFocusedContent)
{ {
// Verify IsOwningPrefabBeingFocused returns true for all entities in a focused prefab (container/nested) // Verify IsOwningPrefabBeingFocused returns true for all entities in a focused prefab (container/nested)
{ {
@ -207,7 +228,7 @@ namespace UnitTest
} }
} }
TEST_F(PrefabFocusTests, PrefabFocus_IsOwningPrefabBeingFocused_AncestorsDescendants) TEST_F(PrefabFocusTests, IsOwningPrefabBeingFocusedAncestorsDescendants)
{ {
// Verify IsOwningPrefabBeingFocused returns false for all entities not in a focused prefab (ancestors/descendants) // Verify IsOwningPrefabBeingFocused returns false for all entities not in a focused prefab (ancestors/descendants)
{ {
@ -221,7 +242,7 @@ namespace UnitTest
} }
} }
TEST_F(PrefabFocusTests, PrefabFocus_IsOwningPrefabBeingFocused_Siblings) TEST_F(PrefabFocusTests, IsOwningPrefabBeingFocusedSiblings)
{ {
// Verify IsOwningPrefabBeingFocused returns false for all entities not in a focused prefab (siblings) // Verify IsOwningPrefabBeingFocused returns false for all entities not in a focused prefab (siblings)
{ {

Loading…
Cancel
Save