CanDeleteMotionSetWhenSameMotionInTwoMotionSets.cpp 2.4 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/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioManager.h>
  10. #include <EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetsWindowPlugin.h>
  11. #include <EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewPlugin.h>
  12. #include <EMotionFX/Source/MotionManager.h>
  13. namespace EMotionFX
  14. {
  15. class CanDeleteMotionSetWhenSameMotionInTwoMotionSetsFixture
  16. : public CommandRunnerFixtureBase
  17. {
  18. };
  19. TEST_F(CanDeleteMotionSetWhenSameMotionInTwoMotionSetsFixture, ExecuteCommands)
  20. {
  21. ExecuteCommands({
  22. R"str(CreateMotionSet -name MotionSet0 -motionSetID 100)str",
  23. R"str(CreateMotionSet -name MotionSet1 -motionSetID 101)str",
  24. R"str(MotionSetAddMotion -motionSetID 100 -motionFilenamesAndIds @gemroot:EMotionFX@/Code/Tests/TestAssets/Rin/rin_idle.motion;rin_idle)str",
  25. R"str(MotionSetAddMotion -motionSetID 101 -motionFilenamesAndIds @gemroot:EMotionFX@/Code/Tests/TestAssets/Rin/rin_idle.motion;rin_idle)str",
  26. R"str(MotionSetRemoveMotion -motionSetID 100 -motionIds rin_idle)str",
  27. R"str(RemoveMotionSet -motionSetID 100)str",
  28. R"str(RemoveMotion -filename @gemroot:EMotionFX@/Code/Tests/TestAssets/Rin/rin_idle.motion)str",
  29. });
  30. EMStudio::MotionSetsWindowPlugin* motionSetsWindowPlugin = static_cast<EMStudio::MotionSetsWindowPlugin*>(EMStudio::GetPluginManager()->FindActivePlugin(EMStudio::MotionSetsWindowPlugin::CLASS_ID));
  31. ASSERT_TRUE(motionSetsWindowPlugin) << "Motion Window plugin not loaded";
  32. EMotionFX::MotionSet* motionSet = EMotionFX::GetMotionManager().FindMotionSetByID(1);
  33. motionSetsWindowPlugin->SetSelectedSet(motionSet);
  34. ExecuteCommands({
  35. R"str(Select -motionIndex 0)str",
  36. });
  37. double outTimeMax, outClipStart, outClipEnd;
  38. // This call should not crash
  39. static_cast<EMStudio::TimeViewPlugin*>(EMStudio::GetPluginManager()->FindActivePlugin(EMStudio::TimeViewPlugin::CLASS_ID))->GetDataTimes(&outTimeMax, &outClipStart, &outClipEnd);
  40. }
  41. } // end namespace EMotionFX