Integrating latest 47acbe8

This commit is contained in:
alexpete
2021-03-25 13:57:57 -07:00
parent 448c549698
commit 75dc720198
10312 changed files with 2711566 additions and 671451 deletions
@@ -97,7 +97,11 @@ protected:
};
#if AZ_TRAIT_DISABLE_FAILED_AP_CONNECTION_TESTS
TEST_F(APConnectionTest, DISABLED_TestAddRemoveCallbacks)
#else
TEST_F(APConnectionTest, TestAddRemoveCallbacks)
#endif // AZ_TRAIT_DISABLE_FAILED_AP_CONNECTION_TESTS
{
using namespace AzFramework;
@@ -219,7 +223,11 @@ TEST_F(APConnectionTest, TestAddRemoveCallbacks)
EXPECT_TRUE(WaitForConnectionStateToBeEqual(apConnection, SocketConnection::EConnectionState::Disconnected));
}
#if AZ_TRAIT_DISABLE_FAILED_AP_CONNECTION_TESTS
TEST_F(APConnectionTest, DISABLED_TestAddRemoveCallbacks_RemoveDuringCallback_DoesNotCrash)
#else
TEST_F(APConnectionTest, TestAddRemoveCallbacks_RemoveDuringCallback_DoesNotCrash)
#endif // AZ_TRAIT_DISABLE_FAILED_AP_CONNECTION_TESTS
{
using namespace AzFramework;
@@ -310,7 +318,11 @@ TEST_F(APConnectionTest, TestAddRemoveCallbacks_RemoveDuringCallback_DoesNotCras
EXPECT_TRUE(WaitForConnectionStateToBeEqual(apConnection, SocketConnection::EConnectionState::Disconnected));
}
#if AZ_TRAIT_DISABLE_FAILED_AP_CONNECTION_TESTS
TEST_F(APConnectionTest, DISABLED_TestAddRemoveCallbacks_AddDuringCallback_DoesNotCrash)
#else
TEST_F(APConnectionTest, TestAddRemoveCallbacks_AddDuringCallback_DoesNotCrash)
#endif // AZ_TRAIT_DISABLE_FAILED_AP_CONNECTION_TESTS
{
using namespace AzFramework;
@@ -444,7 +456,11 @@ TEST_F(APConnectionTest, TestAddRemoveCallbacks_AddDuringCallback_DoesNotCrash)
EXPECT_TRUE(WaitForConnectionStateToBeEqual(apConnection, SocketConnection::EConnectionState::Disconnected));
}
#if AZ_TRAIT_DISABLE_FAILED_AP_CONNECTION_TESTS
TEST_F(APConnectionTest, DISABLED_TestConnection)
#else
TEST_F(APConnectionTest, TestConnection)
#endif // AZ_TRAIT_DISABLE_FAILED_AP_CONNECTION_TESTS
{
using namespace AzFramework;
@@ -546,7 +562,11 @@ TEST_F(APConnectionTest, TestConnection)
EXPECT_TRUE(WaitForConnectionStateToBeEqual(apListener, SocketConnection::EConnectionState::Disconnected));
}
#if AZ_TRAIT_DISABLE_FAILED_AP_CONNECTION_TESTS
TEST_F(APConnectionTest, DISABLED_TestReconnect)
#else
TEST_F(APConnectionTest, TestReconnect)
#endif // AZ_TRAIT_DISABLE_FAILED_AP_CONNECTION_TESTS
{
using namespace AzFramework;
+1
View File
@@ -58,6 +58,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
AZ::AzTest
AZ::AzToolsFramework
AZ::AzTestShared
AZ::AzFrameworkTestShared
RUNTIME_DEPENDENCIES
AZ::ProcessLaunchTest
)
+59
View File
@@ -0,0 +1,59 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzTest/AzTest.h>
#include <AzFramework/Engine/Engine.h>
#include <Utils/Utils.h>
////////////////////////////////////////////////////////////////////////////////////////////////////
namespace EngineTests
{
////////////////////////////////////////////////////////////////////////////////////////////////
class EngineTest : public ::testing::Test
{
protected:
////////////////////////////////////////////////////////////////////////////////////////////
void SetUp() override
{
}
////////////////////////////////////////////////////////////////////////////////////////////
void TearDown() override
{
}
};
////////////////////////////////////////////////////////////////////////////////////////////////
TEST_F(EngineTest, FindEngineRoot_EngineBelowExecutable_Success)
{
// We assume in this test that our engine lives above our binaries. If that's not the case we should pass in
// a valid path to a folder below the engine root to verify this functionality
auto foundRoot = AzFramework::Engine::FindEngineRoot();
EXPECT_FALSE(foundRoot.empty());
}
#if AZ_TRAIT_DISABLE_FAILED_FRAMEWORK_TESTS
TEST_F(EngineTest, DISABLED_FindEngineRoot_StartTempFolder_NoRootFound)
#else
TEST_F(EngineTest, FindEngineRoot_StartTempFolder_NoRootFound)
#endif // AZ_TRAIT_DISABLE_FAILED_FRAMEWORK_TESTS
{
UnitTest::ScopedTemporaryDirectory tempDir;
auto foundRoot = AzFramework::Engine::FindEngineRoot(tempDir.GetDirectory());
EXPECT_TRUE(foundRoot.empty());
}
} // namespace EngineTests
@@ -12,6 +12,7 @@
#include "EntityOwnershipServiceTestFixture.h"
#include <AzCore/UserSettings/UserSettingsComponent.h>
#include <AzFramework/Components/AzFrameworkConfigurationSystemComponent.h>
namespace UnitTest
{
@@ -45,6 +46,12 @@ namespace UnitTest
{
defaultRequiredComponents.erase(findComponentIterator);
}
findComponentIterator = AZStd::find(defaultRequiredComponents.begin(), defaultRequiredComponents.end(),
azrtti_typeid<AzFramework::AzFrameworkConfigurationSystemComponent>());
if (findComponentIterator != defaultRequiredComponents.end())
{
defaultRequiredComponents.erase(findComponentIterator);
}
return defaultRequiredComponents;
}
+2 -2
View File
@@ -42,7 +42,7 @@ TEST_F(PlatformHelperTest, SpecialAllFlag_PlatformId_Valid)
AzFramework::PlatformFlags platformFlags = AzFramework::PlatformFlags::Platform_ALL;
auto platforms = AzFramework::PlatformHelper::GetPlatformsInterpreted(platformFlags);
EXPECT_EQ(platforms.size(), AzFramework::NumPlatforms);
EXPECT_THAT(platforms, testing::UnorderedElementsAre("pc", "es3", "ios", "osx_gl", "xenia", "provo", "salem", "jasper", "server"));
EXPECT_THAT(platforms, testing::UnorderedElementsAre("pc", "es3", "ios", "osx_gl", "provo", "salem", "jasper", "server"));
}
TEST_F(PlatformHelperTest, SpecialAllClientFlag_PlatformId_Valid)
@@ -50,7 +50,7 @@ TEST_F(PlatformHelperTest, SpecialAllClientFlag_PlatformId_Valid)
AzFramework::PlatformFlags platformFlags = AzFramework::PlatformFlags::Platform_ALL_CLIENT;
auto platforms = AzFramework::PlatformHelper::GetPlatformsInterpreted(platformFlags);
EXPECT_EQ(platforms.size(), AzFramework::NumClientPlatforms);
EXPECT_THAT(platforms, testing::UnorderedElementsAre("pc", "es3", "ios", "osx_gl", "xenia", "provo", "salem", "jasper"));
EXPECT_THAT(platforms, testing::UnorderedElementsAre("pc", "es3", "ios", "osx_gl", "provo", "salem", "jasper"));
}
TEST_F(PlatformHelperTest, InvalidPlatformFlags_PlatformId_Empty)
@@ -0,0 +1,314 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzTest/AzTest.h>
#include <AzFramework/ProjectManager/ProjectManager.h>
#include <AzCore/IO/SystemFile.h>
#include <Utils/Utils.h>
namespace ProjectManagerTests
{
////////////////////////////////////////////////////////////////////////////////////////////////
class ProjectManagerTest : public ::testing::Test
{
protected:
////////////////////////////////////////////////////////////////////////////////////////////
void SetUp() override
{
}
////////////////////////////////////////////////////////////////////////////////////////////
void TearDown() override
{
}
};
////////////////////////////////////////////////////////////////////////////////////////////////
class ProjectManagerBootstrapTest : public ::testing::Test
{
protected:
////////////////////////////////////////////////////////////////////////////////////////////
void SetUp() override
{
AZ::IO::SystemFile engineFile;
AZ::IO::FixedMaxPath engineFilePath(m_tempDir.GetDirectory());
m_projectPath = engineFilePath / "TestProject";
AZ::IO::SystemFile::CreateDir(m_projectPath.c_str());
engineFilePath = engineFilePath / "engine.json";
engineFile.Open(engineFilePath.c_str(), AZ::IO::SystemFile::SF_OPEN_CREATE);
engineFile.Close();
}
////////////////////////////////////////////////////////////////////////////////////////////
void TearDown() override
{
}
AZ::IO::FixedMaxPath m_projectPath;
UnitTest::ScopedTemporaryDirectory m_tempDir;
};
////////////////////////////////////////////////////////////////////////////////////////////////
TEST_F(ProjectManagerTest, HasProjectNameTest_ProjectNameGivenWithDash_Success)
{
constexpr int numArguments = 2;
static const char* argumentList1[numArguments] = { "C:/somepath/to/exe", "-projectpath" };
EXPECT_TRUE(AzFramework::ProjectManager::HasCommandLineProjectName(numArguments, const_cast<char**>(argumentList1)));
static const char* argumentList2[numArguments] = { "C:/somepath/to/exe", "--projectpath" };
EXPECT_TRUE(AzFramework::ProjectManager::HasCommandLineProjectName(numArguments, const_cast<char**>(argumentList2)));
static const char* argumentList3[numArguments] = { "C:/somepath/to/exe", "/projectpath" };
EXPECT_TRUE(AzFramework::ProjectManager::HasCommandLineProjectName(numArguments, const_cast<char**>(argumentList3)));
}
TEST_F(ProjectManagerTest, HasProjectNameTest_ProjectNameGivenWithRegSet_Success)
{
constexpr int numArguments = 2;
static const char* argumentList1[numArguments] = { "C:/somepath/to/exe", "-regset=\"/Amazon/AzCore/Bootstrap/sys_game_folder=SomeFolder\"" };
EXPECT_TRUE(AzFramework::ProjectManager::HasCommandLineProjectName(numArguments, const_cast<char**>(argumentList1)));
static const char* argumentList2[numArguments] = { "C:/somepath/to/exe", "--regset=\"/Amazon/AzCore/Bootstrap/sys_game_folder=SomeFolder\"" };
EXPECT_TRUE(AzFramework::ProjectManager::HasCommandLineProjectName(numArguments, const_cast<char**>(argumentList2)));
static const char* argumentList3[numArguments] = { "C:/somepath/to/exe", "/regset=\"/Amazon/AzCore/Bootstrap/sys_game_folder=SomeFolder\"" };
EXPECT_TRUE(AzFramework::ProjectManager::HasCommandLineProjectName(numArguments, const_cast<char**>(argumentList3)));
}
TEST_F(ProjectManagerTest, HasProjectNameTest_ProjectNameGivenWithImroperPrefixes_Fails)
{
constexpr int numArguments = 2;
static const char* argumentList1[numArguments] = { "C:/somepath/to/exe", "projectpath" };
EXPECT_FALSE(AzFramework::ProjectManager::HasCommandLineProjectName(numArguments, const_cast<char**>(argumentList1)));
static const char* argumentList2[numArguments] = { "C:/somepath/to/exe", "---projectpath" };
EXPECT_FALSE(AzFramework::ProjectManager::HasCommandLineProjectName(numArguments, const_cast<char**>(argumentList2)));
static const char* argumentList3[numArguments] = { "C:/somepath/to/exe", "//projectpath" };
EXPECT_FALSE(AzFramework::ProjectManager::HasCommandLineProjectName(numArguments, const_cast<char**>(argumentList3)));
static const char* argumentList4[numArguments] = { "C:/somepath/to/exe", "pprojectpath" };
EXPECT_FALSE(AzFramework::ProjectManager::HasCommandLineProjectName(numArguments, const_cast<char**>(argumentList4)));
}
////////////////////////////////////////////////////////////////////////////////////////////////
TEST_F(ProjectManagerTest, HasProjectNameTest_ProjectNameNotGiven_Fails)
{
constexpr int numArguments = 2;
static const char* argumentList[numArguments] = { "C:/somepath/to/exe", "someotherparam" };
EXPECT_FALSE(AzFramework::ProjectManager::HasCommandLineProjectName(numArguments, const_cast<char**>(argumentList)));
}
////////////////////////////////////////////////////////////////////////////////////////////////
TEST_F(ProjectManagerTest, HasProjectNameTest_NoAdditionalParams_Fails)
{
constexpr int numArguments = 1;
static const char* argumentList[numArguments] = { "C:/somepath/to/exe" };
EXPECT_FALSE(AzFramework::ProjectManager::HasCommandLineProjectName(numArguments, const_cast<char**>(argumentList)));
}
////////////////////////////////////////////////////////////////////////////////////////////////
TEST_F(ProjectManagerTest, ContentTest_HasValidProjectName_Passes)
{
AZStd::fixed_string<AzFramework::ProjectManager::MaxBootstrapFileSize> testContent =
R"(-- When you see an option that does not have a platform preceeding it, that is the default
--value for anything not specificly set per platform.So if remote_filesystem = 0 and you have
-- ios_remote_file_system = 1 then remote filesystem will be off for all platforms except ios
-- Any of the settings in this file can be prefixed with a platform name :
--android, ios, mac, linux, windows, etc...
-- or left unprefixed, to set all platforms not specified.The rules apply in the order they're declared
sys_game_folder=SamplesProject
-- remote_filesystem - enable Virtual File System(VFS)
--This feature allows a remote instance of the game to run off assets
-- on the asset processor computers cache instead of deploying them the remote device
-- By default it is offand can be overridden for any platform)";
EXPECT_TRUE(AzFramework::ProjectManager::ContentHasProjectName(testContent));
}
TEST_F(ProjectManagerTest, ContentTest_HasValidProjectNameSpaced_Passes)
{
AZStd::fixed_string<AzFramework::ProjectManager::MaxBootstrapFileSize> testContent =
R"(-- When you see an option that does not have a platform preceeding it, that is the default
--value for anything not specificly set per platform.So if remote_filesystem = 0 and you have
-- ios_remote_file_system = 1 then remote filesystem will be off for all platforms except ios
-- Any of the settings in this file can be prefixed with a platform name :
--android, ios, mac, linux, windows, etc...
-- or left unprefixed, to set all platforms not specified.The rules apply in the order they're declared
sys_game_folder = SamplesProject
-- remote_filesystem - enable Virtual File System(VFS)
--This feature allows a remote instance of the game to run off assets
-- on the asset processor computers cache instead of deploying them the remote device
-- By default it is offand can be overridden for any platform)";
EXPECT_TRUE(AzFramework::ProjectManager::ContentHasProjectName(testContent));
}
TEST_F(ProjectManagerTest, ContentTest_HasNoProjectName_Fails)
{
AZStd::fixed_string<AzFramework::ProjectManager::MaxBootstrapFileSize> testContent =
R"(-- When you see an option that does not have a platform preceeding it, that is the default
--value for anything not specificly set per platform.So if remote_filesystem = 0 and you have
-- ios_remote_file_system = 1 then remote filesystem will be off for all platforms except ios
-- Any of the settings in this file can be prefixed with a platform name :
--android, ios, mac, linux, windows, etc...
-- or left unprefixed, to set all platforms not specified.The rules apply in the order they're declared
sys_game_folder=
-- remote_filesystem - enable Virtual File System(VFS)
--This feature allows a remote instance of the game to run off assets
-- on the asset processor computers cache instead of deploying them the remote device
-- By default it is offand can be overridden for any platform)";
EXPECT_FALSE(AzFramework::ProjectManager::ContentHasProjectName(testContent));
}
TEST_F(ProjectManagerTest, ContentTest_HasCommentedProjectName_Fails)
{
AZStd::fixed_string<AzFramework::ProjectManager::MaxBootstrapFileSize> testContent =
R"(-- When you see an option that does not have a platform preceeding it, that is the default
--value for anything not specificly set per platform.So if remote_filesystem = 0 and you have
-- ios_remote_file_system = 1 then remote filesystem will be off for all platforms except ios
-- Any of the settings in this file can be prefixed with a platform name :
--android, ios, mac, linux, windows, etc...
-- or left unprefixed, to set all platforms not specified.The rules apply in the order they're declared
-sys_game_folder=SamplesProject
-- remote_filesystem - enable Virtual File System(VFS)
--This feature allows a remote instance of the game to run off assets
-- on the asset processor computers cache instead of deploying them the remote device
-- By default it is offand can be overridden for any platform)";
EXPECT_FALSE(AzFramework::ProjectManager::ContentHasProjectName(testContent));
}
TEST_F(ProjectManagerTest, ContentTest_HasCommentedThenValidProjectName_Passes)
{
AZStd::fixed_string<AzFramework::ProjectManager::MaxBootstrapFileSize> testContent =
R"(-- When you see an option that does not have a platform preceeding it, that is the default
--value for anything not specificly set per platform.So if remote_filesystem = 0 and you have
-- ios_remote_file_system = 1 then remote filesystem will be off for all platforms except ios
-- Any of the settings in this file can be prefixed with a platform name :
--android, ios, mac, linux, windows, etc...
-- or left unprefixed, to set all platforms not specified.The rules apply in the order they're declared
-sys_game_folder=SamplesProject
sys_game_folder=SamplesProject
-- remote_filesystem - enable Virtual File System(VFS)
--This feature allows a remote instance of the game to run off assets
-- on the asset processor computers cache instead of deploying them the remote device
-- By default it is offand can be overridden for any platform)";
EXPECT_TRUE(AzFramework::ProjectManager::ContentHasProjectName(testContent));
}
TEST_F(ProjectManagerTest, ContentTest_OnlyHasValidKey_Passes)
{
AZStd::fixed_string<AzFramework::ProjectManager::MaxBootstrapFileSize> testContent =
R"(sys_game_folder=SamplesProject)";
EXPECT_TRUE(AzFramework::ProjectManager::ContentHasProjectName(testContent));
}
TEST_F(ProjectManagerTest, ContentTest_OnlyHasValidKeyNewline_Passes)
{
AZStd::fixed_string<AzFramework::ProjectManager::MaxBootstrapFileSize> testContent =
R"(sys_game_folder=SamplesProject
)";
EXPECT_TRUE(AzFramework::ProjectManager::ContentHasProjectName(testContent));
}
TEST_F(ProjectManagerTest, ContentTest_EmptyContent_Failse)
{
AZStd::fixed_string<AzFramework::ProjectManager::MaxBootstrapFileSize> testContent;
EXPECT_FALSE(AzFramework::ProjectManager::ContentHasProjectName(testContent));
}
#if AZ_TRAIT_DISABLE_FAILED_FRAMEWORK_TESTS
TEST_F(ProjectManagerBootstrapTest, DISABLED_BootstrapContentTest_HasValidProjectName_Passes)
#else
TEST_F(ProjectManagerBootstrapTest, BootstrapContentTest_HasValidProjectName_Passes)
#endif // AZ_TRAIT_DISABLE_FAILED_FRAMEWORK_TESTS
{
AZStd::fixed_string<AzFramework::ProjectManager::MaxBootstrapFileSize> testContent =
R"(-- When you see an option that does not have a platform preceeding it, that is the default
--value for anything not specificly set per platform.So if remote_filesystem = 0 and you have
-- ios_remote_file_system = 1 then remote filesystem will be off for all platforms except ios
-- Any of the settings in this file can be prefixed with a platform name :
--android, ios, mac, linux, windows, etc...
-- or left unprefixed, to set all platforms not specified.The rules apply in the order they're declared
sys_game_folder=SamplesProject
-- remote_filesystem - enable Virtual File System(VFS)
--This feature allows a remote instance of the game to run off assets
-- on the asset processor computers cache instead of deploying them the remote device
-- By default it is offand can be overridden for any platform)";
AZ::IO::SystemFile bootstrapFile;
AZ::IO::FixedMaxPath bootstrapPath(m_tempDir.GetDirectory());
bootstrapPath /= "bootstrap.cfg";
bootstrapFile.Open(bootstrapPath.c_str(), AZ::IO::SystemFile::SF_OPEN_WRITE_ONLY | AZ::IO::SystemFile::SF_OPEN_CREATE);
bootstrapFile.Write(testContent.data(), testContent.length());
bootstrapFile.Close();
EXPECT_TRUE(AzFramework::ProjectManager::HasBootstrapProjectName(m_projectPath.c_str()));
}
#if AZ_TRAIT_DISABLE_FAILED_FRAMEWORK_TESTS
TEST_F(ProjectManagerBootstrapTest, DISABLED_BootstrapContentTest_HasNoValidProjectName_Fails)
#else
TEST_F(ProjectManagerBootstrapTest, BootstrapContentTest_HasNoValidProjectName_Fails)
#endif // AZ_TRAIT_DISABLE_FAILED_FRAMEWORK_TESTS
{
AZStd::fixed_string<AzFramework::ProjectManager::MaxBootstrapFileSize> testContent =
R"(-- When you see an option that does not have a platform preceeding it, that is the default
--value for anything not specificly set per platform.So if remote_filesystem = 0 and you have
-- ios_remote_file_system = 1 then remote filesystem will be off for all platforms except ios
-- Any of the settings in this file can be prefixed with a platform name :
--android, ios, mac, linux, windows, etc...
-- or left unprefixed, to set all platforms not specified.The rules apply in the order they're declared
sys_game_folder=
-- remote_filesystem - enable Virtual File System(VFS)
--This feature allows a remote instance of the game to run off assets
-- on the asset processor computers cache instead of deploying them the remote device
-- By default it is offand can be overridden for any platform)";
AZ::IO::SystemFile bootstrapFile;
AZ::IO::FixedMaxPath bootstrapPath(m_tempDir.GetDirectory());
bootstrapPath /= "bootstrap.cfg";
bootstrapFile.Open(bootstrapPath.c_str(), AZ::IO::SystemFile::SF_OPEN_WRITE_ONLY | AZ::IO::SystemFile::SF_OPEN_CREATE);
bootstrapFile.Write(testContent.data(), testContent.length());
bootstrapFile.Close();
EXPECT_FALSE(AzFramework::ProjectManager::HasBootstrapProjectName(m_projectPath.c_str()));
}
} // ProjectManagerTests
@@ -986,16 +986,6 @@ namespace UnitTest
EXPECT_FALSE(m_transformInterface->IsStaticTransform());
}
TEST_F(TransformComponentConvertFromV2, IsPositionInterpolated_False)
{
EXPECT_FALSE(m_transformInterface->IsPositionInterpolated());
}
TEST_F(TransformComponentConvertFromV2, IsRotationInterpolated_False)
{
EXPECT_FALSE(m_transformInterface->IsRotationInterpolated());
}
///////////////////////////////////////////////////////////////////////////
// TransformConfig
@@ -1003,9 +993,6 @@ namespace UnitTest
{
return lhs.m_parentId == rhs.m_parentId
&& lhs.m_parentActivationTransformMode == rhs.m_parentActivationTransformMode
&& lhs.m_netSyncEnabled == rhs.m_netSyncEnabled
&& lhs.m_interpolatePosition == rhs.m_interpolatePosition
&& lhs.m_interpolateRotation == rhs.m_interpolateRotation
&& lhs.m_isStatic == rhs.m_isStatic
&& lhs.m_localTransform == rhs.m_localTransform
&& lhs.m_worldTransform == rhs.m_worldTransform
+4 -4
View File
@@ -25,8 +25,8 @@ UnitTest::ScopedTemporaryDirectory::ScopedTemporaryDirectory()
for (int i = 0; i < MaxAttempts; ++i)
{
auto randomFolder = AZ::Uuid::CreateRandom().ToString<AZStd::string>(false, false);
AZStd::string testPath;
auto randomFolder = AZ::Uuid::CreateRandom().ToString<AZStd::fixed_string<512>>(false, false);
AZ::IO::FixedMaxPath testPath;
#if !AZ_TRAIT_USE_POSIX_TEMP_FOLDER
auto path = userTempFolder / ("UnitTest-" + randomFolder).c_str();
testPath = path.string().c_str();
@@ -42,7 +42,7 @@ UnitTest::ScopedTemporaryDirectory::ScopedTemporaryDirectory()
#else
m_tempDirectory = testPath;
#endif
m_directoryExists = AZ::IO::LocalFileIO::GetInstance()->CreatePath(m_tempDirectory.c_str());
m_directoryExists = AZ::IO::SystemFile::CreateDir(m_tempDirectory.c_str());
break;
}
}
@@ -54,7 +54,7 @@ UnitTest::ScopedTemporaryDirectory::~ScopedTemporaryDirectory()
{
if (m_directoryExists)
{
AZ::IO::LocalFileIO::GetInstance()->DestroyPath(m_tempDirectory.c_str());
AZ::IO::SystemFile::DeleteDir(m_tempDirectory.c_str());
}
}
+2 -2
View File
@@ -14,7 +14,7 @@
#include <AzCore/IO/SystemFile.h>
#include <AzCore/Math/Uuid.h>
#include <AzCore/std/string/string.h>
#include <AzCore/IO/Path/Path.h>
#include <AzFramework/IO/LocalFileIO.h>
#if !AZ_TRAIT_USE_POSIX_TEMP_FOLDER
#include <filesystem>
@@ -40,7 +40,7 @@ namespace UnitTest
private:
bool m_directoryExists{ false };
AZStd::string m_tempDirectory;
AZ::IO::FixedMaxPath m_tempDirectory;
#if !AZ_TRAIT_USE_POSIX_TEMP_FOLDER
std::filesystem::path m_path;
#endif
@@ -17,6 +17,7 @@ set(FILES
BinToTextEncode.cpp
ComponentAddRemove.cpp
ComponentAdapterTests.cpp
EngineTests.cpp
EntityContext.cpp
EntityTestbed.h
FileFunc.cpp
@@ -42,6 +43,7 @@ set(FILES
InterestManagerComponentTests.cpp
SQLiteConnectionTests.cpp
ProcessLaunchParseTests.cpp
ProjectManagerTests.cpp
Application.cpp
PlatformHelper.cpp
Scene.cpp