AnimGraphLoadingTests.cpp 1022 B

123456789101112131415161718192021222324252627282930313233
  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 "AzCore/UnitTest/UnitTest.h"
  9. #include <gtest/gtest.h>
  10. #include <EMotionFX/Source/AnimGraph.h>
  11. #include <Tests/SystemComponentFixture.h>
  12. namespace EMotionFX
  13. {
  14. TEST_F(SystemComponentFixture, CanHandleInvalidAnimGraphFile)
  15. {
  16. UnitTest::TraceBusRedirector redirector;
  17. const AZStd::string_view fileContents{R"(<ObjectStream version="3">
  18. <Class name="AnimGraph" version="1" type="{BD543125-CFEE-426C-B0AC-129F2A4C6BC8}">
  19. </Class>
  20. </ObjectStream>
  21. )"};
  22. AZ_TEST_START_TRACE_SUPPRESSION;
  23. AZStd::unique_ptr<EMotionFX::AnimGraph> animGraph {EMotionFX::AnimGraph::LoadFromBuffer(fileContents.data(), fileContents.size(), GetSerializeContext())};
  24. AZ_TEST_STOP_TRACE_SUPPRESSION(1);
  25. EXPECT_FALSE(animGraph);
  26. }
  27. } // namespace EMotionFX