AnimGraphNetworkingBusTests.cpp 2.2 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. #include <AzFramework/Components/TransformComponent.h>
  9. #include <Include/Integration/AnimGraphNetworkingBus.h>
  10. #include <Integration/Components/ActorComponent.h>
  11. #include <Integration/Components/AnimGraphComponent.h>
  12. #include <Tests/Integration/EntityComponentFixture.h>
  13. namespace EMotionFX
  14. {
  15. class AnimGraphNetworkingBusTests
  16. : public EntityComponentFixture
  17. {
  18. public:
  19. void SetUp() override
  20. {
  21. EntityComponentFixture::SetUp();
  22. m_entity = AZStd::make_unique<AZ::Entity>();
  23. m_entityId = AZ::EntityId(740216387);
  24. m_entity->SetId(m_entityId);
  25. m_entity->CreateComponent<AzFramework::TransformComponent>();
  26. m_entity->CreateComponent<Integration::ActorComponent>();
  27. auto animGraphComponent = m_entity->CreateComponent<Integration::AnimGraphComponent>();
  28. m_entity->Init();
  29. m_entity->Activate();
  30. AnimGraphInstance* animGraphInstance = animGraphComponent->GetAnimGraphInstance();
  31. EXPECT_EQ(animGraphInstance, nullptr) << "Expecting an invalid anim graph instance as no asset has been set.";
  32. }
  33. void TearDown() override
  34. {
  35. m_entity->Deactivate();
  36. m_entity.reset();
  37. EntityComponentFixture::TearDown();
  38. }
  39. AZ::EntityId m_entityId;
  40. AZStd::unique_ptr<AZ::Entity> m_entity;
  41. };
  42. TEST_F(AnimGraphNetworkingBusTests, AnimGraphNetworkingBus_GetActiveStates_Test)
  43. {
  44. NodeIndexContainer result;
  45. EMotionFX::AnimGraphComponentNetworkRequestBus::EventResult(result, m_entityId, &EMotionFX::AnimGraphComponentNetworkRequestBus::Events::GetActiveStates);
  46. }
  47. TEST_F(AnimGraphNetworkingBusTests, AnimGraphNetworkingBus_GetMotionPlaytimes_Test)
  48. {
  49. MotionNodePlaytimeContainer result;
  50. EMotionFX::AnimGraphComponentNetworkRequestBus::EventResult(result, m_entityId, &EMotionFX::AnimGraphComponentNetworkRequestBus::Events::GetMotionPlaytimes);
  51. }
  52. } // end namespace EMotionFX