CommandRemoveMotionTests.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 <Tests/UI/CommandRunnerFixture.h>
  9. #include <EMotionFX/CommandSystem/Source/CommandManager.h>
  10. #include <EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioManager.h>
  11. #include <EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetsWindowPlugin.h>
  12. namespace EMotionFX
  13. {
  14. class RemoveMotionDeselectsThatMotion
  15. : public CommandRunnerFixtureBase
  16. {
  17. };
  18. TEST_F(RemoveMotionDeselectsThatMotion, ExecuteCommands)
  19. {
  20. ExecuteCommands({
  21. "CreateMotionSet -name MotionSet0",
  22. });
  23. // Select the motion set (there is no command for this)
  24. EMStudio::MotionSetsWindowPlugin* motionSetsWindowPlugin = static_cast<EMStudio::MotionSetsWindowPlugin*>(EMStudio::GetPluginManager()->FindActivePlugin(EMStudio::MotionSetsWindowPlugin::CLASS_ID));
  25. ASSERT_TRUE(motionSetsWindowPlugin) << "Motion Window plugin not loaded";
  26. EMotionFX::MotionSet* motionSet = EMotionFX::GetMotionManager().FindMotionSetByID(0);
  27. ASSERT_TRUE(motionSet) << "Motion set with id 0 does not exist";
  28. motionSetsWindowPlugin->SetSelectedSet(motionSet);
  29. const std::string filename = "@gemroot:EMotionFX@/Code/Tests/TestAssets/Rin/rin_idle.motion";
  30. ExecuteCommands({
  31. "ImportMotion -filename " + filename,
  32. "MotionSetAddMotion -motionSetID 0 -motionFilenamesAndIds " + filename + ";rin_idle",
  33. "Select -motionIndex 0",
  34. });
  35. EXPECT_TRUE(CommandSystem::GetCommandManager()->GetCurrentSelection().GetSingleMotion());
  36. ExecuteCommands({
  37. "MotionSetRemoveMotion -motionSetID 0 -motionIds rin_idle",
  38. "RemoveMotion -filename " + filename,
  39. });
  40. EXPECT_FALSE(CommandSystem::GetCommandManager()->GetCurrentSelection().GetSingleMotion());
  41. }
  42. } // end namespace EMotionFX