Integrating latest from github/staging
Integrating up through commit 5e1bdae
This commit is contained in:
@@ -2391,6 +2391,27 @@ namespace UnitTest
|
||||
EXPECT_STREQ("AB BA", eraseIfTest.c_str());
|
||||
}
|
||||
|
||||
template <typename StringType>
|
||||
class ImmutableStringFunctionsFixture
|
||||
: public ScopedAllocatorSetupFixture
|
||||
{};
|
||||
using StringTypesToTest = ::testing::Types<AZStd::string_view, AZStd::string, AZStd::fixed_string<1024>>;
|
||||
TYPED_TEST_CASE(ImmutableStringFunctionsFixture, StringTypesToTest);
|
||||
|
||||
TYPED_TEST(ImmutableStringFunctionsFixture, Contains_Succeeds)
|
||||
{
|
||||
TypeParam testStrValue{ R"(C:\o3de\Assets\Materials\texture\image.png)" };
|
||||
EXPECT_TRUE(testStrValue.contains("Materials"));
|
||||
EXPECT_FALSE(testStrValue.contains("Animations"));
|
||||
EXPECT_TRUE(testStrValue.contains('o'));
|
||||
EXPECT_FALSE(testStrValue.contains('Q'));
|
||||
|
||||
TypeParam typeParamEntry{ R"(texture)" };
|
||||
TypeParam typeParamNoEntry{ R"(physics)" };
|
||||
EXPECT_TRUE(testStrValue.contains(typeParamEntry));
|
||||
EXPECT_FALSE(testStrValue.contains(typeParamNoEntry));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const T* GetFormatString()
|
||||
{
|
||||
|
||||
@@ -54,8 +54,9 @@ namespace UnitTest
|
||||
AZ::SerializeContext* GetSerializeContext() override { return nullptr; }
|
||||
AZ::BehaviorContext* GetBehaviorContext() override { return m_behaviorContext; }
|
||||
AZ::JsonRegistrationContext* GetJsonRegistrationContext() override { return nullptr; }
|
||||
const char* GetExecutableFolder() const override { return nullptr; }
|
||||
const char* GetAppRoot() const override { return nullptr; }
|
||||
const char* GetEngineRoot() const override { return nullptr; }
|
||||
const char* GetExecutableFolder() const override { return nullptr; }
|
||||
AZ::Debug::DrillerManager* GetDrillerManager() override { return nullptr; }
|
||||
void EnumerateEntities(const EntityCallback& /*callback*/) override {}
|
||||
void QueryApplicationType(AZ::ApplicationTypeQuery& /*appType*/) const override {}
|
||||
|
||||
@@ -416,6 +416,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ReplaceAlias(AZ::IO::FixedMaxPath&, const AZ::IO::PathView&) const override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void SetAlias(const char*, const char*) override
|
||||
{
|
||||
}
|
||||
|
||||
@@ -58,22 +58,22 @@ namespace UnitTest
|
||||
|
||||
TEST_F(UtilsTestFixture, ConvertToAbsolutePath_OnRelativePath_Succeeds)
|
||||
{
|
||||
AZStd::optional<AZStd::fixed_string<AZ::Utils::MaxPathLength>> absolutePath = AZ::Utils::ConvertToAbsolutePath("./");
|
||||
AZStd::optional<AZ::IO::FixedMaxPathString> absolutePath = AZ::Utils::ConvertToAbsolutePath("./");
|
||||
EXPECT_TRUE(absolutePath);
|
||||
}
|
||||
|
||||
TEST_F(UtilsTestFixture, ConvertToAbsolutePath_OnAbsolutePath_Succeeds)
|
||||
{
|
||||
char executableDirectory[AZ::Utils::MaxPathLength];
|
||||
AZ::Utils::ExecutablePathResult result = AZ::Utils::GetExecutableDirectory(executableDirectory, AZ_ARRAY_SIZE(executableDirectory));
|
||||
char executableDirectory[AZ::IO::MaxPathLength];
|
||||
AZ::Utils::ExecutablePathResult result = AZ::Utils::GetExecutableDirectory(executableDirectory, AZStd::size(executableDirectory));
|
||||
EXPECT_EQ(AZ::Utils::ExecutablePathResult::Success, result);
|
||||
AZStd::optional<AZStd::fixed_string<AZ::Utils::MaxPathLength>> absolutePath = AZ::Utils::ConvertToAbsolutePath(executableDirectory);
|
||||
AZStd::optional<AZ::IO::FixedMaxPathString> absolutePath = AZ::Utils::ConvertToAbsolutePath(executableDirectory);
|
||||
ASSERT_TRUE(absolutePath);
|
||||
|
||||
// Note that ConvertToAbsolutePath will perform a realpath on the result. The result of AZ::Utils::GetExecutableDirectory
|
||||
// uses AZ::Android::AndroidEnv::Get()->GetAppPrivateStoragePath() which will retrieve the storage path, but that path could
|
||||
// be symlinked, so we need to perform a real path on it before comparison
|
||||
char realExecutableDirectory[AZ::Utils::MaxPathLength];
|
||||
char realExecutableDirectory[AZ::IO::MaxPathLength];
|
||||
ASSERT_TRUE(realpath(executableDirectory, realExecutableDirectory));
|
||||
|
||||
EXPECT_STRCASEEQ(realExecutableDirectory, absolutePath->c_str());
|
||||
|
||||
@@ -27,16 +27,16 @@ namespace UnitTest
|
||||
|
||||
TEST_F(UtilsUnixLikeTestFixture, ConvertToAbsolutePath_OnRelativePath_Succeeds)
|
||||
{
|
||||
AZStd::optional<AZStd::fixed_string<AZ::Utils::MaxPathLength>> absolutePath = AZ::Utils::ConvertToAbsolutePath("./");
|
||||
AZStd::optional<AZ::IO::FixedMaxPathString> absolutePath = AZ::Utils::ConvertToAbsolutePath("./");
|
||||
EXPECT_TRUE(absolutePath);
|
||||
}
|
||||
|
||||
TEST_F(UtilsUnixLikeTestFixture, ConvertToAbsolutePath_OnAbsolutePath_Succeeds)
|
||||
{
|
||||
char executableDirectory[AZ::Utils::MaxPathLength];
|
||||
char executableDirectory[AZ::IO::MaxPathLength];
|
||||
AZ::Utils::ExecutablePathResult result = AZ::Utils::GetExecutableDirectory(executableDirectory, AZ_ARRAY_SIZE(executableDirectory));
|
||||
EXPECT_EQ(AZ::Utils::ExecutablePathResult::Success, result);
|
||||
AZStd::optional<AZStd::fixed_string<AZ::Utils::MaxPathLength>> absolutePath = AZ::Utils::ConvertToAbsolutePath(executableDirectory);
|
||||
AZStd::optional<AZ::IO::FixedMaxPathString> absolutePath = AZ::Utils::ConvertToAbsolutePath(executableDirectory);
|
||||
ASSERT_TRUE(absolutePath);
|
||||
EXPECT_STRCASEEQ(executableDirectory, absolutePath->c_str());
|
||||
}
|
||||
|
||||
@@ -53,23 +53,23 @@ namespace UnitTest
|
||||
|
||||
TEST_F(UtilsTestFixture, ConvertToAbsolutePath_OnInvalidPath_Fails)
|
||||
{
|
||||
AZStd::fixed_string<AZ::Utils::MaxPathLength> invalidPath{ "Z:\\" };
|
||||
invalidPath.append(AZ::Utils::MaxPathLength - invalidPath.size(), '@');
|
||||
AZ::IO::FixedMaxPathString invalidPath{ "Z:\\" };
|
||||
invalidPath.append(invalidPath.max_size() - invalidPath.size(), '@');
|
||||
EXPECT_FALSE(AZ::Utils::ConvertToAbsolutePath(invalidPath));
|
||||
}
|
||||
|
||||
TEST_F(UtilsTestFixture, ConvertToAbsolutePath_OnRelativePath_Succeeds)
|
||||
{
|
||||
AZStd::optional<AZStd::fixed_string<AZ::Utils::MaxPathLength>> absolutePath = AZ::Utils::ConvertToAbsolutePath("./");
|
||||
AZStd::optional<AZ::IO::FixedMaxPathString> absolutePath = AZ::Utils::ConvertToAbsolutePath("./");
|
||||
EXPECT_TRUE(absolutePath);
|
||||
}
|
||||
|
||||
TEST_F(UtilsTestFixture, ConvertToAbsolutePath_OnAbsolutePath_Succeeds)
|
||||
{
|
||||
char executableDirectory[AZ::Utils::MaxPathLength];
|
||||
char executableDirectory[AZ::IO::MaxPathLength];
|
||||
AZ::Utils::ExecutablePathResult result = AZ::Utils::GetExecutableDirectory(executableDirectory, AZ_ARRAY_SIZE(executableDirectory));
|
||||
EXPECT_EQ(AZ::Utils::ExecutablePathResult::Success, result);
|
||||
AZStd::optional<AZStd::fixed_string<AZ::Utils::MaxPathLength>> absolutePath = AZ::Utils::ConvertToAbsolutePath(executableDirectory);
|
||||
AZStd::optional<AZ::IO::FixedMaxPathString> absolutePath = AZ::Utils::ConvertToAbsolutePath(executableDirectory);
|
||||
ASSERT_TRUE(absolutePath);
|
||||
EXPECT_STRCASEEQ(executableDirectory, absolutePath->c_str());
|
||||
}
|
||||
|
||||
@@ -1237,8 +1237,9 @@ namespace UnitTest
|
||||
SerializeContext* GetSerializeContext() override { return m_serializeContext.get(); }
|
||||
BehaviorContext* GetBehaviorContext() override { return nullptr; }
|
||||
JsonRegistrationContext* GetJsonRegistrationContext() override { return nullptr; }
|
||||
const char* GetExecutableFolder() const override { return nullptr; }
|
||||
const char* GetAppRoot() const override { return nullptr; }
|
||||
const char* GetEngineRoot() const override { return nullptr; }
|
||||
const char* GetExecutableFolder() const override { return nullptr; }
|
||||
Debug::DrillerManager* GetDrillerManager() override { return nullptr; }
|
||||
void EnumerateEntities(const EntityCallback& /*callback*/) override {}
|
||||
void QueryApplicationType(AZ::ApplicationTypeQuery& /*appType*/) const override {}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <AzCore/Math/Vector2.h>
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzCore/Math/Vector4.h>
|
||||
#include <AzCore/Math/Quaternion.h>
|
||||
#include <AzCore/Serialization/Json/DoubleSerializer.h>
|
||||
#include <AzCore/Serialization/Json/RegistrationContext.h>
|
||||
#include <Tests/Serialization/Json/BaseJsonSerializerFixture.h>
|
||||
@@ -142,6 +143,13 @@ namespace JsonSerializationTests
|
||||
constexpr static size_t ElementCount = 4;
|
||||
};
|
||||
|
||||
struct QuaternionDescriptor
|
||||
{
|
||||
using VectorType = AZ::Quaternion;
|
||||
using Serializer = AZ::JsonQuaternionSerializer;
|
||||
constexpr static size_t ElementCount = 4;
|
||||
};
|
||||
|
||||
using JsonMathVectorSerializerTypes = ::testing::Types <
|
||||
Vector2Descriptor, Vector3Descriptor, Vector4Descriptor>;
|
||||
TYPED_TEST_CASE(JsonMathVectorSerializerTests, JsonMathVectorSerializerTypes);
|
||||
|
||||
@@ -25,9 +25,11 @@ namespace UnitTest
|
||||
AZ::CommandLine cmd;
|
||||
EXPECT_FALSE(cmd.HasSwitch(""));
|
||||
EXPECT_EQ(cmd.GetNumSwitchValues("haha"), 0);
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
EXPECT_EQ(cmd.GetSwitchValue("haha", 0), AZStd::string());
|
||||
EXPECT_EQ(cmd.GetNumMiscValues(), 0);
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
|
||||
|
||||
EXPECT_EQ(cmd.GetNumMiscValues(), 0);
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
EXPECT_EQ(cmd.GetMiscValue(1), AZStd::string());
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION(1);
|
||||
@@ -379,7 +381,6 @@ namespace UnitTest
|
||||
{
|
||||
AZ::CommandLine origCommandLine{ "-/" };
|
||||
|
||||
|
||||
const char* argValues[] =
|
||||
{
|
||||
"programname.exe", "/gamefolder", "/RemoteIp", "10.0.0.1", "-ScanFolders", R"(\a\b\c,\d\e\f)", "Foo", "Bat"
|
||||
@@ -396,20 +397,21 @@ namespace UnitTest
|
||||
for (const auto& commandLine : commandLines)
|
||||
{
|
||||
EXPECT_TRUE(commandLine.HasSwitch("gamefolder"));
|
||||
EXPECT_EQ(0, commandLine.GetNumSwitchValues("gamefolder"));
|
||||
EXPECT_EQ(1, commandLine.GetNumSwitchValues("gamefolder"));
|
||||
EXPECT_STREQ("", commandLine.GetSwitchValue("gamefolder", 0).c_str());
|
||||
|
||||
EXPECT_TRUE(commandLine.HasSwitch("remoteip"));
|
||||
EXPECT_EQ(1, commandLine.GetNumSwitchValues("remoteip"));
|
||||
EXPECT_EQ("10.0.0.1", commandLine.GetSwitchValue("remoteip", 0));
|
||||
EXPECT_STREQ("10.0.0.1", commandLine.GetSwitchValue("remoteip", 0).c_str());
|
||||
|
||||
EXPECT_TRUE(commandLine.HasSwitch("scanfolders"));
|
||||
EXPECT_EQ(2, commandLine.GetNumSwitchValues("scanfolders"));
|
||||
EXPECT_EQ(R"(\a\b\c)", commandLine.GetSwitchValue("scanfolders", 0));
|
||||
EXPECT_EQ(R"(\d\e\f)", commandLine.GetSwitchValue("scanfolders", 1));
|
||||
EXPECT_STREQ(R"(\a\b\c)", commandLine.GetSwitchValue("scanfolders", 0).c_str());
|
||||
EXPECT_STREQ(R"(\d\e\f)", commandLine.GetSwitchValue("scanfolders", 1).c_str());
|
||||
|
||||
EXPECT_EQ(2, commandLine.GetNumMiscValues());
|
||||
EXPECT_EQ("Foo", commandLine.GetMiscValue(0));
|
||||
EXPECT_EQ("Bat", commandLine.GetMiscValue(1));
|
||||
EXPECT_STREQ("Foo", commandLine.GetMiscValue(0).c_str());
|
||||
EXPECT_STREQ("Bat", commandLine.GetMiscValue(1).c_str());
|
||||
}
|
||||
}
|
||||
} // namespace UnitTest
|
||||
|
||||
@@ -82,23 +82,25 @@ namespace SettingsRegistryMergeUtilsTests
|
||||
DumpSettings,
|
||||
SettingsRegistryMergeUtilsParamFixture,
|
||||
::testing::Values(
|
||||
DumpSettingsRegistryParams{ AZ::SettingsRegistryInterface::Format::JsonPatch,
|
||||
R"( [
|
||||
{ "op": "add", "path": "/Test", "value": { "Object": {} } },
|
||||
|
||||
{ "op": "add", "path": "/Test/Object/NullType", "value": null },
|
||||
{ "op": "add", "path": "/Test/Object/TrueType", "value": true },
|
||||
{ "op": "add", "path": "/Test/Object/FalseType", "value": false },
|
||||
{ "op": "add", "path": "/Test/Object/IntType", "value": -42 },
|
||||
{ "op": "add", "path": "/Test/Object/UIntType", "value": 42 },
|
||||
{ "op": "add", "path": "/Test/Object/DoubleType", "value": 42.0 },
|
||||
{ "op": "add", "path": "/Test/Object/StringType", "value": "Hello world" },
|
||||
|
||||
{ "op": "add", "path": "/Test/Array", "value": [ null, true, false, -42, 42, 42.0, "Hello world" ] }
|
||||
])",
|
||||
DumpSettingsRegistryParams
|
||||
{
|
||||
AZ::SettingsRegistryInterface::Format::JsonPatch,
|
||||
R"([)" "\n"
|
||||
R"( { "op": "add", "path": "/Test", "value": { "Object": {} } },)" "\n"
|
||||
R"( { "op": "add", "path": "/Test/Object/NullType", "value": null },)" "\n"
|
||||
R"( { "op": "add", "path": "/Test/Object/TrueType", "value": true },)" "\n"
|
||||
R"( { "op": "add", "path": "/Test/Object/FalseType", "value": false },)" "\n"
|
||||
R"( { "op": "add", "path": "/Test/Object/IntType", "value": -42 },)" "\n"
|
||||
R"( { "op": "add", "path": "/Test/Object/UIntType", "value": 42 },)" "\n"
|
||||
R"( { "op": "add", "path": "/Test/Object/DoubleType", "value": 42.0 },)" "\n"
|
||||
R"( { "op": "add", "path": "/Test/Object/StringType", "value": "Hello world" },)" "\n"
|
||||
R"( { "op": "add", "path": "/Test/Array", "value": [ null, true, false, -42, 42, 42.0, "Hello world" ] })" "\n"
|
||||
R"(])" "\n",
|
||||
R"({"Test":{"Object":{"NullType":null,"TrueType":true,"FalseType":false,"IntType":-42,"UIntType":42)"
|
||||
R"(,"DoubleType":42.0,"StringType":"Hello world"},"Array":[null,true,false,-42,42,42.0,"Hello world"]}})",
|
||||
{ false,
|
||||
AZ::SettingsRegistryMergeUtils::DumperSettings
|
||||
{
|
||||
false,
|
||||
[](AZStd::string_view path)
|
||||
{
|
||||
AZStd::string_view prefixPath("/Test");
|
||||
@@ -106,26 +108,30 @@ namespace SettingsRegistryMergeUtilsTests
|
||||
}
|
||||
}
|
||||
},
|
||||
DumpSettingsRegistryParams{ AZ::SettingsRegistryInterface::Format::JsonMergePatch,
|
||||
R"({
|
||||
"Test":
|
||||
{
|
||||
"Array0": [ 142, 188 ],
|
||||
"Array1": [ 242, 288 ],
|
||||
"Array2": [ 342, 388 ]
|
||||
}
|
||||
})",
|
||||
DumpSettingsRegistryParams
|
||||
{
|
||||
AZ::SettingsRegistryInterface::Format::JsonMergePatch,
|
||||
R"({)" "\n"
|
||||
R"( "Test":)" "\n"
|
||||
R"( {)" "\n"
|
||||
R"( "Array0": [ 142, 188 ], )" "\n"
|
||||
R"( "Array1": [ 242, 288 ], )" "\n"
|
||||
R"( "Array2": [ 342, 388 ] )" "\n"
|
||||
R"( })" "\n"
|
||||
R"(})" "\n",
|
||||
R"({"Test":{"Array0":[142,188],"Array1":[242,288],"Array2":[342,388]}})",
|
||||
{ false,
|
||||
AZ::SettingsRegistryMergeUtils::DumperSettings{ false,
|
||||
[](AZStd::string_view path)
|
||||
{
|
||||
AZStd::string_view prefixPath("/Test");
|
||||
return prefixPath.starts_with(path.substr(0, prefixPath.size()));
|
||||
}
|
||||
}
|
||||
},
|
||||
DumpSettingsRegistryParams{ AZ::SettingsRegistryInterface::Format::JsonMergePatch,
|
||||
R"({
|
||||
},
|
||||
DumpSettingsRegistryParams
|
||||
{
|
||||
AZ::SettingsRegistryInterface::Format::JsonMergePatch,
|
||||
R"({
|
||||
"Test":
|
||||
{
|
||||
"Array0": [ 142, 188 ],
|
||||
@@ -149,23 +155,27 @@ namespace SettingsRegistryMergeUtilsTests
|
||||
R"( ])""\n"
|
||||
R"( })""\n"
|
||||
R"(})",
|
||||
{ true,
|
||||
AZ::SettingsRegistryMergeUtils::DumperSettings
|
||||
{
|
||||
true,
|
||||
[](AZStd::string_view path)
|
||||
{
|
||||
AZStd::string_view prefixPath("/Test");
|
||||
return prefixPath.starts_with(path.substr(0, prefixPath.size()));
|
||||
}
|
||||
}
|
||||
},
|
||||
DumpSettingsRegistryParams{ AZ::SettingsRegistryInterface::Format::JsonMergePatch,
|
||||
R"({
|
||||
},
|
||||
DumpSettingsRegistryParams
|
||||
{
|
||||
AZ::SettingsRegistryInterface::Format::JsonMergePatch,
|
||||
R"({
|
||||
"Test":
|
||||
{
|
||||
"Array0": [ 142, 188 ],
|
||||
"Array1": [ 242, 288 ],
|
||||
"Array2": [ 342, 388 ]
|
||||
}
|
||||
})",
|
||||
})",
|
||||
R"({)""\n"
|
||||
R"( "Array0": [)""\n"
|
||||
R"( 142,)""\n"
|
||||
@@ -180,7 +190,9 @@ namespace SettingsRegistryMergeUtilsTests
|
||||
R"( 388)""\n"
|
||||
R"( ])""\n"
|
||||
R"(})",
|
||||
{ true,
|
||||
AZ::SettingsRegistryMergeUtils::DumperSettings
|
||||
{
|
||||
true,
|
||||
[](AZStd::string_view path)
|
||||
{
|
||||
AZStd::string_view prefixPath("/Test");
|
||||
@@ -188,8 +200,19 @@ namespace SettingsRegistryMergeUtilsTests
|
||||
}
|
||||
},
|
||||
"/Test"
|
||||
}
|
||||
)
|
||||
},
|
||||
DumpSettingsRegistryParams{
|
||||
AZ::SettingsRegistryInterface::Format::JsonMergePatch,
|
||||
R"({)" "\n"
|
||||
R"( "Test":)" "\n"
|
||||
R"( {)" "\n"
|
||||
R"( "Array0": [ 142, 188 ])" "\n"
|
||||
R"( })" "\n"
|
||||
R"(})",
|
||||
R"({"Root":{"Path":{"Test":{"Array0":[142,188]}}}})",
|
||||
AZ::SettingsRegistryMergeUtils::DumperSettings{ false, {}, "/Root/Path/Test" },
|
||||
"/Test"
|
||||
})
|
||||
);
|
||||
|
||||
//! ConfigFile MergeUtils Test
|
||||
@@ -281,9 +304,13 @@ namespace SettingsRegistryMergeUtilsTests
|
||||
AZ::SettingsRegistryMergeUtils::ConfigParserSettings parserSettings;
|
||||
parserSettings.m_commentPrefixFunc = [](AZStd::string_view line) -> AZStd::string_view
|
||||
{
|
||||
if (line.starts_with("--") || line.starts_with(';') || line.starts_with('#'))
|
||||
constexpr AZStd::string_view commentPrefixes[]{ "--", ";","#" };
|
||||
for (AZStd::string_view commentPrefix : commentPrefixes)
|
||||
{
|
||||
return {};
|
||||
if (size_t commentOffset = line.find(commentPrefix); commentOffset != AZStd::string_view::npos)
|
||||
{
|
||||
return line.substr(0, commentOffset);
|
||||
}
|
||||
}
|
||||
return line;
|
||||
};
|
||||
@@ -330,7 +357,7 @@ INSTANTIATE_TEST_CASE_P(
|
||||
-- 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=TestProject
|
||||
project_path=TestProject
|
||||
|
||||
-- remote_filesystem - enable Virtual File System (VFS)
|
||||
-- This feature allows a remote instance of the game to run off assets
|
||||
@@ -363,7 +390,7 @@ mac_assets = osx_gl
|
||||
-- Example: 192.168.1.0/24 will allow any address starting with 192.168.1.
|
||||
-- Example: 192.168.0.0/16 will allow any address starting with 192.168.
|
||||
-- Example: 192.168.0.0/8 will allow any address starting with 192.
|
||||
-- white_list =
|
||||
-- allowed_list =
|
||||
|
||||
-- IP address and optionally port of the asset processor.
|
||||
-- Set your PC IP here: (and uncomment the next line)
|
||||
@@ -405,7 +432,7 @@ mac_wait_for_connect=0
|
||||
|
||||
)"
|
||||
, AZStd::fixed_vector<ConfigFileParams::SettingsKeyValuePair, 20>{
|
||||
ConfigFileParams::SettingsKeyValuePair{"/sys_game_folder", AZStd::string_view{"TestProject"}},
|
||||
ConfigFileParams::SettingsKeyValuePair{"/project_path", AZStd::string_view{"TestProject"}},
|
||||
ConfigFileParams::SettingsKeyValuePair{"/remote_filesystem", AZ::s64{0}},
|
||||
ConfigFileParams::SettingsKeyValuePair{"/android_remote_filesystem", AZ::s64{0}},
|
||||
ConfigFileParams::SettingsKeyValuePair{"/ios_remote_filesystem", AZ::s64{0}},
|
||||
@@ -428,7 +455,7 @@ mac_wait_for_connect=0
|
||||
// Parses a fake AssetProcessorPlatformConfig file which contains sections headers
|
||||
// and does not end with a newline
|
||||
ConfigFileParams{ "fake_AssetProcessorPlatformConfig.ini", R"(
|
||||
; ---- Enable/Disable platforms for the entire project. AssetProcessor will automatically add the current platform by default.
|
||||
; ---- Enable/Disable platforms for the entire project. AssetProcessor will automatically add the current platform by default.
|
||||
|
||||
; PLATFORM DEFINITIONS
|
||||
; [Platform (unique identifier)]
|
||||
@@ -452,7 +479,7 @@ test_asset_processor_tag = test_value
|
||||
tags=tools,renderer,dx12,vulkan
|
||||
|
||||
[Platform es3]
|
||||
tags=android,mobile,renderer,vulkan
|
||||
tags=android,mobile,renderer,vulkan ; With Comments at the end
|
||||
|
||||
[Platform ios]
|
||||
tags=mobile,renderer,metal
|
||||
@@ -489,76 +516,30 @@ tags=tools,renderer,metal)"
|
||||
TEST_F(SettingsRegistryMergeUtilsCommandLineFixture, CommandLineArguments_MergeToSettingsRegistry_Success)
|
||||
{
|
||||
AZ::CommandLine commandLine;
|
||||
commandLine.Parse({ "programname.exe", "--gamefolder", "--RemoteIp", "10.0.0.1", "--ScanFolders", R"(\a\b\c,\d\e\f)", "Foo", "Bat" });
|
||||
commandLine.Parse({ "programname.exe", "--project-path", "--RemoteIp", "10.0.0.1", "--ScanFolders", R"(\a\b\c,\d\e\f)", "Foo", "Bat" });
|
||||
|
||||
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_StoreCommandLine(*m_registry, commandLine);
|
||||
AZ::SettingsRegistryMergeUtils::StoreCommandLineToRegistry(*m_registry, commandLine);
|
||||
// Clear the CommandLine instance
|
||||
commandLine = {};
|
||||
|
||||
struct CommandLineVisitor
|
||||
: AZ::SettingsRegistryInterface::Visitor
|
||||
{
|
||||
AZ::SettingsRegistryInterface::VisitResponse Traverse(AZStd::string_view jsonPointer, AZStd::string_view,
|
||||
AZ::SettingsRegistryInterface::VisitAction action, AZ::SettingsRegistryInterface::Type) override
|
||||
{
|
||||
if (action == AZ::SettingsRegistryInterface::VisitAction::Begin)
|
||||
{
|
||||
// Strip off the last key of the jsonPointer and check if the path is the command line root switch key
|
||||
// i.e "/../CommandLine/Switches
|
||||
AZStd::optional<AZStd::string_view> optionName = AZ::StringFunc::TokenizeLast(jsonPointer, '/');
|
||||
if (jsonPointer == AZ::SettingsRegistryMergeUtils::CommandLineSwitchRootKey && optionName && !optionName->empty())
|
||||
{
|
||||
// Add a empty mapping of option name to values if it is not in the map already
|
||||
m_optionArguments[*optionName];
|
||||
}
|
||||
}
|
||||
EXPECT_TRUE(AZ::SettingsRegistryMergeUtils::GetCommandLineFromRegistry(*m_registry, commandLine));
|
||||
|
||||
return AZ::SettingsRegistryInterface::VisitResponse::Continue;
|
||||
}
|
||||
ASSERT_TRUE(commandLine.HasSwitch("project-path"));
|
||||
EXPECT_EQ(1, commandLine.GetNumSwitchValues("project-path"));
|
||||
EXPECT_STREQ("", commandLine.GetSwitchValue("project-path", 0).c_str());
|
||||
|
||||
void Visit(AZStd::string_view jsonPointer, AZStd::string_view, AZ::SettingsRegistryInterface::Type
|
||||
, AZStd::string_view value) override
|
||||
{
|
||||
// Strip off the last key from the jsonPointer and return that in the option name parameter
|
||||
AZStd::optional<AZStd::string_view> optionName = AZ::StringFunc::TokenizeLast(jsonPointer, '/');
|
||||
if (jsonPointer == AZ::SettingsRegistryMergeUtils::CommandLineMiscValuesRootKey)
|
||||
{
|
||||
m_positionalArguments.push_back(value);
|
||||
}
|
||||
else if (jsonPointer.starts_with(AZ::SettingsRegistryMergeUtils::CommandLineSwitchRootKey) && optionName)
|
||||
{
|
||||
// Option arguments are stored in array indices, underneath the option key
|
||||
// Therefore remove another token from the jsonPointer to retrieve the actual option name
|
||||
if (optionName = AZ::StringFunc::TokenizeLast(jsonPointer, '/'); optionName && !optionName->empty())
|
||||
{
|
||||
// Add an entry for the option with the specified value
|
||||
m_optionArguments[*optionName].push_back(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
ASSERT_TRUE(commandLine.HasSwitch("remoteip"));
|
||||
ASSERT_EQ(1, commandLine.GetNumSwitchValues("remoteip"));
|
||||
EXPECT_STREQ("10.0.0.1", commandLine.GetSwitchValue("remoteip", 0).c_str());
|
||||
|
||||
AZ::CommandLine::ParamMap m_optionArguments;
|
||||
AZ::CommandLine::ParamContainer m_positionalArguments;
|
||||
};
|
||||
ASSERT_TRUE(commandLine.HasSwitch("scanfolders"));
|
||||
ASSERT_EQ(2, commandLine.GetNumSwitchValues("scanfolders"));
|
||||
EXPECT_STREQ(R"(\a\b\c)", commandLine.GetSwitchValue("scanfolders", 0).c_str());
|
||||
EXPECT_STREQ(R"(\d\e\f)", commandLine.GetSwitchValue("scanfolders", 1).c_str());
|
||||
|
||||
CommandLineVisitor commandLineVisitor;
|
||||
EXPECT_TRUE(m_registry->Visit(commandLineVisitor, AZ::SettingsRegistryMergeUtils::CommandLineRootKey));
|
||||
EXPECT_EQ(3, commandLineVisitor.m_optionArguments.size());
|
||||
auto optionIter = commandLineVisitor.m_optionArguments.find("gamefolder");
|
||||
ASSERT_NE(commandLineVisitor.m_optionArguments.end(), optionIter);
|
||||
EXPECT_EQ(0, optionIter->second.size());
|
||||
|
||||
optionIter = commandLineVisitor.m_optionArguments.find("remoteip");
|
||||
ASSERT_NE(commandLineVisitor.m_optionArguments.end(), optionIter);
|
||||
ASSERT_EQ(1, optionIter->second.size());
|
||||
EXPECT_STREQ("10.0.0.1", optionIter->second[0].c_str());
|
||||
|
||||
optionIter = commandLineVisitor.m_optionArguments.find("scanfolders");
|
||||
ASSERT_NE(commandLineVisitor.m_optionArguments.end(), optionIter);
|
||||
ASSERT_EQ(2, optionIter->second.size());
|
||||
EXPECT_STREQ(R"(\a\b\c)", optionIter->second[0].c_str());
|
||||
EXPECT_STREQ(R"(\d\e\f)", optionIter->second[1].c_str());
|
||||
|
||||
ASSERT_EQ(2, commandLineVisitor.m_positionalArguments.size());
|
||||
EXPECT_STREQ("Foo", commandLineVisitor.m_positionalArguments[0].c_str());
|
||||
EXPECT_STREQ("Bat", commandLineVisitor.m_positionalArguments[1].c_str());
|
||||
ASSERT_EQ(3, commandLine.GetNumMiscValues());
|
||||
EXPECT_STREQ("programname.exe", commandLine.GetMiscValue(0).c_str());
|
||||
EXPECT_STREQ("Foo", commandLine.GetMiscValue(1).c_str());
|
||||
EXPECT_STREQ("Bat", commandLine.GetMiscValue(2).c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -499,6 +499,38 @@ namespace SettingsRegistryTests
|
||||
EXPECT_TRUE(this->m_registry->Visit(visitor, "/Test/Object/Type"));
|
||||
}
|
||||
|
||||
TEST_F(SettingsRegistryTest, VisitWithVisitor_EndOfPathArguments_MatchesValueNameArgument_ForAllIterations)
|
||||
{
|
||||
// Validate that every invocation of the Traverse and Visit command supplies a 'path' parameter
|
||||
// whose end matches that of the 'valueName' parameter
|
||||
AZStd::string json{
|
||||
R"({
|
||||
"Test":
|
||||
{
|
||||
"Object":{ "Type": "TestString" }
|
||||
}
|
||||
})"
|
||||
};
|
||||
ASSERT_TRUE(this->m_registry->MergeSettings(json.c_str(), AZ::SettingsRegistryInterface::Format::JsonMergePatch));
|
||||
|
||||
struct : public AZ::SettingsRegistryInterface::Visitor
|
||||
{
|
||||
AZ::SettingsRegistryInterface::VisitResponse Traverse(AZStd::string_view path, AZStd::string_view valueName,
|
||||
AZ::SettingsRegistryInterface::VisitAction, AZ::SettingsRegistryInterface::Type) override
|
||||
{
|
||||
EXPECT_TRUE(path.ends_with(valueName));
|
||||
return AZ::SettingsRegistryInterface::VisitResponse::Continue;
|
||||
}
|
||||
void Visit(AZStd::string_view path, AZStd::string_view valueName, AZ::SettingsRegistryInterface::Type , AZStd::string_view)override
|
||||
{
|
||||
EXPECT_TRUE(path.ends_with(valueName));
|
||||
}
|
||||
} visitor;
|
||||
|
||||
EXPECT_TRUE(this->m_registry->Visit(visitor, ""));
|
||||
EXPECT_TRUE(this->m_registry->Visit(visitor, "/Test"));
|
||||
}
|
||||
|
||||
//
|
||||
// Object
|
||||
//
|
||||
@@ -730,7 +762,7 @@ namespace SettingsRegistryTests
|
||||
|
||||
AZStd::vector<RegistryEntry> expected =
|
||||
{
|
||||
RegistryEntry("/Test", "", SRI::Type::Object, SRI::VisitAction::Begin),
|
||||
RegistryEntry("/Test", "Test", SRI::Type::Object, SRI::VisitAction::Begin),
|
||||
|
||||
RegistryEntry("/Test/Object", "Object", SRI::Type::Object, SRI::VisitAction::Begin),
|
||||
RegistryEntry("/Test/Object/NullType", "NullType", SRI::Type::Null, SRI::VisitAction::Value),
|
||||
@@ -752,7 +784,7 @@ namespace SettingsRegistryTests
|
||||
RegistryEntry("/Test/Array/6", "6", SRI::Type::String, SRI::VisitAction::Value),
|
||||
RegistryEntry("/Test/Array", "Array", SRI::Type::Array, SRI::VisitAction::End),
|
||||
|
||||
RegistryEntry("/Test", "", SRI::Type::Object, SRI::VisitAction::End)
|
||||
RegistryEntry("/Test", "Test", SRI::Type::Object, SRI::VisitAction::End)
|
||||
};
|
||||
|
||||
Visit(expected, "/Test");
|
||||
@@ -778,11 +810,11 @@ namespace SettingsRegistryTests
|
||||
|
||||
AZStd::vector<RegistryEntry> expected =
|
||||
{
|
||||
RegistryEntry("/Layer1/Layer2", "", SRI::Type::Object, SRI::VisitAction::Begin),
|
||||
RegistryEntry("/Layer1/Layer2", "Layer2", SRI::Type::Object, SRI::VisitAction::Begin),
|
||||
RegistryEntry("/Layer1/Layer2/Layer3", "Layer3", SRI::Type::Object, SRI::VisitAction::Begin),
|
||||
RegistryEntry("/Layer1/Layer2/Layer3/StringType", "StringType", SRI::Type::String, SRI::VisitAction::Value),
|
||||
RegistryEntry("/Layer1/Layer2/Layer3", "Layer3", SRI::Type::Object, SRI::VisitAction::End),
|
||||
RegistryEntry("/Layer1/Layer2", "", SRI::Type::Object, SRI::VisitAction::End)
|
||||
RegistryEntry("/Layer1/Layer2", "Layer2", SRI::Type::Object, SRI::VisitAction::End)
|
||||
};
|
||||
|
||||
Visit(expected, "/Layer1/Layer2");
|
||||
@@ -806,9 +838,9 @@ namespace SettingsRegistryTests
|
||||
|
||||
AZStd::vector<RegistryEntry> expected =
|
||||
{
|
||||
RegistryEntry("/Object/0/0", "", SRI::Type::Array, SRI::VisitAction::Begin),
|
||||
RegistryEntry("/Object/0/0", "0", SRI::Type::Array, SRI::VisitAction::Begin),
|
||||
RegistryEntry("/Object/0/0/0", "0", SRI::Type::String, SRI::VisitAction::Value),
|
||||
RegistryEntry("/Object/0/0", "", SRI::Type::Array, SRI::VisitAction::End)
|
||||
RegistryEntry("/Object/0/0", "0", SRI::Type::Array, SRI::VisitAction::End)
|
||||
};
|
||||
|
||||
Visit(expected, "/Object/0/0");
|
||||
@@ -830,7 +862,7 @@ namespace SettingsRegistryTests
|
||||
|
||||
AZStd::vector<RegistryEntry> expected =
|
||||
{
|
||||
RegistryEntry("/Test", "", SRI::Type::Object, SRI::VisitAction::Begin),
|
||||
RegistryEntry("/Test", "Test", SRI::Type::Object, SRI::VisitAction::Begin),
|
||||
|
||||
RegistryEntry("/Test/Object0", "Object0", SRI::Type::Object, SRI::VisitAction::Begin),
|
||||
RegistryEntry("/Test/Object0/Field", "Field", SRI::Type::Integer, SRI::VisitAction::Value),
|
||||
@@ -842,7 +874,7 @@ namespace SettingsRegistryTests
|
||||
RegistryEntry("/Test/Object2/Field", "Field", SRI::Type::Integer, SRI::VisitAction::Value),
|
||||
RegistryEntry("/Test/Object2", "Object2", SRI::Type::Object, SRI::VisitAction::End),
|
||||
|
||||
RegistryEntry("/Test", "", SRI::Type::Object, SRI::VisitAction::End)
|
||||
RegistryEntry("/Test", "Test", SRI::Type::Object, SRI::VisitAction::End)
|
||||
};
|
||||
|
||||
Visit(expected, "/Test");
|
||||
@@ -864,7 +896,7 @@ namespace SettingsRegistryTests
|
||||
|
||||
AZStd::vector<RegistryEntry> expected =
|
||||
{
|
||||
RegistryEntry("/Test", "", SRI::Type::Object, SRI::VisitAction::Begin),
|
||||
RegistryEntry("/Test", "Test", SRI::Type::Object, SRI::VisitAction::Begin),
|
||||
|
||||
RegistryEntry("/Test/Array0", "Array0", SRI::Type::Array, SRI::VisitAction::Begin),
|
||||
RegistryEntry("/Test/Array0/0", "0", SRI::Type::Integer, SRI::VisitAction::Value),
|
||||
@@ -878,7 +910,7 @@ namespace SettingsRegistryTests
|
||||
RegistryEntry("/Test/Array2/1", "1", SRI::Type::Integer, SRI::VisitAction::Value),
|
||||
RegistryEntry("/Test/Array2", "Array2", SRI::Type::Array, SRI::VisitAction::End),
|
||||
|
||||
RegistryEntry("/Test", "", SRI::Type::Object, SRI::VisitAction::End)
|
||||
RegistryEntry("/Test", "Test", SRI::Type::Object, SRI::VisitAction::End)
|
||||
};
|
||||
|
||||
Visit(expected, "/Test");
|
||||
@@ -900,7 +932,7 @@ namespace SettingsRegistryTests
|
||||
|
||||
AZStd::vector<RegistryEntry> expected =
|
||||
{
|
||||
RegistryEntry("/Test", "", SRI::Type::Object, SRI::VisitAction::Begin),
|
||||
RegistryEntry("/Test", "Test", SRI::Type::Object, SRI::VisitAction::Begin),
|
||||
|
||||
RegistryEntry("/Test/Object0", "Object0", SRI::Type::Object, SRI::VisitAction::Begin),
|
||||
RegistryEntry("/Test/Object0/Field", "Field", SRI::Type::Integer, SRI::VisitAction::Value),
|
||||
@@ -928,7 +960,7 @@ namespace SettingsRegistryTests
|
||||
|
||||
AZStd::vector<RegistryEntry> expected =
|
||||
{
|
||||
RegistryEntry("/Test", "", SRI::Type::Object, SRI::VisitAction::Begin),
|
||||
RegistryEntry("/Test", "Test", SRI::Type::Object, SRI::VisitAction::Begin),
|
||||
|
||||
RegistryEntry("/Test/Object0", "Object0", SRI::Type::Object, SRI::VisitAction::Begin),
|
||||
RegistryEntry("/Test/Object0/Field", "Field", SRI::Type::Integer, SRI::VisitAction::Value),
|
||||
@@ -954,7 +986,7 @@ namespace SettingsRegistryTests
|
||||
|
||||
AZStd::vector<RegistryEntry> expected =
|
||||
{
|
||||
RegistryEntry("/Test", "", SRI::Type::Object, SRI::VisitAction::Begin),
|
||||
RegistryEntry("/Test", "Test", SRI::Type::Object, SRI::VisitAction::Begin),
|
||||
|
||||
RegistryEntry("/Test/Array0", "Array0", SRI::Type::Array, SRI::VisitAction::Begin),
|
||||
RegistryEntry("/Test/Array0/0", "0", SRI::Type::Integer, SRI::VisitAction::Value),
|
||||
@@ -984,7 +1016,7 @@ namespace SettingsRegistryTests
|
||||
|
||||
AZStd::vector<RegistryEntry> expected =
|
||||
{
|
||||
RegistryEntry("/Test", "", SRI::Type::Object, SRI::VisitAction::Begin),
|
||||
RegistryEntry("/Test", "Test", SRI::Type::Object, SRI::VisitAction::Begin),
|
||||
|
||||
RegistryEntry("/Test/Array0", "Array0", SRI::Type::Array, SRI::VisitAction::Begin),
|
||||
RegistryEntry("/Test/Array0/0", "0", SRI::Type::Integer, SRI::VisitAction::Value),
|
||||
@@ -1700,11 +1732,7 @@ namespace SettingsRegistryTests
|
||||
EXPECT_EQ(AZ::SettingsRegistryInterface::Type::String, m_registry->GetType(AZ_SETTINGS_REGISTRY_HISTORY_KEY "/0/Path"));
|
||||
}
|
||||
|
||||
#if AZ_TRAIT_DISABLE_FAILED_MERGESETTINGSFOLDER_CONFLICTINGSPECIALIZATIONS
|
||||
TEST_F(SettingsRegistryTest, DISABLED_MergeSettingsFolder_ConflictingSpecializations_ReportsErrorAndReturnsFalse)
|
||||
#else
|
||||
TEST_F(SettingsRegistryTest, MergeSettingsFolder_ConflictingSpecializations_ReportsErrorAndReturnsFalse)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_MERGESETTINGSFOLDER_CONFLICTINGSPECIALIZATIONS
|
||||
{
|
||||
CreateTestFile("Memory.test.editor.setreg", "{}");
|
||||
CreateTestFile("Memory.editor.test.setreg", "{}");
|
||||
|
||||
@@ -22,6 +22,35 @@ namespace AZ
|
||||
|
||||
using StringFuncTest = AllocatorsFixture;
|
||||
|
||||
TEST_F(StringFuncTest, Equal_CaseSensitive_OnNonNullTerminatedStringView_Success)
|
||||
{
|
||||
constexpr AZStd::string_view testString1 = "Hello World IceCream";
|
||||
constexpr AZStd::string_view testString2 = "IceCream World Hello";
|
||||
constexpr bool caseSensitive = true;
|
||||
EXPECT_TRUE(AZ::StringFunc::Equal(testString1.substr(6,5), testString2.substr(9,5), caseSensitive));
|
||||
}
|
||||
TEST_F(StringFuncTest, Equal_CaseInsensitive_OnNonNullTerminatedStringView_Success)
|
||||
{
|
||||
constexpr AZStd::string_view testString1 = "Hello World IceCream";
|
||||
constexpr AZStd::string_view testString2 = "IceCream woRLd Hello";
|
||||
constexpr bool caseSensitive = false;
|
||||
EXPECT_TRUE(AZ::StringFunc::Equal(testString1.substr(6, 5), testString2.substr(9, 5), caseSensitive));
|
||||
}
|
||||
TEST_F(StringFuncTest, Equal_CaseSensitive_OnNonNullTerminatedStringView_WithDifferentCases_Fails)
|
||||
{
|
||||
constexpr AZStd::string_view testString1 = "Hello World IceCream";
|
||||
constexpr AZStd::string_view testString2 = "IceCream woRLd Hello";
|
||||
constexpr bool caseSensitive = true;
|
||||
EXPECT_FALSE(AZ::StringFunc::Equal(testString1.substr(6, 5), testString2.substr(9, 5), caseSensitive));
|
||||
}
|
||||
TEST_F(StringFuncTest, Equal_OnNonNullTerminatedStringView_WithDifferentSize_Fails)
|
||||
{
|
||||
constexpr AZStd::string_view testString1 = "Hello World IceCream";
|
||||
constexpr AZStd::string_view testString2 = "IceCream World Hello";
|
||||
|
||||
EXPECT_FALSE(AZ::StringFunc::Equal(testString1.substr(6, 6), testString2.substr(9, 5)));
|
||||
}
|
||||
|
||||
// Strip out any trailing path separators
|
||||
|
||||
TEST_F(StringFuncTest, Strip_ValidInputExtraEndingPathSeparators_Success)
|
||||
|
||||
Reference in New Issue
Block a user