AnimGraphComponentBusTests.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  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 <EMotionFX/Source/AnimGraphBindPoseNode.h>
  10. #include <EMotionFX/Source/AnimGraphMotionNode.h>
  11. #include <EMotionFX/Source/AnimGraphObject.h>
  12. #include <EMotionFX/Source/AnimGraphStateMachine.h>
  13. #include <EMotionFX/Source/AnimGraphStateTransition.h>
  14. #include <EMotionFX/Source/BlendTree.h>
  15. #include <EMotionFX/Source/BlendTreeBlend2Node.h>
  16. #include <EMotionFX/Source/BlendTreeBlendNNode.h>
  17. #include <EMotionFX/Source/BlendTreeParameterNode.h>
  18. #include <EMotionFX/Source/Parameter/BoolParameter.h>
  19. #include <EMotionFX/Source/Parameter/FloatSliderParameter.h>
  20. #include <EMotionFX/Source/Parameter/Vector2Parameter.h>
  21. #include <EMotionFX/Source/Parameter/Vector3Parameter.h>
  22. #include <EMotionFX/Source/Parameter/RotationParameter.h>
  23. #include <EMotionFX/Source/Parameter/StringParameter.h>
  24. #include <EMotionFX/Source/Parameter/ParameterFactory.h>
  25. #include <Include/Integration/AnimGraphComponentBus.h>
  26. #include <Integration/Components/ActorComponent.h>
  27. #include <Integration/Components/AnimGraphComponent.h>
  28. #include <MCore/Source/AttributeFloat.h>
  29. #include <Tests/Integration/EntityComponentFixture.h>
  30. #include <Tests/TestAssetCode/AnimGraphFactory.h>
  31. #include <Tests/TestAssetCode/ActorFactory.h>
  32. #include <Tests/TestAssetCode/JackActor.h>
  33. #include <Tests/TestAssetCode/TestActorAssets.h>
  34. namespace EMotionFX
  35. {
  36. class AnimGraphComponentNotificationTestBus
  37. : Integration::AnimGraphComponentNotificationBus::Handler
  38. {
  39. public:
  40. AnimGraphComponentNotificationTestBus(AZ::EntityId entityId)
  41. {
  42. Integration::AnimGraphComponentNotificationBus::Handler::BusConnect(entityId);
  43. }
  44. ~AnimGraphComponentNotificationTestBus()
  45. {
  46. Integration::AnimGraphComponentNotificationBus::Handler::BusDisconnect();
  47. }
  48. MOCK_METHOD1(OnAnimGraphInstanceCreated, void(EMotionFX::AnimGraphInstance*));
  49. MOCK_METHOD1(OnAnimGraphInstanceDestroyed, void(EMotionFX::AnimGraphInstance*));
  50. MOCK_METHOD4(OnAnimGraphFloatParameterChanged, void(EMotionFX::AnimGraphInstance*, size_t, float, float));
  51. MOCK_METHOD4(OnAnimGraphBoolParameterChanged, void(EMotionFX::AnimGraphInstance*, size_t, bool, bool));
  52. MOCK_METHOD4(OnAnimGraphStringParameterChanged, void(EMotionFX::AnimGraphInstance*, size_t, const char*, const char*));
  53. MOCK_METHOD4(OnAnimGraphVector2ParameterChanged, void(EMotionFX::AnimGraphInstance*, size_t, const AZ::Vector2&, const AZ::Vector2&));
  54. MOCK_METHOD4(OnAnimGraphVector3ParameterChanged, void(EMotionFX::AnimGraphInstance*, size_t, const AZ::Vector3&, const AZ::Vector3&));
  55. MOCK_METHOD4(OnAnimGraphRotationParameterChanged, void(EMotionFX::AnimGraphInstance*, size_t, const AZ::Quaternion&, const AZ::Quaternion&));
  56. };
  57. class AnimGraphComponentBusTests
  58. : public EntityComponentFixture
  59. {
  60. public:
  61. void SetUp() override
  62. {
  63. EntityComponentFixture::SetUp();
  64. m_entity = AZStd::make_unique<AZ::Entity>();
  65. m_entityId = AZ::EntityId(740216387);
  66. m_entity->SetId(m_entityId);
  67. AZ::Data::AssetId actorAssetId("{5060227D-B6F4-422E-BF82-41AAC5F228A5}");
  68. AZStd::unique_ptr<Actor> actor = ActorFactory::CreateAndInit<JackNoMeshesActor>();
  69. AZ::Data::Asset<Integration::ActorAsset> actorAsset = TestActorAssets::GetAssetFromActor(actorAssetId, AZStd::move(actor));
  70. Integration::ActorComponent::Configuration actorConf;
  71. actorConf.m_actorAsset = actorAsset;
  72. m_entity->CreateComponent<AzFramework::TransformComponent>();
  73. m_actorComponent = m_entity->CreateComponent<Integration::ActorComponent>(&actorConf);
  74. m_animGraphComponent = m_entity->CreateComponent<Integration::AnimGraphComponent>();
  75. m_entity->Init();
  76. // Anim graph asset.
  77. AZ::Data::AssetId animGraphAssetId("{37629818-5166-4B96-83F5-5818B6A1F449}");
  78. m_animGraphComponent->SetAnimGraphAssetId(animGraphAssetId);
  79. AZ::Data::Asset<Integration::AnimGraphAsset> animGraphAsset = AZ::Data::AssetManager::Instance().CreateAsset<Integration::AnimGraphAsset>(animGraphAssetId);
  80. AZStd::unique_ptr<TwoMotionNodeAnimGraph> motionNodeAnimGraph = AnimGraphFactory::Create<TwoMotionNodeAnimGraph>();
  81. m_animGraph = motionNodeAnimGraph.get();
  82. motionNodeAnimGraph.release();
  83. animGraphAsset.GetAs<Integration::AnimGraphAsset>()->SetData(m_animGraph);
  84. EXPECT_EQ(animGraphAsset.IsReady(), true) << "Anim graph asset is not ready yet.";
  85. m_animGraphComponent->OnAssetReady(animGraphAsset);
  86. // Motion set asset.
  87. AZ::Data::AssetId motionSetAssetId("{224BFF5F-D0AD-4216-9CEF-42F419CC6265}");
  88. m_animGraphComponent->SetMotionSetAssetId(motionSetAssetId);
  89. AZ::Data::Asset<Integration::MotionSetAsset> motionSetAsset = AZ::Data::AssetManager::Instance().CreateAsset<Integration::MotionSetAsset>(motionSetAssetId);
  90. motionSetAsset.GetAs<Integration::MotionSetAsset>()->SetData(new MotionSet());
  91. EXPECT_EQ(motionSetAsset.IsReady(), true) << "Motion set asset is not ready yet.";
  92. m_animGraphComponent->OnAssetReady(motionSetAsset);
  93. }
  94. void TearDown() override
  95. {
  96. m_entity.reset();
  97. EntityComponentFixture::TearDown();
  98. }
  99. void ActivateEntity()
  100. {
  101. // Set the actor asset and create the actor instance.
  102. m_actorComponent->SetActorAsset(m_actorComponent->GetActorAsset());
  103. m_entity->Activate();
  104. // Run one tick so that the actor asset has time to finish activating.
  105. // (Actor initialization is deferred to the next tick after the OnAssetReady call)
  106. AZ::TickBus::Broadcast(&AZ::TickEvents::OnTick, 0.0f, AZ::ScriptTimePoint());
  107. m_animGraphInstance = m_animGraphComponent->GetAnimGraphInstance();
  108. EXPECT_NE(m_animGraphInstance, nullptr) << "Expecting valid anim graph instance.";
  109. }
  110. void PrepareParameterTest(ValueParameter* parameter)
  111. {
  112. ActivateEntity();
  113. m_animGraphInstance = m_animGraphComponent->GetAnimGraphInstance();
  114. EXPECT_NE(m_animGraphInstance, nullptr) << "Expecting valid anim graph instance.";
  115. m_parameterName = "Test Parameter";
  116. parameter->SetName(m_parameterName.c_str());
  117. m_animGraph->AddParameter(parameter);
  118. m_animGraphInstance->AddMissingParameterValues();
  119. // FindParameterIndex() test
  120. Integration::AnimGraphComponentRequestBus::EventResult(m_parameterIndex, m_entityId, &Integration::AnimGraphComponentRequestBus::Events::FindParameterIndex, m_parameterName.c_str());
  121. EXPECT_EQ(m_parameterIndex, 0) << "Expected the index for the first parameter.";
  122. // FindParameterName() test
  123. const char* foundParameterName = nullptr;
  124. Integration::AnimGraphComponentRequestBus::EventResult(foundParameterName, m_entityId, &Integration::AnimGraphComponentRequestBus::Events::FindParameterName, m_parameterIndex);
  125. EXPECT_STREQ(foundParameterName, m_parameterName.c_str()) << "Expected the index for the first parameter.";
  126. }
  127. AZ::EntityId m_entityId;
  128. AZStd::unique_ptr<AZ::Entity> m_entity;
  129. TwoMotionNodeAnimGraph* m_animGraph = nullptr;
  130. Integration::ActorComponent* m_actorComponent = nullptr;
  131. Integration::AnimGraphComponent* m_animGraphComponent = nullptr;
  132. AnimGraphInstance* m_animGraphInstance = nullptr;
  133. size_t m_parameterIndex = InvalidIndex;
  134. std::string m_parameterName;
  135. };
  136. TEST_F(AnimGraphComponentBusTests, GetAnimGraphInstance)
  137. {
  138. ActivateEntity();
  139. AnimGraphInstance* animgrGraphInstance = nullptr;
  140. Integration::AnimGraphComponentRequestBus::EventResult(animgrGraphInstance, m_entityId, &Integration::AnimGraphComponentRequestBus::Events::GetAnimGraphInstance);
  141. EXPECT_NE(animgrGraphInstance, nullptr) << "Expecting valid anim graph instance.";
  142. EXPECT_EQ(animgrGraphInstance, m_animGraphInstance) << "Expecting the anim graph instance from our anim graph component.";
  143. }
  144. TEST_F(AnimGraphComponentBusTests, FloatParameter)
  145. {
  146. AnimGraphComponentNotificationTestBus testBus(m_entityId);
  147. EXPECT_CALL(testBus, OnAnimGraphInstanceCreated(testing::_));
  148. PrepareParameterTest(aznew FloatSliderParameter());
  149. {
  150. testing::InSequence parameterChangedCallSequence;
  151. EXPECT_CALL(testBus, OnAnimGraphFloatParameterChanged(m_animGraphInstance, m_parameterIndex, testing::_, 3.0f));
  152. EXPECT_CALL(testBus, OnAnimGraphFloatParameterChanged(m_animGraphInstance, m_parameterIndex, 3.0f, 4.0f));
  153. }
  154. // SetParameterFloat/GetParameterFloat() test
  155. Integration::AnimGraphComponentRequestBus::Event(m_entityId, &Integration::AnimGraphComponentRequestBus::Events::SetParameterFloat, m_parameterIndex, 3.0f);
  156. float newValue = 0.0f;
  157. Integration::AnimGraphComponentRequestBus::EventResult(newValue, m_entityId, &Integration::AnimGraphComponentRequestBus::Events::GetParameterFloat, m_parameterIndex);
  158. EXPECT_EQ(newValue, 3.0f) << "Expected a parameter value of 3.0.";
  159. // SetNamedParameterFloat/GetNamedParameterFloat() test
  160. Integration::AnimGraphComponentRequestBus::Event(m_entityId, &Integration::AnimGraphComponentRequestBus::Events::SetNamedParameterFloat, m_parameterName.c_str(), 4.0f);
  161. Integration::AnimGraphComponentRequestBus::EventResult(newValue, m_entityId, &Integration::AnimGraphComponentRequestBus::Events::GetNamedParameterFloat, m_parameterName.c_str());
  162. EXPECT_EQ(newValue, 4.0f) << "Expected a parameter value of 3.0.";
  163. }
  164. TEST_F(AnimGraphComponentBusTests, BoolParameter)
  165. {
  166. AnimGraphComponentNotificationTestBus testBus(m_entityId);
  167. EXPECT_CALL(testBus, OnAnimGraphInstanceCreated(testing::_));
  168. PrepareParameterTest(aznew BoolParameter());
  169. {
  170. testing::InSequence parameterChangedCallSequence;
  171. EXPECT_CALL(testBus, OnAnimGraphBoolParameterChanged(m_animGraphInstance, m_parameterIndex, testing::_, true));
  172. EXPECT_CALL(testBus, OnAnimGraphBoolParameterChanged(m_animGraphInstance, m_parameterIndex, true, false));
  173. }
  174. // SetParameterBool/GetParameterBool() test
  175. Integration::AnimGraphComponentRequestBus::Event(m_entityId, &Integration::AnimGraphComponentRequestBus::Events::SetParameterBool, m_parameterIndex, true);
  176. bool newValue = false;
  177. Integration::AnimGraphComponentRequestBus::EventResult(newValue, m_entityId, &Integration::AnimGraphComponentRequestBus::Events::GetParameterBool, m_parameterIndex);
  178. EXPECT_EQ(newValue, true) << "Expected true as parameter value.";
  179. // SetNamedParameterBool/GetNamedParameterBool() test
  180. Integration::AnimGraphComponentRequestBus::Event(m_entityId, &Integration::AnimGraphComponentRequestBus::Events::SetNamedParameterBool, m_parameterName.c_str(), false);
  181. Integration::AnimGraphComponentRequestBus::EventResult(newValue, m_entityId, &Integration::AnimGraphComponentRequestBus::Events::GetNamedParameterBool, m_parameterName.c_str());
  182. EXPECT_EQ(newValue, false) << "Expected false as parameter value.";
  183. }
  184. TEST_F(AnimGraphComponentBusTests, StringParameter)
  185. {
  186. AnimGraphComponentNotificationTestBus testBus(m_entityId);
  187. EXPECT_CALL(testBus, OnAnimGraphInstanceCreated(testing::_));
  188. PrepareParameterTest(aznew StringParameter());
  189. EXPECT_CALL(testBus, OnAnimGraphStringParameterChanged(m_animGraphInstance, m_parameterIndex, testing::_, testing::_))
  190. .Times(2);
  191. // SetParameterString/GetParameterString() test
  192. Integration::AnimGraphComponentRequestBus::Event(m_entityId, &Integration::AnimGraphComponentRequestBus::Events::SetParameterString, m_parameterIndex, "Test String");
  193. AZStd::string newValue;
  194. Integration::AnimGraphComponentRequestBus::EventResult(newValue, m_entityId, &Integration::AnimGraphComponentRequestBus::Events::GetParameterString, m_parameterIndex);
  195. EXPECT_STREQ(newValue.c_str(), "Test String") << "Expected the test string parameter.";
  196. // SetNamedParameterString/GetNamedParameterString() test
  197. Integration::AnimGraphComponentRequestBus::Event(m_entityId, &Integration::AnimGraphComponentRequestBus::Events::SetNamedParameterString, m_parameterName.c_str(), "Yet Another String");
  198. Integration::AnimGraphComponentRequestBus::EventResult(newValue, m_entityId, &Integration::AnimGraphComponentRequestBus::Events::GetNamedParameterString, m_parameterName.c_str());
  199. EXPECT_STREQ(newValue.c_str(), "Yet Another String") << "Expected yet another string.";
  200. }
  201. TEST_F(AnimGraphComponentBusTests, Vector2Parameter)
  202. {
  203. AnimGraphComponentNotificationTestBus testBus(m_entityId);
  204. EXPECT_CALL(testBus, OnAnimGraphInstanceCreated(testing::_));
  205. PrepareParameterTest(aznew Vector2Parameter());
  206. {
  207. testing::InSequence parameterChangedCallSequence;
  208. EXPECT_CALL(testBus, OnAnimGraphVector2ParameterChanged(m_animGraphInstance, m_parameterIndex, testing::_, AZ::Vector2(1.0f, 2.0f)));
  209. EXPECT_CALL(testBus, OnAnimGraphVector2ParameterChanged(m_animGraphInstance, m_parameterIndex, AZ::Vector2(1.0f, 2.0f), AZ::Vector2(3.0f, 4.0f)));
  210. }
  211. // SetParameterVector2/GetParameterVector2() test
  212. Integration::AnimGraphComponentRequestBus::Event(m_entityId, &Integration::AnimGraphComponentRequestBus::Events::SetParameterVector2, m_parameterIndex, AZ::Vector2(1.0f, 2.0f));
  213. AZ::Vector2 newValue;
  214. Integration::AnimGraphComponentRequestBus::EventResult(newValue, m_entityId, &Integration::AnimGraphComponentRequestBus::Events::GetParameterVector2, m_parameterIndex);
  215. EXPECT_EQ(newValue, AZ::Vector2(1.0f, 2.0f));
  216. // SetNamedParameterVector2/GetNamedParameterVector2() test
  217. Integration::AnimGraphComponentRequestBus::Event(m_entityId, &Integration::AnimGraphComponentRequestBus::Events::SetNamedParameterVector2, m_parameterName.c_str(), AZ::Vector2(3.0f, 4.0f));
  218. Integration::AnimGraphComponentRequestBus::EventResult(newValue, m_entityId, &Integration::AnimGraphComponentRequestBus::Events::GetNamedParameterVector2, m_parameterName.c_str());
  219. EXPECT_EQ(newValue, AZ::Vector2(3.0f, 4.0f));
  220. }
  221. TEST_F(AnimGraphComponentBusTests, Vector3Parameter)
  222. {
  223. AnimGraphComponentNotificationTestBus testBus(m_entityId);
  224. EXPECT_CALL(testBus, OnAnimGraphInstanceCreated(testing::_));
  225. PrepareParameterTest(aznew Vector3Parameter());
  226. {
  227. testing::InSequence parameterChangedCallSequence;
  228. EXPECT_CALL(testBus, OnAnimGraphVector3ParameterChanged(m_animGraphInstance, m_parameterIndex, testing::_, AZ::Vector3(1.0f, 2.0f, 3.0f)));
  229. EXPECT_CALL(testBus, OnAnimGraphVector3ParameterChanged(m_animGraphInstance, m_parameterIndex, AZ::Vector3(1.0f, 2.0f, 3.0f), AZ::Vector3(4.0f, 5.0f, 6.0f)));
  230. }
  231. // SetParameterVector3/GetParameterVector3() test
  232. Integration::AnimGraphComponentRequestBus::Event(m_entityId, &Integration::AnimGraphComponentRequestBus::Events::SetParameterVector3, m_parameterIndex, AZ::Vector3(1.0f, 2.0f, 3.0f));
  233. AZ::Vector3 newValue;
  234. Integration::AnimGraphComponentRequestBus::EventResult(newValue, m_entityId, &Integration::AnimGraphComponentRequestBus::Events::GetParameterVector3, m_parameterIndex);
  235. EXPECT_EQ(newValue, AZ::Vector3(1.0f, 2.0f, 3.0f));
  236. // SetNamedParameterVector3/GetNamedParameterVector3() test
  237. Integration::AnimGraphComponentRequestBus::Event(m_entityId, &Integration::AnimGraphComponentRequestBus::Events::SetNamedParameterVector3, m_parameterName.c_str(), AZ::Vector3(4.0f, 5.0f, 6.0f));
  238. Integration::AnimGraphComponentRequestBus::EventResult(newValue, m_entityId, &Integration::AnimGraphComponentRequestBus::Events::GetNamedParameterVector3, m_parameterName.c_str());
  239. EXPECT_EQ(newValue, AZ::Vector3(4.0f, 5.0f, 6.0f));
  240. }
  241. TEST_F(AnimGraphComponentBusTests, RotationParameterEuler)
  242. {
  243. AnimGraphComponentNotificationTestBus testBus(m_entityId);
  244. EXPECT_CALL(testBus, OnAnimGraphInstanceCreated(testing::_));
  245. PrepareParameterTest(aznew RotationParameter());
  246. EXPECT_CALL(testBus, OnAnimGraphRotationParameterChanged(m_animGraphInstance, m_parameterIndex, testing::_, testing::_))
  247. .Times(2);
  248. // SetParameterRotationEuler/GetParameterRotationEuler() test
  249. AZ::Vector3 expectedEuler(AZ::DegToRad(30.0f), AZ::DegToRad(20.0f), 0.0f);
  250. Integration::AnimGraphComponentRequestBus::Event(m_entityId, &Integration::AnimGraphComponentRequestBus::Events::SetParameterRotationEuler, m_parameterIndex, expectedEuler);
  251. AZ::Vector3 newValue;
  252. Integration::AnimGraphComponentRequestBus::EventResult(newValue, m_entityId, &Integration::AnimGraphComponentRequestBus::Events::GetParameterRotationEuler, m_parameterIndex);
  253. EXPECT_TRUE(newValue.IsClose(expectedEuler, 0.001f));
  254. // SetNamedParameterRotationEuler/GetNamedParameterRotationEuler() test
  255. expectedEuler = AZ::Vector3(AZ::DegToRad(45.0f), 0.0f, AZ::DegToRad(30.0f));
  256. Integration::AnimGraphComponentRequestBus::Event(m_entityId, &Integration::AnimGraphComponentRequestBus::Events::SetNamedParameterRotationEuler, m_parameterName.c_str(), expectedEuler);
  257. Integration::AnimGraphComponentRequestBus::EventResult(newValue, m_entityId, &Integration::AnimGraphComponentRequestBus::Events::GetNamedParameterRotationEuler, m_parameterName.c_str());
  258. EXPECT_TRUE(newValue.IsClose(expectedEuler, 0.001f));
  259. }
  260. TEST_F(AnimGraphComponentBusTests, RotationParameter)
  261. {
  262. const AZ::Vector3 firstExpected(AZ::DegToRad(30.0f), AZ::DegToRad(20.0f), 0.0f);
  263. const AZ::Quaternion firstExpectedQuat = AZ::Quaternion::CreateFromEulerRadiansZYX(firstExpected);
  264. const AZ::Vector3 secondExpected = AZ::Vector3(AZ::DegToRad(45.0f), 0.0f, AZ::DegToRad(30.0f));
  265. const AZ::Quaternion secondExpectedQuat = AZ::Quaternion::CreateFromEulerRadiansZYX(secondExpected);
  266. AnimGraphComponentNotificationTestBus testBus(m_entityId);
  267. EXPECT_CALL(testBus, OnAnimGraphInstanceCreated(testing::_));
  268. PrepareParameterTest(aznew RotationParameter());
  269. {
  270. testing::InSequence parameterChangedCallSequence;
  271. EXPECT_CALL(testBus, OnAnimGraphRotationParameterChanged(m_animGraphInstance, m_parameterIndex, testing::_, firstExpectedQuat));
  272. EXPECT_CALL(testBus, OnAnimGraphRotationParameterChanged(m_animGraphInstance, m_parameterIndex, testing::_, secondExpectedQuat));
  273. }
  274. // SetParameterRotation/GetParameterRotation() test
  275. Integration::AnimGraphComponentRequestBus::Event(m_entityId, &Integration::AnimGraphComponentRequestBus::Events::SetParameterRotation, m_parameterIndex, firstExpectedQuat);
  276. AZ::Quaternion newValue;
  277. Integration::AnimGraphComponentRequestBus::EventResult(newValue, m_entityId, &Integration::AnimGraphComponentRequestBus::Events::GetParameterRotation, m_parameterIndex);
  278. EXPECT_TRUE(newValue.IsClose(firstExpectedQuat, 0.001f));
  279. // SetNamedParameterRotation/GetNamedParameterRotation() test
  280. Integration::AnimGraphComponentRequestBus::Event(m_entityId, &Integration::AnimGraphComponentRequestBus::Events::SetNamedParameterRotation, m_parameterName.c_str(), secondExpectedQuat);
  281. Integration::AnimGraphComponentRequestBus::EventResult(newValue, m_entityId, &Integration::AnimGraphComponentRequestBus::Events::GetNamedParameterRotation, m_parameterName.c_str());
  282. EXPECT_TRUE(newValue.IsClose(secondExpectedQuat, 0.001f));
  283. }
  284. TEST_F(AnimGraphComponentBusTests, OnAnimGraphInstanceDestroyed)
  285. {
  286. AnimGraphComponentNotificationTestBus testBus(m_entityId);
  287. EXPECT_CALL(testBus, OnAnimGraphInstanceCreated(testing::_));
  288. ActivateEntity();
  289. EXPECT_CALL(testBus, OnAnimGraphInstanceDestroyed(m_animGraphInstance));
  290. m_entity->Deactivate();
  291. }
  292. } // end namespace EMotionFX