3
0

ActorBusTests.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 <EMotionFX/Source/Actor.h>
  9. #include <EMotionFX/Source/ActorBus.h>
  10. #include <Tests/SystemComponentFixture.h>
  11. namespace EMotionFX
  12. {
  13. class ActorNotificationTestBus
  14. : public ActorNotificationBus::Handler
  15. {
  16. public:
  17. ActorNotificationTestBus()
  18. {
  19. ActorNotificationBus::Handler::BusConnect();
  20. }
  21. ~ActorNotificationTestBus()
  22. {
  23. ActorNotificationBus::Handler::BusDisconnect();
  24. }
  25. MOCK_METHOD1(OnActorCreated, void(Actor*));
  26. MOCK_METHOD1(OnActorDestroyed, void(Actor*));
  27. };
  28. TEST_F(SystemComponentFixture, ActorNotificationBusTest)
  29. {
  30. ActorNotificationTestBus testBus;
  31. EXPECT_CALL(testBus, OnActorCreated(testing::_));
  32. Actor* actor = aznew Actor("TestActor");
  33. EXPECT_CALL(testBus, OnActorDestroyed(actor));
  34. delete actor;
  35. }
  36. } // end namespace EMotionFX