EMotionFXBuilderFixture.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 <AzTest/AzTest.h>
  10. #include <Tests/SystemComponentFixture.h>
  11. #include <AzCore/RTTI/RTTI.h>
  12. #include <AzCore/Component/Component.h>
  13. namespace EMotionFX
  14. {
  15. class EMotionFXTest_MockCatalog
  16. : public AZ::Data::AssetCatalog
  17. , public AZ::Data::AssetCatalogRequestBus::Handler
  18. {
  19. public:
  20. AZ_CLASS_ALLOCATOR(EMotionFXTest_MockCatalog, AZ::SystemAllocator);
  21. //////////////////////////////////////////////////////////////////////////
  22. // AssetCatalogRequestBus
  23. MOCK_METHOD1(GetAssetInfoById, AZ::Data::AssetInfo(const AZ::Data::AssetId& id));
  24. //////////////////////////////////////////////////////////////////////////
  25. MOCK_METHOD2(GetStreamInfoForLoad, AZ::Data::AssetStreamInfo(const AZ::Data::AssetId& id, const AZ::Data::AssetType& type));
  26. };
  27. class BuilderMockComponent
  28. : public AZ::Component
  29. {
  30. public:
  31. AZ_COMPONENT(BuilderMockComponent, "{6FD64C20-B0D1-41EC-9563-7B57C019300C}");
  32. BuilderMockComponent() = default;
  33. ~BuilderMockComponent() override = default;
  34. BuilderMockComponent(const BuilderMockComponent&) = delete;
  35. BuilderMockComponent(BuilderMockComponent&&) = default;
  36. BuilderMockComponent& operator=(const BuilderMockComponent&) = delete;
  37. BuilderMockComponent& operator=(BuilderMockComponent&&) = default;
  38. static void ReflectAnimGraphAndMotionSet(AZ::ReflectContext* context);
  39. static void Reflect(AZ::ReflectContext* context);
  40. //////////////////////////////////////////////////////////////////////////
  41. // AZ::Component
  42. void Activate() override;
  43. void Deactivate() override;
  44. //////////////////////////////////////////////////////////////////////////
  45. private:
  46. AZStd::vector<AZStd::unique_ptr<AZ::Data::AssetHandler> > m_assetHandlers;
  47. AZStd::unique_ptr<EMotionFXTest_MockCatalog> m_assetCatalog;
  48. };
  49. using EMotionFXBuilderFixture = ComponentFixture<
  50. AZ::AssetManagerComponent,
  51. AZ::JobManagerComponent,
  52. AZ::StreamerComponent,
  53. BuilderMockComponent
  54. >;
  55. }