diff --git a/Code/Framework/AzCore/AzCore/Serialization/Json/JsonDeserializer.cpp b/Code/Framework/AzCore/AzCore/Serialization/Json/JsonDeserializer.cpp index 8d0da9e54a..9e0ab80dd1 100644 --- a/Code/Framework/AzCore/AzCore/Serialization/Json/JsonDeserializer.cpp +++ b/Code/Framework/AzCore/AzCore/Serialization/Json/JsonDeserializer.cpp @@ -33,10 +33,10 @@ namespace AZ "Target object for Json Serialization is pointing to nothing during loading."); } - if (IsExplicitDefault(value)) + /*if (IsExplicitDefault(value)) { return context.Report(Tasks::ReadField, Outcomes::DefaultsUsed, "Value has an explicit default."); - } + }*/ BaseJsonSerializer* serializer = context.GetRegistrationContext()->GetSerializerForType(typeId); if (serializer) diff --git a/Gems/PhysX/Code/Tests/PhysXColliderPrefabTests.cpp b/Gems/PhysX/Code/Tests/PhysXColliderPrefabTests.cpp index 4287ce17db..5748fca931 100644 --- a/Gems/PhysX/Code/Tests/PhysXColliderPrefabTests.cpp +++ b/Gems/PhysX/Code/Tests/PhysXColliderPrefabTests.cpp @@ -36,7 +36,7 @@ namespace PhysX protected: }; - TEST_F(PhysXColliderPrefabTests, StoreAndLoad_DefaultPhysicsTypes_ValuesNotNull) + TEST_F(PhysXColliderPrefabTests, StoreAndLoad_DefaultPhysicsTypes_ValuesEqual) { //create a prefab for storing data AzToolsFramework::Prefab::PrefabDom prefabDom; @@ -130,58 +130,58 @@ namespace PhysX EXPECT_NE(nullptr, updatedColliderConfigPtr); } - TEST_F(PhysXColliderPrefabTests, StoreAndLoad_DefaultPhysicsColliderComponents_PointersNotNull) + TEST_F(PhysXColliderPrefabTests, StoreAndLoad_DefaultPhysicsColliderComponents_ValuesEqual) { //create a prefab for storing data AzToolsFramework::Prefab::PrefabDom prefabDom; //shared pointer - box collider - defaults only - auto boxColliderPtr = AZStd::make_shared(); + BoxColliderComponent boxColliderComponent; AZ::JsonSerializationResult::ResultCode result - = AZ::JsonSerialization::Store(prefabDom, prefabDom.GetAllocator(), boxColliderPtr); + = AZ::JsonSerialization::Store(prefabDom, prefabDom.GetAllocator(), boxColliderComponent); EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - boxColliderPtr = nullptr; - result = AZ::JsonSerialization::Load(boxColliderPtr, prefabDom); + BoxColliderComponent newBoxColliderComponent; + result = AZ::JsonSerialization::Load(newBoxColliderComponent, prefabDom); EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - EXPECT_NE(nullptr, boxColliderPtr); + EXPECT_EQ(newBoxColliderComponent.GetCollisionLayerName(), boxColliderComponent.GetCollisionLayerName()); //shared pointer - sphere collider - defaults only - auto sphereColliderPtr = AZStd::make_shared(); - result = AZ::JsonSerialization::Store(prefabDom, prefabDom.GetAllocator(), sphereColliderPtr); + SphereColliderComponent sphereColliderComponent; + result = AZ::JsonSerialization::Store(prefabDom, prefabDom.GetAllocator(), sphereColliderComponent); EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - sphereColliderPtr = nullptr; - result = AZ::JsonSerialization::Load(sphereColliderPtr, prefabDom); + SphereColliderComponent newSphereColliderComponent; + result = AZ::JsonSerialization::Load(newSphereColliderComponent, prefabDom); EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - EXPECT_NE(nullptr, sphereColliderPtr); + EXPECT_EQ(newSphereColliderComponent.GetCollisionLayerName(), sphereColliderComponent.GetCollisionLayerName()); //shared pointer - capsule collider - defaults only - auto capsuleColliderPtr = AZStd::make_shared(); - result = AZ::JsonSerialization::Store(prefabDom, prefabDom.GetAllocator(), capsuleColliderPtr); + CapsuleColliderComponent capsuleColliderComponent; + result = AZ::JsonSerialization::Store(prefabDom, prefabDom.GetAllocator(), capsuleColliderComponent); EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - capsuleColliderPtr = nullptr; - result = AZ::JsonSerialization::Load(capsuleColliderPtr, prefabDom); + CapsuleColliderComponent newCapsuleColliderComponent; + result = AZ::JsonSerialization::Load(newCapsuleColliderComponent, prefabDom); EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - EXPECT_NE(nullptr, capsuleColliderPtr); + EXPECT_EQ(newCapsuleColliderComponent.GetCollisionLayerName(), capsuleColliderComponent.GetCollisionLayerName()); //shared pointer - shape collider - defaults only - auto shapeColliderPtr = AZStd::make_shared(); - result = AZ::JsonSerialization::Store(prefabDom, prefabDom.GetAllocator(), shapeColliderPtr); + ShapeColliderComponent shapeColliderComponent; + result = AZ::JsonSerialization::Store(prefabDom, prefabDom.GetAllocator(), shapeColliderComponent); EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - shapeColliderPtr = nullptr; - result = AZ::JsonSerialization::Load(shapeColliderPtr, prefabDom); + ShapeColliderComponent newShapeColliderComponent; + result = AZ::JsonSerialization::Load(newShapeColliderComponent, prefabDom); EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - EXPECT_NE(nullptr, shapeColliderPtr); + EXPECT_EQ(newShapeColliderComponent.GetCollisionLayerName(), shapeColliderComponent.GetCollisionLayerName()); } }