FileManagerTests.cpp 1.4 KB

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 <gtest/gtest.h>
  9. #include <QtTest>
  10. #include <EMotionStudio/EMStudioSDK/Source/EMStudioManager.h>
  11. #include <EMotionStudio/EMStudioSDK/Source/FileManager.h>
  12. #include <Tests/UI/UIFixture.h>
  13. namespace EMotionFX
  14. {
  15. TEST_F(UIFixture, FileManager_SaveSourceAsset)
  16. {
  17. EMStudio::FileManager* fileManager = EMStudio::GetMainWindow()->GetFileManager();
  18. const char* filename = "C:/MyAsset.txt";
  19. // 1. Save the asset.
  20. EXPECT_FALSE(fileManager->DidSourceAssetGetSaved(filename)) << "Source asset has not been saved yet.";
  21. fileManager->SourceAssetChanged(filename); // Called after saving the asset.
  22. fileManager->SourceAssetChanged(filename); // Call it another time to imitate something wrong.
  23. // 2. Auto-reload callback triggers.
  24. EXPECT_TRUE(fileManager->DidSourceAssetGetSaved(filename)) << "Source asset should have been saved previously.";
  25. fileManager->RemoveFromSavedSourceAssets(filename); // Callback removes it from the list.
  26. EXPECT_FALSE(fileManager->DidSourceAssetGetSaved(filename)) << "As we handled and removed it already, it should not be in the list anymore.";
  27. }
  28. } // namespace EMotionFX