Merge branch 'development' into cmake/SPEC-7179
This commit is contained in:
@@ -116,7 +116,7 @@ namespace AZ
|
||||
{
|
||||
const char* uuidString = nullptr;
|
||||
unsigned int uuidStringLength = 0;
|
||||
if (dc.ReadArg(0, uuidString) && dc.ReadValue(1, uuidStringLength))
|
||||
if (dc.ReadArg(0, uuidString) && dc.ReadArg(1, uuidStringLength))
|
||||
{
|
||||
dc.PushResult(Uuid(uuidString, uuidStringLength));
|
||||
}
|
||||
|
||||
@@ -157,8 +157,11 @@ ScriptContextDebug::EnumRegisteredClasses(EnumClass enumClass, EnumMethod enumMe
|
||||
lua_pop(l, 2); // pop the Class name and behaviorClass
|
||||
|
||||
lua_pushnil(l);
|
||||
|
||||
// iterate over the key/value pairs
|
||||
while (lua_next(l, -2) != 0)
|
||||
{
|
||||
// if key: string value: function
|
||||
if (lua_isstring(l, -2) && lua_isfunction(l, -1))
|
||||
{
|
||||
const char* name = lua_tostring(l, -2);
|
||||
@@ -167,6 +170,7 @@ ScriptContextDebug::EnumRegisteredClasses(EnumClass enumClass, EnumMethod enumMe
|
||||
bool isRead = true;
|
||||
bool isWrite = true;
|
||||
|
||||
// check if there is a getter provided
|
||||
lua_getupvalue(l, -1, 1);
|
||||
if (lua_isnil(l, -1))
|
||||
{
|
||||
@@ -174,6 +178,7 @@ ScriptContextDebug::EnumRegisteredClasses(EnumClass enumClass, EnumMethod enumMe
|
||||
}
|
||||
lua_pop(l, 1);
|
||||
|
||||
// check if there is a setter provided
|
||||
lua_getupvalue(l, -1, 2);
|
||||
if (lua_isnil(l, -1))
|
||||
{
|
||||
@@ -181,6 +186,7 @@ ScriptContextDebug::EnumRegisteredClasses(EnumClass enumClass, EnumMethod enumMe
|
||||
}
|
||||
lua_pop(l, 1);
|
||||
|
||||
// enumerate the remaining property
|
||||
if (!enumProperty(&behaviorClass->m_typeId, name, isRead, isWrite, userData))
|
||||
{
|
||||
lua_pop(l, 5);
|
||||
@@ -189,21 +195,30 @@ ScriptContextDebug::EnumRegisteredClasses(EnumClass enumClass, EnumMethod enumMe
|
||||
}
|
||||
else
|
||||
{
|
||||
// for any non-built in methods
|
||||
if (strncmp(name, "__", 2) != 0)
|
||||
{
|
||||
const char* dbgParamInfo = NULL;
|
||||
lua_getupvalue(l, -1, 2);
|
||||
|
||||
// attempt to get the name
|
||||
bool popDebugName = lua_getupvalue(l, -1, 2) != nullptr;
|
||||
if (lua_isstring(l, -1))
|
||||
{
|
||||
dbgParamInfo = lua_tostring(l, -1);
|
||||
}
|
||||
|
||||
// enumerate the method's parameters
|
||||
if (!enumMethod(&behaviorClass->m_typeId, name, dbgParamInfo, userData))
|
||||
{
|
||||
lua_pop(l, 6);
|
||||
return;
|
||||
}
|
||||
lua_pop(l, 1); // pop the DBG name
|
||||
|
||||
// if we were able to get the name, pop it from the stack
|
||||
if (popDebugName)
|
||||
{
|
||||
lua_pop(l, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
*/
|
||||
|
||||
#include <AZTestShared/Utils/Utils.h>
|
||||
#include "AzCore/Component/Entity.h"
|
||||
#include "AzCore/Asset/AssetManager.h"
|
||||
#include "AzCore/Slice/SliceComponent.h"
|
||||
#include <AzCore/Component/Entity.h>
|
||||
#include <AzCore/Asset/AssetManager.h>
|
||||
#include <AzCore/Slice/SliceComponent.h>
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include <AzCore/Math/Vector3.h>
|
||||
#include <AzCore/Serialization/Json/JsonSerializationSettings.h>
|
||||
#include <AzCore/std/string/string_view.h>
|
||||
#include <Tests/Serialization/Json/JsonSerializationTests.h>
|
||||
|
||||
@@ -43,7 +44,9 @@ namespace JsonSerializationTests
|
||||
}
|
||||
|
||||
void CheckApplyPatchOutcome(const char* target, const char* patch,
|
||||
AZ::JsonSerializationResult::Outcomes outcome, AZ::JsonSerializationResult::Processing processing)
|
||||
AZ::JsonSerializationResult::Outcomes outcome,
|
||||
AZ::JsonSerializationResult::Processing processing,
|
||||
const AZ::JsonApplyPatchSettings& settings = AZ::JsonApplyPatchSettings{})
|
||||
{
|
||||
m_jsonDocument->Parse(target);
|
||||
ASSERT_FALSE(m_jsonDocument->HasParseError());
|
||||
@@ -53,12 +56,24 @@ namespace JsonSerializationTests
|
||||
ASSERT_FALSE(patchDocument.HasParseError());
|
||||
|
||||
AZ::JsonSerializationResult::ResultCode result = AZ::JsonSerialization::ApplyPatch(*m_jsonDocument,
|
||||
m_jsonDocument->GetAllocator(), patchDocument, AZ::JsonMergeApproach::JsonPatch);
|
||||
m_jsonDocument->GetAllocator(), patchDocument, AZ::JsonMergeApproach::JsonPatch, settings);
|
||||
EXPECT_EQ(result.GetTask(), AZ::JsonSerializationResult::Tasks::Merge);
|
||||
EXPECT_EQ(result.GetOutcome(), outcome);
|
||||
EXPECT_EQ(result.GetProcessing(), processing);
|
||||
}
|
||||
|
||||
void CheckApplyPatchOutcome(
|
||||
const char* target,
|
||||
const char* patch,
|
||||
const char* expectedPatchedResult,
|
||||
AZ::JsonSerializationResult::Outcomes outcome,
|
||||
AZ::JsonSerializationResult::Processing processing,
|
||||
const AZ::JsonApplyPatchSettings& settings = AZ::JsonApplyPatchSettings{})
|
||||
{
|
||||
CheckApplyPatchOutcome(target, patch, outcome, processing, settings);
|
||||
Expect_DocStrEq(expectedPatchedResult);
|
||||
}
|
||||
|
||||
void CheckCreatePatch_Core(const char* source, AZStd::string_view patch, const char* target,
|
||||
AZ::JsonMergeApproach approach)
|
||||
{
|
||||
@@ -262,6 +277,36 @@ namespace JsonSerializationTests
|
||||
Outcomes::TypeMismatch, Processing::Halted);
|
||||
}
|
||||
|
||||
TEST_F(JsonPatchingSerializationTests, ApplyPatch_UseJsonPatchWithCustomReportingCallback_ReportPartialSkip)
|
||||
{
|
||||
using namespace AZ::JsonSerializationResult;
|
||||
auto issueReportingCallback = [](AZStd::string_view, AZ::JsonSerializationResult::ResultCode result,
|
||||
AZStd::string_view) -> AZ::JsonSerializationResult::ResultCode
|
||||
{
|
||||
using namespace AZ::JsonSerializationResult;
|
||||
if (result.GetProcessing() == Processing::Halted)
|
||||
{
|
||||
return ResultCode(result.GetTask(), Outcomes::PartialSkip);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
AZ::JsonApplyPatchSettings applyPatchSettings;
|
||||
applyPatchSettings.m_reporting = AZStd::move(issueReportingCallback);
|
||||
CheckApplyPatchOutcome(
|
||||
R"({})",
|
||||
R"([
|
||||
{ "op": "add", "path": "/nonexistent_key/new_member", "value": "someValue" },
|
||||
{ "op": "add", "path": "/test", "value": "someValue" }
|
||||
])",
|
||||
R"(
|
||||
{ "test": "someValue" }
|
||||
)",
|
||||
Outcomes::PartialSkip,
|
||||
Processing::Completed,
|
||||
AZStd::move(applyPatchSettings));
|
||||
}
|
||||
|
||||
TEST_F(JsonPatchingSerializationTests, ApplyPatch_UseJsonPatchAddUnnamedMember_ReportsSuccess)
|
||||
{
|
||||
CheckApplyPatch(
|
||||
|
||||
Reference in New Issue
Block a user