AssetManagerTestFixture.h 2.7 KB

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