Files
o3de/Gems/PhysX/Code/Tests/EditorTestUtilities.h
T
Mike Balfour 2fe4524458 Terrain API cleanups (#4914)
* Terrain API fixups
Moved SurfaceData definitions in AzFramework out of terrain into separate files.
Added some missing API calls: Get*FromVector2, GetSurfacePoint*
Changed OrderedSurfaceTagWeightSet to SurfaceTagWeightList

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* PR feedback - remove IsClose check.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Fixed PhysX test compile failures by redcoding a bunch of "dummy terrain" implementation that's unused.
It was originally added for the PhysX Terrain component, but that component is long gone and has been superceded by the more generic PhysX Heightfield Collider.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>

* Fixed up failing terrain unit tests.
Added API changes, and changed the assumption on where the surface weight sort is taking place.  The component is no longer expected to provide the sorted list, it only needs to be sorted at the end coming out of the terrain system, so the unit tests have been modified to reflect that.

Signed-off-by: Mike Balfour <82224783+mbalfour-amzn@users.noreply.github.com>
2021-10-22 14:22:57 -05:00

61 lines
2.1 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <AzCore/UnitTest/TestTypes.h>
#include <AzToolsFramework/UnitTest/AzToolsFrameworkTestHelpers.h>
#include <AzFramework/Physics/SystemBus.h>
#include <AzToolsFramework/UnitTest/AzToolsFrameworkTestHelpers.h>
#include <System/PhysXSystem.h>
namespace AzPhysics
{
struct TriggerEvent;
}
namespace PhysXEditorTests
{
using EntityPtr = AZStd::unique_ptr<AZ::Entity>;
//! Creates a default editor entity in an inactive state.
EntityPtr CreateInactiveEditorEntity(const char* entityName);
//! Creates and activates a game entity from an editor entity.
EntityPtr CreateActiveGameEntityFromEditorEntity(AZ::Entity* editorEntity);
//! Class used for loading system components from this gem.
class PhysXEditorSystemComponentEntity
: public AZ::Entity
{
friend class PhysXEditorFixture;
};
//! Test fixture which creates a tools application, loads the PhysX runtime gem and creates a default physics world.
//! The application is created for the whole test case, rather than individually for each test, due to a known
//! problem with buses when repeatedly loading and unloading gems. A new default world is created for each test.
class PhysXEditorFixture
: public UnitTest::AllocatorsTestFixture
, public Physics::DefaultWorldBus::Handler
{
public:
void SetUp() override;
void TearDown() override;
// DefaultWorldBus
AzPhysics::SceneHandle GetDefaultSceneHandle() const override;
AzPhysics::SceneHandle m_defaultSceneHandle = AzPhysics::InvalidSceneHandle;
AzPhysics::Scene* m_defaultScene = nullptr;
// workaround for parameterized tests causing issues with this (and any derived) fixture
void ValidateInvalidEditorShapeColliderComponentParams(float radius, float height);
};
} // namespace PhysXEditorTests