Convert automated tests related to content and unused levels (#7416)

* Convert automated tests related to content/WaterSample level/Physics's Base level

Signed-off-by: chiyenteng <82238204+chiyenteng@users.noreply.github.com>

* Fix nits

Signed-off-by: chiyenteng <82238204+chiyenteng@users.noreply.github.com>

* Add missing .prefab level file

Signed-off-by: chiyenteng <82238204+chiyenteng@users.noreply.github.com>

* Fix nits

Signed-off-by: chiyenteng <82238204+chiyenteng@users.noreply.github.com>

* Convert Blast tests

Signed-off-by: chiyenteng <82238204+chiyenteng@users.noreply.github.com>

* Convert scripting tests

Signed-off-by: chiyenteng <82238204+chiyenteng@users.noreply.github.com>

* Remove useless comments

Signed-off-by: chiyenteng <82238204+chiyenteng@users.noreply.github.com>

* Revert Collider_AddColliderComponent change until prefab error message bug fixed

Signed-off-by: chiyenteng <82238204+chiyenteng@users.noreply.github.com>
This commit is contained in:
chiyenteng
2022-02-07 12:11:01 -08:00
committed by GitHub
parent 38a34d811d
commit 7c6c01d5a1
45 changed files with 2204 additions and 150 deletions
@@ -53,10 +53,12 @@ def CharacterController_SwitchLevels():
import os
import sys
from editor_python_test_tools.utils import Report
from editor_python_test_tools.utils import TestHelper as helper
import azlmbr.legacy.general as general
import azlmbr.bus
import editor_python_test_tools.hydra_editor_utils as hydra
# Constants
WAIT_FOR_ERRORS = 3.0
@@ -77,7 +79,7 @@ def CharacterController_SwitchLevels():
helper.exit_game_mode(Tests.level1_exit_game_mode)
# 2.1) Load level 2 (empty level)
helper.open_level("Physics", "Base")
hydra.open_base_level()
# 2.2) Enter game mode
helper.enter_game_mode(Tests.level2_enter_game_mode)
@@ -45,14 +45,15 @@ def Collider_CheckDefaultShapeSettingIsPxMesh():
from editor_python_test_tools.utils import Report
from editor_python_test_tools.utils import TestHelper as helper
import editor_python_test_tools.hydra_editor_utils as hydra
# Open 3D Engine Imports
import azlmbr.legacy.general as general
PHYSICS_ASSET_INDEX = 7 # Hardcoded enum index value for Shape property
helper.init_idle()
# 1) Load empty level
helper.open_level("Physics", "Base")
hydra.open_base_level()
# 2) Create an entity to hold the PhysX Shape Collider component
collider_entity = Entity.create_editor_entity("Collider")
@@ -54,6 +54,8 @@ def Collider_MultipleSurfaceSlots():
from editor_python_test_tools.utils import TestHelper as helper
from editor_python_test_tools.asset_utils import Asset
import editor_python_test_tools.hydra_editor_utils as hydra
# Constants
PHYSICS_ASSET_INDEX = 7 # Hardcoded enum index value for Shape property
SURFACE_TAG_COUNT = 4 # Number of surface tags included in used asset
@@ -62,9 +64,8 @@ def Collider_MultipleSurfaceSlots():
STATIC_MESH = os.path.join("assets", "Physics", "Collider_MultipleSurfaceSlots", "test.azmodel")
PHYSX_MESH = os.path.join("assets", "Physics","Collider_MultipleSurfaceSlots", "test.pxmesh")
helper.init_idle()
# 1) Load the empty level
helper.open_level("Physics", "Base")
hydra.open_base_level()
# 2) Create an entity
test_entity = Entity.create_editor_entity("test_entity")
@@ -54,15 +54,16 @@ def Collider_PxMeshAutoAssignedWhenAddingRenderMeshComponent():
from editor_python_test_tools.utils import TestHelper as helper
from editor_python_test_tools.asset_utils import Asset
import editor_python_test_tools.hydra_editor_utils as hydra
# Asset paths
STATIC_MESH = os.path.join("assets", "Physics", "Collider_PxMeshAutoAssigned", "spherebot", "r0-b_body.azmodel")
PHYSX_MESH = os.path.join(
"assets", "Physics", "Collider_PxMeshAutoAssigned", "spherebot", "r0-b_body.pxmesh"
)
helper.init_idle()
# 1) Load the empty level
helper.open_level("Physics", "Base")
hydra.open_base_level()
# 2) Create an entity
test_entity = Entity.create_editor_entity("test_entity")
@@ -53,6 +53,8 @@ def Collider_PxMeshAutoAssignedWhenModifyingRenderMeshComponent():
from editor_python_test_tools.utils import TestHelper as helper
from editor_python_test_tools.asset_utils import Asset
import editor_python_test_tools.hydra_editor_utils as hydra
# Open 3D Engine Imports
import azlmbr.legacy.general as general
@@ -60,9 +62,8 @@ def Collider_PxMeshAutoAssignedWhenModifyingRenderMeshComponent():
MESH_PROPERTY_PATH = "Controller|Configuration|Mesh Asset"
TESTED_PROPERTY_PATH = "Shape Configuration|Asset|PhysX Mesh"
helper.init_idle()
# 1) Load the empty level
helper.open_level("Physics", "Base")
hydra.open_base_level()
# 2) Create an entity
test_entity = Entity.create_editor_entity("test_entity")
@@ -62,7 +62,9 @@ def Collider_PxMeshConvexMeshCollides():
from editor_python_test_tools.utils import Report
from editor_python_test_tools.utils import TestHelper as helper
from editor_python_test_tools.asset_utils import Asset
import azlmbr.math as math
import editor_python_test_tools.hydra_editor_utils as hydra
# Open 3D Engine Imports
import azlmbr
@@ -73,9 +75,8 @@ def Collider_PxMeshConvexMeshCollides():
MESH_ASSET_PATH = os.path.join("assets", "Physics", "Collider_PxMeshConvexMeshCollides", "spherebot", "r0-b_body.pxmesh")
TIMEOUT = 2.0
helper.init_idle()
# 1) Load the level
helper.open_level("Physics", "Base")
hydra.open_base_level()
# 2) Create test entity
collider = EditorEntity.create_editor_entity_at([512.0, 512.0, 33.0], "Collider")
@@ -59,15 +59,16 @@ def Collider_PxMeshNotAutoAssignedWhenNoPhysicsFbx():
from editor_python_test_tools.utils import Tracer
from editor_python_test_tools.asset_utils import Asset
import editor_python_test_tools.hydra_editor_utils as hydra
# Open 3D Engine Imports
import azlmbr.asset as azasset
# Asset paths
STATIC_MESH = os.path.join("assets", "Physics", "Collider_PxMeshNotAutoAssignedWhenNoPhysicsFbx", "test_asset.azmodel")
helper.init_idle()
# 1) Load the empty level
helper.open_level("Physics", "Base")
hydra.open_base_level()
# 2) Create an entity
test_entity = Entity.create_editor_entity("test_entity")
@@ -44,15 +44,15 @@ def ForceRegion_WithNonTriggerColliderWarning():
:return: None
"""
import azlmbr.legacy.general as general
import editor_python_test_tools.hydra_editor_utils as hydra
from editor_python_test_tools.editor_entity_utils import EditorEntity
from editor_python_test_tools.utils import Report
from editor_python_test_tools.utils import TestHelper as helper
from editor_python_test_tools.utils import Tracer
helper.init_idle()
# 1) Load the empty level
helper.open_level("Physics", "Base")
hydra.open_base_level()
# 2) Create test entity
test_entity = EditorEntity.create_editor_entity("TestEntity")
@@ -57,6 +57,8 @@ def Material_LibraryClearingAssignsDefault():
from editor_python_test_tools.utils import TestHelper as helper
from editor_python_test_tools.asset_utils import Asset
import editor_python_test_tools.hydra_editor_utils as hydra
# Open 3D Engine Imports
import azlmbr.asset as azasset
@@ -66,9 +68,8 @@ def Material_LibraryClearingAssignsDefault():
default_material_path = os.path.join("assets", "physics", "surfacetypemateriallibrary.physmaterial")
new_material_path = os.path.join("physicssurfaces", "default_phys_materials.physmaterial")
helper.init_idle()
# 1) Load the level
helper.open_level("Physics", "Base")
hydra.open_base_level()
# 2) Create new Entity with PhysX Character Controller
test_entity = EditorEntity.create_editor_entity("TestEntity")
@@ -49,9 +49,10 @@ def Ragdoll_AddPhysxRagdollComponentWorks():
from editor_python_test_tools.utils import TestHelper as helper
from editor_python_test_tools.utils import Tracer
helper.init_idle()
import editor_python_test_tools.hydra_editor_utils as hydra
# 1) Load the level
helper.open_level("Physics", "Base")
hydra.open_base_level()
# 2) Create test entity
test_entity = EditorEntity.create_editor_entity("TestEntity")
@@ -50,12 +50,13 @@ def ShapeCollider_CanBeAddedWitNoWarnings():
from editor_python_test_tools.utils import TestHelper as helper
from editor_python_test_tools.utils import Tracer
import editor_python_test_tools.hydra_editor_utils as hydra
# Open 3D Engine Imports
import azlmbr.legacy.general as general
helper.init_idle()
# 1) Load the empty level
helper.open_level("Physics", "Base")
hydra.open_base_level()
# 2) Create an entity
collider_entity = Entity.create_editor_entity("Collider")
@@ -54,6 +54,8 @@ def ShapeCollider_InactiveWhenNoShapeComponent():
from editor_python_test_tools.editor_entity_utils import EditorEntity
from editor_python_test_tools.utils import TestHelper as helper
import editor_python_test_tools.hydra_editor_utils as hydra
# Open 3D Engine Imports
import azlmbr.bus as bus
import azlmbr.editor as editor
@@ -65,9 +67,8 @@ def ShapeCollider_InactiveWhenNoShapeComponent():
"""
return editor.EditorComponentAPIBus(bus.Broadcast, "IsComponentEnabled", component_id)
helper.init_idle()
# 1) Load the level
helper.open_level("Physics", "Base")
hydra.open_base_level()
# 2) Add an entity with a PhysX Shape Collider component.
collider = EditorEntity.create_editor_entity("Collider")
@@ -45,6 +45,8 @@ def ShapeCollider_LargeNumberOfShapeCollidersWontCrashEditor():
from editor_python_test_tools.utils import TestHelper as helper
from editor_python_test_tools.editor_entity_utils import EditorEntity as Entity
import editor_python_test_tools.hydra_editor_utils as hydra
# Open 3D Engine Imports
import azlmbr.legacy.general as general
@@ -61,9 +63,8 @@ def ShapeCollider_LargeNumberOfShapeCollidersWontCrashEditor():
# Wait 60 frames more
general.idle_wait_frames(60)
helper.init_idle()
# 1) Load the empty level
helper.open_level("Physics", "Base")
hydra.open_base_level()
# 2) Create 512 entities with PhysX Shape Collider and Sphere Shape components
entity_failure = False