PrefabOverrideTestFixture.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AzToolsFramework/Prefab/PrefabFocusPublicInterface.h>
  10. #include <AzToolsFramework/Prefab/Overrides/PrefabOverridePublicInterface.h>
  11. #include <Prefab/PrefabTestFixture.h>
  12. namespace UnitTest
  13. {
  14. using namespace AzToolsFramework::Prefab;
  15. class PrefabOverrideTestFixture : public PrefabTestFixture
  16. {
  17. protected:
  18. void SetUpEditorFixtureImpl() override;
  19. //! Creates an entity within a nested prefab under level. The setup looks like:
  20. //! | Level
  21. //! | Prefab (grandparentContainerId)
  22. //! | Nested prefab (parentContainerId)
  23. //! | New Entity
  24. //! @param newEntityId The new entity id created under nested prefab.
  25. //! @param parentContainerId The container entity id of the nested prefab.
  26. //! @param grandparentContainerId The container entity id of the top-level prefab.
  27. void CreateEntityInNestedPrefab(AZ::EntityId& newEntityId, AZ::EntityId& parentContainerId, AZ::EntityId& grandparentContainerId);
  28. //! Focuses on the owning instance of the ancestor entity id and modifies the entity matching the entity id.
  29. //! This will make the edit become an override.
  30. //! @param entityId The id of entity to modify.
  31. //! @param ancestorEntityId The id of an ancestor entity to use for focusing on its owning prefab.
  32. void CreateAndValidateEditEntityOverride(AZ::EntityId entityId, AZ::EntityId ancestorEntityId);
  33. //! Focuses on the owning instance of the entity id and modifies it, which makes this a template edit.
  34. //! @param entityId The Id of the entity to modify.
  35. void EditEntityAndValidateNoOverride(AZ::EntityId entityId);
  36. PrefabOverridePublicInterface* m_prefabOverridePublicInterface = nullptr;
  37. PrefabFocusPublicInterface* m_prefabFocusPublicInterface = nullptr;
  38. };
  39. } // namespace UnitTest