SelectionListTests.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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/Node.h>
  10. #include <EMotionFX/CommandSystem/Source/SelectionList.h>
  11. #include <Tests/SystemComponentFixture.h>
  12. namespace EMotionFX
  13. {
  14. TEST_F(SystemComponentFixture, SelectionListDanglingActorTest)
  15. {
  16. CommandSystem::SelectionList selectionList;
  17. Actor* actor = aznew Actor("TestActor");
  18. selectionList.AddActor(actor);
  19. EXPECT_EQ(selectionList.GetNumSelectedActors(), 1) << "Actor should be in selection list.";
  20. delete actor;
  21. EXPECT_EQ(selectionList.GetNumSelectedActors(), 0)
  22. << "Actor destruction should have automatially removed the actor from the selection list.";
  23. }
  24. TEST_F(SystemComponentFixture, SelectionListDanglingJointTest)
  25. {
  26. CommandSystem::SelectionList selectionList;
  27. Actor* actor = aznew Actor("TestActor");
  28. Node* joint = Node::Create("TestJoint", actor->GetSkeleton());
  29. actor->AddNode(joint);
  30. selectionList.AddNode(joint);
  31. EXPECT_EQ(selectionList.GetNumSelectedNodes(), 1) << "Joint should be in selection list.";
  32. delete actor;
  33. EXPECT_EQ(selectionList.GetNumSelectedNodes(), 0)
  34. << "Actor destruction should have automatially removed all corresponding joint from the selection list.";
  35. }
  36. } // end namespace EMotionFX