/* * 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 #include #include #include #include #include #include #include #include #include #include "qtestsystem.h" #include namespace EMotionFX { TEST_F(SimpleAnimGraphUIFixture, RemoveParametersTests) { // Check the parameters window EMStudio::ParameterWindow* parameterWindow = m_animGraphPlugin->GetParameterWindow(); EXPECT_EQ(parameterWindow->GetTopLevelItemCount(), m_animGraph->GetNumParameters()) << "Number of parameters displayed in the parameters window should be the same in the animgraph."; AZStd::string paramName; const AZ::u32 numIterations = 100; size_t numParams = m_animGraph->GetNumParameters(); for (AZ::u32 i = 0; i < numIterations; ++i) { paramName = AZStd::string::format("testFloat%d", i); FloatParameter* floatParam = aznew FloatSliderParameter(paramName); floatParam->SetDefaultValue(0.0f); m_animGraph->AddParameter(floatParam); } numParams += numIterations; EXPECT_TRUE(m_animGraph->GetNumParameters() == numParams) << "The number of parameters should increase by 100 after adding 100 new float parameters to the anim graph."; parameterWindow->ClearParameters(false); AZStd::string result; EXPECT_EQ(m_animGraph->GetNumParameters(), 0) << "There should be no parameters after clear parameters."; EXPECT_TRUE(CommandSystem::GetCommandManager()->Undo(result)) << result.c_str(); EXPECT_EQ(m_animGraph->GetNumParameters(), numParams) << "The number of parameters should recover to before clearing parameters."; EXPECT_EQ(parameterWindow->GetTopLevelItemCount(), m_animGraph->GetNumParameters()) << "Number of parameters displayed in the parameters window should be the same in the animgraph."; EXPECT_TRUE(CommandSystem::GetCommandManager()->Redo(result)) << result.c_str(); EXPECT_EQ(m_animGraph->GetNumParameters(), 0) << "The number of parameters should zero after redo."; } } // namespace EMotionFX