3
0

AssetManagerTestFixture.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 <AzCore/UnitTest/TestTypes.h>
  10. #include <AzCore/Component/ComponentApplicationBus.h>
  11. #include <AzCore/RTTI/ReflectionManager.h>
  12. #include <AzCore/Serialization/SerializeContext.h>
  13. namespace UnitTest
  14. {
  15. /**
  16. * Unit test fixture for setting up an AssetManager
  17. */
  18. class AssetManagerTestFixture
  19. : public LeakDetectionFixture
  20. // Only used to provide the serialize context for now
  21. , public AZ::ComponentApplicationBus::Handler
  22. {
  23. protected:
  24. void SetUp() override;
  25. void TearDown() override;
  26. //////////////////////////////////////////////////////////////////////////
  27. // ComponentApplicationMessages.
  28. AZ::ComponentApplication* GetApplication() override { return nullptr; }
  29. void RegisterComponentDescriptor(const AZ::ComponentDescriptor*) override { }
  30. void UnregisterComponentDescriptor(const AZ::ComponentDescriptor*) override { }
  31. void RegisterEntityAddedEventHandler(AZ::EntityAddedEvent::Handler&) override { }
  32. void RegisterEntityRemovedEventHandler(AZ::EntityRemovedEvent::Handler&) override { }
  33. void RegisterEntityActivatedEventHandler(AZ::EntityActivatedEvent::Handler&) override { }
  34. void RegisterEntityDeactivatedEventHandler(AZ::EntityDeactivatedEvent::Handler&) override { }
  35. void SignalEntityActivated(AZ::Entity*) override { }
  36. void SignalEntityDeactivated(AZ::Entity*) override { }
  37. bool AddEntity(AZ::Entity*) override { return false; }
  38. bool RemoveEntity(AZ::Entity*) override { return false; }
  39. bool DeleteEntity(const AZ::EntityId&) override { return false; }
  40. AZ::Entity* FindEntity(const AZ::EntityId&) override { return nullptr; }
  41. AZ::BehaviorContext* GetBehaviorContext() override { return nullptr; }
  42. AZ::JsonRegistrationContext* GetJsonRegistrationContext() override { return nullptr; }
  43. const char* GetEngineRoot() const override { return nullptr; }
  44. const char* GetExecutableFolder() const override { return nullptr; }
  45. void EnumerateEntities(const EntityCallback& /*callback*/) override {}
  46. AZ::SerializeContext* GetSerializeContext() override
  47. {
  48. return m_reflectionManager ? m_reflectionManager->GetReflectContext<AZ::SerializeContext>() : nullptr;
  49. }
  50. void QueryApplicationType(AZ::ApplicationTypeQuery& /*appType*/) const override {}
  51. //////////////////////////////////////////////////////////////////////////
  52. private:
  53. AZStd::unique_ptr<AZ::ReflectionManager> m_reflectionManager;
  54. };
  55. } // namespace UnitTest