Files
o3de/Gems/EMotionFX/Code/Tests/SelectionListTests.cpp
T
Steve Pham 38261d0800 Shorten copyright headers by splitting into 2 lines (#2213)
* Updated all copyright headers to split the longer original copyright line into 2 shorter lines

Signed-off-by: Steve Pham <spham@amazon.com>
2021-07-16 15:25:48 -07:00

45 lines
1.5 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <EMotionFX/Source/Actor.h>
#include <EMotionFX/Source/Node.h>
#include <EMotionFX/CommandSystem/Source/SelectionList.h>
#include <Tests/SystemComponentFixture.h>
namespace EMotionFX
{
TEST_F(SystemComponentFixture, SelectionListDanglingActorTest)
{
CommandSystem::SelectionList selectionList;
Actor* actor = aznew Actor("TestActor");
selectionList.AddActor(actor);
EXPECT_EQ(selectionList.GetNumSelectedActors(), 1) << "Actor should be in selection list.";
delete actor;
EXPECT_EQ(selectionList.GetNumSelectedActors(), 0)
<< "Actor destruction should have automatially removed the actor from the selection list.";
}
TEST_F(SystemComponentFixture, SelectionListDanglingJointTest)
{
CommandSystem::SelectionList selectionList;
Actor* actor = aznew Actor("TestActor");
Node* joint = Node::Create("TestJoint", actor->GetSkeleton());
actor->AddNode(joint);
selectionList.AddNode(joint);
EXPECT_EQ(selectionList.GetNumSelectedNodes(), 1) << "Joint should be in selection list.";
delete actor;
EXPECT_EQ(selectionList.GetNumSelectedNodes(), 0)
<< "Actor destruction should have automatially removed all corresponding joint from the selection list.";
}
} // end namespace EMotionFX