GraphModelPythonBindingsTest.cpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 <AzCore/Component/ComponentApplication.h>
  9. #include <AzCore/Component/Entity.h>
  10. #include <AzCore/RTTI/BehaviorContext.h>
  11. #include <AzCore/Serialization/SerializeContext.h>
  12. #include <AzTest/AzTest.h>
  13. #include <AzToolsFramework/Application/ToolsApplication.h>
  14. #include <AzCore/UnitTest/TestTypes.h>
  15. namespace UnitTest
  16. {
  17. class GraphModelPythonBindingsFixture
  18. : public ::testing::Test
  19. {
  20. };
  21. TEST_F(GraphModelPythonBindingsFixture, GraphModelGraphManagerRequests_ApiExists)
  22. {
  23. AZ::BehaviorContext* behaviorContext(nullptr);
  24. AZ::ComponentApplicationBus::BroadcastResult(behaviorContext, &AZ::ComponentApplicationRequests::GetBehaviorContext);
  25. ASSERT_TRUE(behaviorContext);
  26. auto graphManagerRequestBus = behaviorContext->m_ebuses.find("GraphManagerRequestBus");
  27. EXPECT_TRUE(behaviorContext->m_ebuses.end() != graphManagerRequestBus);
  28. auto* behaviorBus = graphManagerRequestBus->second;
  29. auto eventIt = behaviorBus->m_events.find("GetGraph");
  30. EXPECT_TRUE(behaviorBus->m_events.end() != eventIt);
  31. }
  32. TEST_F(GraphModelPythonBindingsFixture, GraphModelGraphControllerRequests_ApiExists)
  33. {
  34. AZ::BehaviorContext* behaviorContext(nullptr);
  35. AZ::ComponentApplicationBus::BroadcastResult(behaviorContext, &AZ::ComponentApplicationRequests::GetBehaviorContext);
  36. ASSERT_TRUE(behaviorContext);
  37. auto graphControllerRequestBus = behaviorContext->m_ebuses.find("GraphControllerRequestBus");
  38. EXPECT_TRUE(behaviorContext->m_ebuses.end() != graphControllerRequestBus);
  39. const AZStd::vector<AZStd::string> eventNames = {
  40. "AddNode",
  41. "RemoveNode",
  42. "AddConnection",
  43. "AddConnectionBySlotId",
  44. "RemoveConnection"
  45. };
  46. auto* behaviorBus = graphControllerRequestBus->second;
  47. for (const AZStd::string& name : eventNames)
  48. {
  49. auto eventIt = behaviorBus->m_events.find(name);
  50. EXPECT_TRUE(behaviorBus->m_events.end() != eventIt);
  51. }
  52. }
  53. }