You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.5 KiB
C++
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
|