diff --git a/Gems/PhysX/Code/CMakeLists.txt b/Gems/PhysX/Code/CMakeLists.txt index c6122744eb..ec98b0970f 100644 --- a/Gems/PhysX/Code/CMakeLists.txt +++ b/Gems/PhysX/Code/CMakeLists.txt @@ -45,7 +45,6 @@ ly_add_target( ${physx_dependency} AZ::AzCore AZ::AzFramework - AZ::AzToolsFramework Legacy::CryCommon Gem::LmbrCentral ) diff --git a/Gems/PhysX/Code/Tests/PhysXColliderPrefabTests.cpp b/Gems/PhysX/Code/Tests/PhysXColliderPrefabTests.cpp deleted file mode 100644 index 5748fca931..0000000000 --- a/Gems/PhysX/Code/Tests/PhysXColliderPrefabTests.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* -* 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 - -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - - -namespace PhysX -{ - class PhysXColliderPrefabTests - : public ::testing::Test - { - protected: - }; - - TEST_F(PhysXColliderPrefabTests, StoreAndLoad_DefaultPhysicsTypes_ValuesEqual) - { - //create a prefab for storing data - AzToolsFramework::Prefab::PrefabDom prefabDom; - - //material selection - Physics::MaterialSelection materialSelection; - AZ::JsonSerializationResult::ResultCode result - = AZ::JsonSerialization::Store(prefabDom, prefabDom.GetAllocator(), materialSelection); - - EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - - Physics::MaterialSelection newSelection; - result = AZ::JsonSerialization::Load(newSelection, prefabDom); - - EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - EXPECT_EQ(materialSelection.GetMaterialId(), newSelection.GetMaterialId()); - - //collider configuration - Physics::ColliderConfiguration colliderConfig; - result = AZ::JsonSerialization::Store(prefabDom, prefabDom.GetAllocator(), colliderConfig); - - EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - - - Physics::ColliderConfiguration newConfig; - result = AZ::JsonSerialization::Load(newConfig, prefabDom); - - EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - EXPECT_EQ(colliderConfig.m_collisionLayer, newConfig.m_collisionLayer); - } - - TEST_F(PhysXColliderPrefabTests, StoreAndLoad_DefaultPhysicsTypes_PointersNotNull) - { - //create a prefab for storing data - AzToolsFramework::Prefab::PrefabDom prefabDom; - - //shared pointer - collider configuration - defaults only - auto colliderConfigPtr = AZStd::make_shared(); - AZ::JsonSerializationResult::ResultCode result = AZ::JsonSerialization::Store(prefabDom, prefabDom.GetAllocator(), colliderConfigPtr); - - EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - - colliderConfigPtr = nullptr; - result = AZ::JsonSerialization::Load(colliderConfigPtr, prefabDom); - - EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - EXPECT_NE(nullptr, colliderConfigPtr); - - //shared pointer - shape configuration - defaults only - auto shapeConfigPtr = AZStd::make_shared(); - result = AZ::JsonSerialization::Store(prefabDom, prefabDom.GetAllocator(), shapeConfigPtr); - - EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - - shapeConfigPtr = nullptr; - result = AZ::JsonSerialization::Load(shapeConfigPtr, prefabDom); - - EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - EXPECT_NE(nullptr, shapeConfigPtr); - } - - TEST_F(PhysXColliderPrefabTests, StoreAndLoad_NonDefaultPhysicsTypes_PointersNotNull) - { - //create a prefab for storing data - AzToolsFramework::Prefab::PrefabDom prefabDom; - - //shared pointer - collider configuration - non default - auto updatedColliderConfigPtr = AZStd::make_shared(); - updatedColliderConfigPtr->m_isTrigger = true; - AZ::JsonSerializationResult::ResultCode result = AZ::JsonSerialization::Store(prefabDom, prefabDom.GetAllocator(), updatedColliderConfigPtr); - - EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - - updatedColliderConfigPtr = nullptr; - result = AZ::JsonSerialization::Load(updatedColliderConfigPtr, prefabDom); - - EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - EXPECT_NE(nullptr, updatedColliderConfigPtr); - - //shared pointer - shape configuration - non default - auto updatedShapeConfigPtr = AZStd::make_shared(); - updatedShapeConfigPtr->m_radius = 2.0f; - result = AZ::JsonSerialization::Store(prefabDom, prefabDom.GetAllocator(), updatedShapeConfigPtr); - - EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - - updatedShapeConfigPtr = nullptr; - result = AZ::JsonSerialization::Load(updatedShapeConfigPtr, prefabDom); - - EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - EXPECT_NE(nullptr, updatedColliderConfigPtr); - } - - TEST_F(PhysXColliderPrefabTests, StoreAndLoad_DefaultPhysicsColliderComponents_ValuesEqual) - { - //create a prefab for storing data - AzToolsFramework::Prefab::PrefabDom prefabDom; - - //shared pointer - box collider - defaults only - BoxColliderComponent boxColliderComponent; - AZ::JsonSerializationResult::ResultCode result - = AZ::JsonSerialization::Store(prefabDom, prefabDom.GetAllocator(), boxColliderComponent); - - EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - - BoxColliderComponent newBoxColliderComponent; - result = AZ::JsonSerialization::Load(newBoxColliderComponent, prefabDom); - - EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - EXPECT_EQ(newBoxColliderComponent.GetCollisionLayerName(), boxColliderComponent.GetCollisionLayerName()); - - //shared pointer - sphere collider - defaults only - SphereColliderComponent sphereColliderComponent; - result = AZ::JsonSerialization::Store(prefabDom, prefabDom.GetAllocator(), sphereColliderComponent); - - EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - - SphereColliderComponent newSphereColliderComponent; - result = AZ::JsonSerialization::Load(newSphereColliderComponent, prefabDom); - - EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - EXPECT_EQ(newSphereColliderComponent.GetCollisionLayerName(), sphereColliderComponent.GetCollisionLayerName()); - - //shared pointer - capsule collider - defaults only - CapsuleColliderComponent capsuleColliderComponent; - result = AZ::JsonSerialization::Store(prefabDom, prefabDom.GetAllocator(), capsuleColliderComponent); - - EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - - CapsuleColliderComponent newCapsuleColliderComponent; - result = AZ::JsonSerialization::Load(newCapsuleColliderComponent, prefabDom); - - EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - EXPECT_EQ(newCapsuleColliderComponent.GetCollisionLayerName(), capsuleColliderComponent.GetCollisionLayerName()); - - //shared pointer - shape collider - defaults only - ShapeColliderComponent shapeColliderComponent; - result = AZ::JsonSerialization::Store(prefabDom, prefabDom.GetAllocator(), shapeColliderComponent); - - EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - - ShapeColliderComponent newShapeColliderComponent; - result = AZ::JsonSerialization::Load(newShapeColliderComponent, prefabDom); - - EXPECT_EQ(AZ::JsonSerializationResult::Processing::Completed, result.GetProcessing()); - EXPECT_EQ(newShapeColliderComponent.GetCollisionLayerName(), shapeColliderComponent.GetCollisionLayerName()); - } -} diff --git a/Gems/PhysX/Code/physx_tests_files.cmake b/Gems/PhysX/Code/physx_tests_files.cmake index 182ff6a625..406aed64a7 100644 --- a/Gems/PhysX/Code/physx_tests_files.cmake +++ b/Gems/PhysX/Code/physx_tests_files.cmake @@ -25,7 +25,6 @@ set(FILES Tests/PhysXForceRegionTest.cpp Tests/PhysXMaterialLibraryTest.cpp Tests/PhysXCollisionFilteringTest.cpp - Tests/PhysXColliderPrefabTests.cpp Tests/PhysXJointsTest.cpp Tests/PhysXSceneTests.cpp Tests/PhysXSceneQueryTests.cpp