Standarization: Python files
Signed-off-by: ANT\aljanru <aljanru@amazon.co.uk>
This commit is contained in:
+104
@@ -0,0 +1,104 @@
|
||||
"""
|
||||
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
|
||||
"""
|
||||
|
||||
|
||||
# Test case ID : C5689522
|
||||
# Test Case Title : Create an entity with PhysX terrain. Add another PhysX terrain and verify that
|
||||
# you are able to add it without any crash or error.
|
||||
|
||||
|
||||
|
||||
# fmt: off
|
||||
class Tests():
|
||||
enter_game_mode = ("Entered game mode", "Failed to enter game mode")
|
||||
find_terrain_1 = ("Terrain 1 found", "Terrain 1 not found")
|
||||
find_terrain_2 = ("Terrain 2 found", "Terrain 2 not found")
|
||||
warning_message_logged = ("The expected warning was logged", "The expected message was not logged")
|
||||
exit_game_mode = ("Exited game mode", "Couldn't exit game mode")
|
||||
# fmt: on
|
||||
|
||||
|
||||
def Terrain_AddPhysTerrainComponent():
|
||||
"""
|
||||
Summary:
|
||||
Runs an automated test by creating an entity with physx terrain and add another physx terrain and verify that
|
||||
you are able to add it without any crash or error.
|
||||
|
||||
Level Description:
|
||||
Terrain1 (entity) - contains Physx Terrain, status is inactive in Editor
|
||||
Terrain2 (entity) - contains Physx Terrain, status is inactive in Editor
|
||||
|
||||
Expected Behavior:
|
||||
When game mode is entered, check the console to find this warning :
|
||||
[Warning] (EditorTerrainComponent) - Multiple EditorTerrainComponents found in the editor scene on these entities:
|
||||
Terrain1
|
||||
Terrain2
|
||||
The warning will list down all the entities on which the terrain component is currently present.
|
||||
|
||||
Test Steps:
|
||||
1) Open level
|
||||
2) Enter game mode
|
||||
3) Validate entities
|
||||
4) Activate entities
|
||||
5) Look for warning
|
||||
6) Exit game mode
|
||||
7) Close the editor
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine Editor command terminal
|
||||
- Any passed and failed tests are written to the Editor.log file.
|
||||
Parsing the file or running a log_monitor are required to observe the test results.
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
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
|
||||
|
||||
import azlmbr.bus
|
||||
|
||||
helper.init_idle()
|
||||
|
||||
with Tracer() as warning_tracer:
|
||||
def has_terrain_warning():
|
||||
return warning_tracer.has_warnings and any(
|
||||
'EditorTerrainComponent' in warningInfo.window for warningInfo in warning_tracer.warnings)
|
||||
|
||||
# 1) Open level
|
||||
helper.open_level("Physics", "Terrain_AddPhysTerrainComponent")
|
||||
|
||||
# 2) Enter game mode
|
||||
helper.enter_game_mode(Tests.enter_game_mode)
|
||||
|
||||
# 3) Validate entities
|
||||
terrain_id1 = general.find_game_entity("Terrain1")
|
||||
terrain_id2 = general.find_game_entity("Terrain2")
|
||||
|
||||
Report.result(Tests.find_terrain_1, terrain_id1.IsValid())
|
||||
Report.result(Tests.find_terrain_2, terrain_id2.IsValid())
|
||||
|
||||
# 4) Activate entities
|
||||
azlmbr.entity.GameEntityContextRequestBus(azlmbr.bus.Broadcast, "ActivateGameEntity", terrain_id1)
|
||||
azlmbr.entity.GameEntityContextRequestBus(azlmbr.bus.Broadcast, "ActivateGameEntity", terrain_id2)
|
||||
|
||||
# 5) Look for warning
|
||||
helper.wait_for_condition(has_terrain_warning, 1.0)
|
||||
Report.result(Tests.warning_message_logged, has_terrain_warning())
|
||||
|
||||
# 6) Exit game mode
|
||||
helper.exit_game_mode(Tests.exit_game_mode)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(Terrain_AddPhysTerrainComponent)
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
"""
|
||||
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
|
||||
"""
|
||||
|
||||
|
||||
# Test case ID : C5689524
|
||||
# Test Case Title : Create multiple entities each with one or more terrain components and verify that you are
|
||||
# able to successfully add the PhysX Terrain components to them.
|
||||
|
||||
|
||||
|
||||
# fmt: off
|
||||
class Tests():
|
||||
enter_game_mode = ("Entered game mode", "Failed to enter game mode")
|
||||
all_terrains_found = ("Entities found", "Entities not found")
|
||||
warning_message_logged = ("The expected warning was logged", "The expected message was not logged")
|
||||
exit_game_mode = ("Exited game mode", "Couldn't exit game mode")
|
||||
# fmt: on
|
||||
|
||||
|
||||
def Terrain_CanAddMultipleTerrainComponents():
|
||||
"""
|
||||
Summary:
|
||||
Runs an automated test by creating multiple entities each with one or more terrain components and verify that you are
|
||||
able to successfully add the PhysX Terrain components to them.
|
||||
|
||||
Level Description:
|
||||
Terrain1 (entity) - contains Physx Terrain, Status in inactive in Editor
|
||||
Terrain2 (entity) - contains Physx Terrain, Status in inactive in Editor
|
||||
Terrain3 (entity) - contains Physx Terrain, Status in inactive in Editor
|
||||
Terrain4 (entity) - contains Physx Terrain, Status in inactive in Editor
|
||||
|
||||
Expected Behavior:
|
||||
When game mode is entered, check the console to find this warning :
|
||||
[Warning] (EditorTerrainComponent) - Multiple EditorTerrainComponents found in the editor scene on these entities:
|
||||
Terrain1
|
||||
Terrain2
|
||||
Terrain3
|
||||
Terrain4
|
||||
The warning will list down all the entities on which the terrain component is currently present.
|
||||
|
||||
Test Steps:
|
||||
1) Open level
|
||||
2) Enter game mode
|
||||
3) Activate and Validate entities
|
||||
4) Look for warning
|
||||
5) Exit game mode
|
||||
6) Close the editor
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine Editor command terminal
|
||||
- Any passed and failed tests are written to the Editor.log file.
|
||||
Parsing the file or running a log_monitor are required to observe the test results.
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
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
|
||||
|
||||
import azlmbr.bus
|
||||
|
||||
helper.init_idle()
|
||||
|
||||
with Tracer() as warning_tracer:
|
||||
def has_terrain_warning():
|
||||
return warning_tracer.has_warnings and any(
|
||||
'EditorTerrainComponent' in warningInfo.window for warningInfo in warning_tracer.warnings)
|
||||
|
||||
# 1) Open level
|
||||
helper.open_level("Physics", "Terrain_CanAddMultipleTerrainComponents")
|
||||
|
||||
# 2) Enter game mode
|
||||
helper.enter_game_mode(Tests.enter_game_mode)
|
||||
|
||||
# 3) Activate and Validate entities
|
||||
terrains = ("Terrain1", "Terrain2", "Terrain3", "Terrain4")
|
||||
all_terrains_found = True
|
||||
for terrain in terrains:
|
||||
terrain_id = general.find_game_entity(terrain)
|
||||
azlmbr.entity.GameEntityContextRequestBus(azlmbr.bus.Broadcast, "ActivateGameEntity", terrain_id)
|
||||
if not terrain_id.IsValid():
|
||||
all_terrains_found = False
|
||||
Report.critical_result(Tests.all_terrains_found, all_terrains_found)
|
||||
|
||||
# 4) Look for warning
|
||||
helper.wait_for_condition(has_terrain_warning, 1.0)
|
||||
Report.result(Tests.warning_message_logged, has_terrain_warning())
|
||||
|
||||
# 5) Exit game mode
|
||||
helper.exit_game_mode(Tests.exit_game_mode)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(Terrain_CanAddMultipleTerrainComponents)
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
"""
|
||||
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
|
||||
"""
|
||||
|
||||
|
||||
# Test case ID : C5689518
|
||||
# Test Case Title : PhysX entities collide with PhysX Terrain
|
||||
|
||||
# A ball is suspended slightly over PhysX Terrain to check that it collides when dropped
|
||||
|
||||
|
||||
# fmt: off
|
||||
class Tests():
|
||||
enter_game_mode = ("Entered game mode", "Failed to enter game mode")
|
||||
find_sphere = ("Sphere entity found", "Sphere entity not found")
|
||||
find_terrain = ("Terrain found", "Terrain not found")
|
||||
sphere_above_terrain = ("Sphere position above ground", "Sphere is not above the ground")
|
||||
time_out = ("No time out occurred", "A time out occurred, please validate level setup")
|
||||
touched_ground = ("Touched ground before time out", "Did not touch ground before time out")
|
||||
exit_game_mode = ("Exited game mode", "Couldn't exit game mode")
|
||||
# fmt: on
|
||||
|
||||
|
||||
def Terrain_CollisionAgainstRigidBody():
|
||||
"""
|
||||
Summary:
|
||||
Runs a test to make sure that a PhysX Rigid Body and Collider can successfully collide with a PhysX Terrain entity.
|
||||
|
||||
Level Description:
|
||||
A sphere with rigid body and collider is positioned above a PhysX terrain. The terrain and sphere have the same
|
||||
collision group/layer assigned.
|
||||
|
||||
Expected Outcome:
|
||||
Once game mode is entered, the sphere should fall toward and collide with the terrain.
|
||||
|
||||
Steps:
|
||||
1) Open level and enter game mode
|
||||
2) Retrieve entities and positions
|
||||
3) Wait for sphere to collide with terrain OR time out
|
||||
4) Exit game mode
|
||||
5) Close the editor
|
||||
|
||||
:return:
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import azlmbr.legacy.general as general
|
||||
import azlmbr.bus
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
|
||||
# Global time out
|
||||
TIME_OUT = 1.0
|
||||
|
||||
# 1) Open level / Enter game mode
|
||||
helper.init_idle()
|
||||
helper.open_level("Physics", "Terrain_CollisionAgainstRigidBody")
|
||||
helper.enter_game_mode(Tests.enter_game_mode)
|
||||
|
||||
# 2) Retrieve entities and positions
|
||||
sphere_id = general.find_game_entity("PhysX_Sphere")
|
||||
Report.critical_result(Tests.find_sphere, sphere_id.IsValid())
|
||||
|
||||
terrain_id = general.find_game_entity("PhysX_Terrain")
|
||||
Report.critical_result(Tests.find_terrain, terrain_id.IsValid())
|
||||
|
||||
sphere_pos = azlmbr.components.TransformBus(azlmbr.bus.Event, "GetWorldTM", sphere_id).GetPosition()
|
||||
terrain_pos = azlmbr.components.TransformBus(azlmbr.bus.Event, "GetWorldTM", terrain_id).GetPosition()
|
||||
Report.info_vector3(sphere_pos, "Sphere:")
|
||||
Report.info_vector3(terrain_pos, "Terrain:")
|
||||
Report.critical_result(
|
||||
Tests.sphere_above_terrain,
|
||||
sphere_pos.z > terrain_pos.z,
|
||||
"Please make sure the sphere entity is set above the terrain",
|
||||
)
|
||||
|
||||
# Enable gravity (just in case it is not enabled)
|
||||
if not azlmbr.physics.RigidBodyRequestBus(azlmbr.bus.Event, "IsGravityEnabled", sphere_id):
|
||||
azlmbr.physics.RigidBodyRequestBus(azlmbr.bus.Event, "SetGravityEnabled", sphere_id, True)
|
||||
|
||||
class TouchGround:
|
||||
value = False
|
||||
|
||||
# Collision event handler
|
||||
def on_collision_begin(args):
|
||||
other_id = args[0]
|
||||
if other_id.Equal(terrain_id):
|
||||
Report.info("Touched ground")
|
||||
TouchGround.value = True
|
||||
|
||||
# Assign event handler to sphere
|
||||
handler = azlmbr.physics.CollisionNotificationBusHandler()
|
||||
handler.connect(sphere_id)
|
||||
handler.add_callback("OnCollisionBegin", on_collision_begin)
|
||||
|
||||
# 3) Wait for the sphere to hit the ground OR time out
|
||||
test_completed = helper.wait_for_condition((lambda: TouchGround.value), TIME_OUT)
|
||||
|
||||
Report.critical_result(Tests.time_out, test_completed)
|
||||
Report.result(Tests.touched_ground, TouchGround.value)
|
||||
|
||||
# 4) Exit game mode
|
||||
helper.exit_game_mode(Tests.exit_game_mode)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(Terrain_CollisionAgainstRigidBody)
|
||||
+208
@@ -0,0 +1,208 @@
|
||||
"""
|
||||
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
|
||||
"""
|
||||
|
||||
|
||||
# Test case ID : C6032082
|
||||
# Test Case Title : Verify multiple terrain resolutions are supported
|
||||
|
||||
|
||||
|
||||
# fmt: off
|
||||
class Tests():
|
||||
enter_game_mode_128x128_1m = ("Entered game mode for 128x128, 1m resolution", "Failed to enter game mode for 128x128, 1m resolution")
|
||||
find_entities_128x128_1m = ("Entities found for 128x128, 1m resolution", "Entities not found for 128x128, 1m resolution")
|
||||
ball_on_terrain_collision_128x128_1m = ("Ball on terrain collided for 128x128, 1m resolution", "Ball on terrain did not collide for 128x128, 1m resolution")
|
||||
ball_outside_terrain_collision_128x128_1m = ("Ball outside terrain did not collide for 128x128, 1m resolution", "Ball outside terrain collided for 128x128, 1m resolution")
|
||||
exit_game_mode_128x128_1m = ("Exited game mode for 128x128, 1m resolution", "Couldn't exit game mode for 128x128, 1m resolution")
|
||||
|
||||
enter_game_mode_512x512_2m = ("Entered game mode for 512x512, 2m resolution", "Failed to enter game mode for 512x512, 2m resolution")
|
||||
find_entities_512x512_2m = ("Entities found for 512x512, 2m resolution", "Entities not found for 512x512, 2m resolution")
|
||||
ball_on_terrain_collision_512x512_2m = ("Ball on terrain collided for 512x512, 2m resolution", "Ball on terrain did not collide for 512x512, 2m resolution")
|
||||
ball_outside_terrain_collision_512x512_2m = ("Ball outside terrain did not collide for 512x512, 2m resolution", "Ball outside terrain collided for 512x512, 2m resolution")
|
||||
exit_game_mode_512x512_2m = ("Exited game mode for 512x512, 2m resolution", "Couldn't exit game mode for 512x512, 2m resolution")
|
||||
|
||||
enter_game_mode_1024x1024_32m = ("Entered game mode for 1024x1024, 32m resolution", "Failed to enter game mode for 1024x1024, 32m resolution")
|
||||
find_entities_1024x1024_32m = ("Entities found for 1024x1024, 32m resolution", "Entities not found for 1024x1024, 32m resolution")
|
||||
ball_on_terrain_collision_1024x1024_32m = ("Ball on terrain collided for 1024x1024, 32m resolution", "Ball on terrain did not collide for 1024x1024, 32m resolution")
|
||||
ball_outside_terrain_collision_1024x1024_32m = ("Ball outside terrain did not collide for 1024x1024, 32m resolution", "Ball outside terrain collided for 1024x1024, 32m resolution")
|
||||
exit_game_mode_1024x1024_32m = ("Exited game mode for 1024x1024, 32m resolution", "Couldn't exit game mode for 1024x1024, 32m resolution")
|
||||
|
||||
enter_game_mode_4096x4096_16m = ("Entered game mode for 4096x4096, 16m resolution", "Failed to enter game mode for 4096x4096, 16m resolution")
|
||||
find_entities_4096x4096_16m = ("Entities found for 4096x4096, 16m resolution", "Entities not found for 4096x4096, 16m resolution")
|
||||
ball_on_terrain_collision_4096x4096_16m = ("Ball on terrain collided for 4096x4096, 16m resolution", "Ball on terrain did not collide for 4096x4096, 16m resolution")
|
||||
ball_outside_terrain_collision_4096x4096_16m = ("Ball outside terrain did not collide for 4096x4096, 16m resolution", "Ball outside terrain collided for 4096x4096, 16m resolution")
|
||||
exit_game_mode_4096x4096_16m = ("Exited game mode for 4096x4096, 16m resolution", "Couldn't exit game mode for 4096x4096, 16m resolution")
|
||||
# fmt: on
|
||||
|
||||
|
||||
def Terrain_MultipleResolutionsValid():
|
||||
|
||||
"""
|
||||
Summary:
|
||||
Verify multiple terrain resolutions are supported
|
||||
|
||||
Level Description:
|
||||
Multiple levels with different resolutions are created with terrain components
|
||||
128x128, 1m
|
||||
512x512, 2m
|
||||
1024x1024, 32m
|
||||
4096x4096, 16m
|
||||
Terrain (entity) - Entity with PhysX Terrain component
|
||||
Ball On Terrain (entity) - Entity with rigid body, mesh and collider placed above the terrain
|
||||
Ball Outside Terrain (entity) - Entity with rigid body, mesh and collider placed outside the terrain
|
||||
|
||||
Expected Behavior:
|
||||
Editor doesn't crash, and the terrain is successfully created.
|
||||
The level opens and game mode is entered. The terrain entity is loaded in and then validation occurs on that entity. We are checking
|
||||
the terrain by adding objects on the terrain and outside the terrain and verifying the collision between terrain and the object above it.
|
||||
Game mode is then exited. After all levels are checked the editor is closed.
|
||||
|
||||
Test Steps:
|
||||
1) Repeat the below steps for each level
|
||||
1.1) Open level
|
||||
1.2) Enter game mode
|
||||
1.3) Retrieve and validate Terrain entity
|
||||
1.4) Verify collision between objects and the terrain
|
||||
1.5) Exit game mode
|
||||
2) Close the editor
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine Editor command terminal
|
||||
- Any passed and failed tests are written to the Editor.log file.
|
||||
Parsing the file or running a log_monitor are required to observe the test results.
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
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
|
||||
|
||||
# Constants
|
||||
TIME_OUT = 3.0 # Wait maximum of 3 seconds for collsion to occur
|
||||
|
||||
helper.init_idle()
|
||||
|
||||
class Level:
|
||||
def __init__(
|
||||
self,
|
||||
name,
|
||||
enter_game_test,
|
||||
validate_entities_test,
|
||||
ball_on_terrain_collision,
|
||||
ball_outside_terrain_collision,
|
||||
exit_game_test,
|
||||
):
|
||||
self.name = name
|
||||
self.test_enter_game_mode = enter_game_test
|
||||
self.test_validate_entities = validate_entities_test
|
||||
self.test_ball_on_terrain_collision = ball_on_terrain_collision
|
||||
self.test_ball_outside_terrain_collision = ball_outside_terrain_collision
|
||||
self.test_exit_game_mode = exit_game_test
|
||||
|
||||
level_128 = Level(
|
||||
"Terrain_MultipleResolutionsValid_128x128_1m",
|
||||
Tests.enter_game_mode_128x128_1m,
|
||||
Tests.find_entities_128x128_1m,
|
||||
Tests.ball_on_terrain_collision_128x128_1m,
|
||||
Tests.ball_outside_terrain_collision_128x128_1m,
|
||||
Tests.exit_game_mode_128x128_1m,
|
||||
)
|
||||
level_512 = Level(
|
||||
"Terrain_MultipleResolutionsValid_512x512_2m",
|
||||
Tests.enter_game_mode_512x512_2m,
|
||||
Tests.find_entities_512x512_2m,
|
||||
Tests.ball_on_terrain_collision_512x512_2m,
|
||||
Tests.ball_outside_terrain_collision_512x512_2m,
|
||||
Tests.exit_game_mode_512x512_2m,
|
||||
)
|
||||
level_1024 = Level(
|
||||
"Terrain_MultipleResolutionsValid_1024x1024_32m",
|
||||
Tests.enter_game_mode_1024x1024_32m,
|
||||
Tests.find_entities_1024x1024_32m,
|
||||
Tests.ball_on_terrain_collision_1024x1024_32m,
|
||||
Tests.ball_outside_terrain_collision_1024x1024_32m,
|
||||
Tests.exit_game_mode_1024x1024_32m,
|
||||
)
|
||||
level_4096 = Level(
|
||||
"Terrain_MultipleResolutionsValid_4096x4096_16m",
|
||||
Tests.enter_game_mode_4096x4096_16m,
|
||||
Tests.find_entities_4096x4096_16m,
|
||||
Tests.ball_on_terrain_collision_4096x4096_16m,
|
||||
Tests.ball_outside_terrain_collision_4096x4096_16m,
|
||||
Tests.exit_game_mode_4096x4096_16m,
|
||||
)
|
||||
|
||||
class Collision:
|
||||
ball_on_terrain_collision = False
|
||||
ball_outside_terrain_collision = False
|
||||
|
||||
class CollisionHandler:
|
||||
def __init__(self, terrain_id, ball_inside_id, ball_outside_id):
|
||||
self.terrain_id = terrain_id
|
||||
self.ball_inside_id = ball_inside_id
|
||||
self.ball_outside_id = ball_outside_id
|
||||
self.create_collision_handler()
|
||||
|
||||
def on_collision_begin(self, args):
|
||||
collider_id = args[0]
|
||||
if collider_id.Equal(self.ball_inside_id):
|
||||
Collision.ball_on_terrain_collision = True
|
||||
elif collider_id.Equal(self.ball_outside_id):
|
||||
Collision.ball_outside_terrain_collision = True
|
||||
|
||||
def create_collision_handler(self):
|
||||
self.handler = azlmbr.physics.CollisionNotificationBusHandler()
|
||||
self.handler.connect(self.terrain_id)
|
||||
self.handler.add_callback("OnCollisionBegin", self.on_collision_begin)
|
||||
|
||||
levels = (
|
||||
level_128,
|
||||
level_512,
|
||||
level_1024,
|
||||
level_4096,
|
||||
)
|
||||
|
||||
# 1) Repeat the below steps for each level
|
||||
for level in levels:
|
||||
# 1.1) Open level
|
||||
helper.open_level("Physics", level.name)
|
||||
|
||||
# 1.2) Enter game mode
|
||||
helper.enter_game_mode(level.test_enter_game_mode)
|
||||
|
||||
# 1.3) Retrieve and validate Terrain entity
|
||||
terrain_id = general.find_game_entity("Terrain")
|
||||
ball_on_terrain_id = general.find_game_entity("Ball On Terrain")
|
||||
ball_outside_terrain_id = general.find_game_entity("Ball Outside Terrain")
|
||||
Report.critical_result(
|
||||
level.test_validate_entities,
|
||||
terrain_id.IsValid() and ball_on_terrain_id.IsValid() and ball_outside_terrain_id.IsValid(),
|
||||
)
|
||||
|
||||
# 1.4) Verify collision between objects and the terrain
|
||||
CollisionHandler(terrain_id, ball_on_terrain_id, ball_outside_terrain_id)
|
||||
helper.wait_for_condition(lambda: Collision.ball_on_terrain_collision, TIME_OUT)
|
||||
Report.critical_result(level.test_ball_on_terrain_collision, Collision.ball_on_terrain_collision)
|
||||
Report.critical_result(level.test_ball_outside_terrain_collision, not Collision.ball_outside_terrain_collision)
|
||||
|
||||
# Resetting collision values to false for the next level
|
||||
Collision.ball_on_terrain_collision = False
|
||||
Collision.ball_outside_terrain_collision = False
|
||||
|
||||
# 1.5) Exit game mode
|
||||
helper.exit_game_mode(level.test_exit_game_mode)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(Terrain_MultipleResolutionsValid)
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
"""
|
||||
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
|
||||
"""
|
||||
|
||||
|
||||
# Test case ID : C5689528
|
||||
# Test Case Title : Create multiple entities each with one PhysX terrain component and verify that a warning
|
||||
# is thrown to the user
|
||||
|
||||
|
||||
|
||||
# fmt: off
|
||||
class Tests():
|
||||
enter_game_mode = ("Entered game mode", "Failed to enter game mode")
|
||||
warning_message_logged = ("The expected warning was logged", "The expected message was not logged")
|
||||
find_terrains = ("All Terrains are found", "All Terrains are not found")
|
||||
exit_game_mode = ("Exited game mode", "Couldn't exit game mode")
|
||||
# fmt: on
|
||||
|
||||
|
||||
def Terrain_MultipleTerrainComponentsWarning():
|
||||
|
||||
"""
|
||||
Summary:
|
||||
Create multiple entities each with one PhysX terrain component and verify that a warning is thrown to the user.
|
||||
|
||||
Level Description:
|
||||
Terrain1 (entity) - Entity with PhysX Terrain component.
|
||||
Terrain2 (entity) - Entity with PhysX Terrain component.
|
||||
Terrain3 (entity) - Entity with PhysX Terrain component.
|
||||
|
||||
Expected Behavior:
|
||||
We are verifying if the entities are valid.
|
||||
Additionally we are checking for the messages in log when 3 entities with terrain components are added.
|
||||
The log messages should be as follows:
|
||||
[Warning] (EditorTerrainComponent) - Multiple EditorTerrainComponents found in the editor scene on these entities:
|
||||
Terrain1
|
||||
Terrain2
|
||||
Terrain3
|
||||
|
||||
Test Steps:
|
||||
1) Open level
|
||||
2) Enter game mode
|
||||
3) Look for warning
|
||||
4) Retrieve and validate entities
|
||||
5) Exit game mode
|
||||
6) Close the editor
|
||||
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine Editor command terminal
|
||||
- Any passed and failed tests are written to the Editor.log file.
|
||||
Parsing the file or running a log_monitor are required to observe the test results.
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
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
|
||||
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
helper.init_idle()
|
||||
|
||||
with Tracer() as warning_tracer:
|
||||
def has_terrain_warning():
|
||||
return warning_tracer.has_warnings and any(
|
||||
'EditorTerrainComponent' in warningInfo.window for warningInfo in warning_tracer.warnings)
|
||||
|
||||
# 1) Open level
|
||||
helper.open_level("Physics", "Terrain_MultipleTerrainComponentsWarning")
|
||||
|
||||
# 2) Enter game mode
|
||||
helper.enter_game_mode(Tests.enter_game_mode)
|
||||
|
||||
# 3) Look for warning
|
||||
helper.wait_for_condition(has_terrain_warning, 1.0)
|
||||
Report.result(Tests.warning_message_logged, has_terrain_warning())
|
||||
|
||||
# 4) Retrieve and validate entities
|
||||
all_terrains_found = True
|
||||
for index in range(1, 4):
|
||||
entity_name = "Terrain{}".format(index)
|
||||
terrain_id = general.find_game_entity(entity_name)
|
||||
if not terrain_id.IsValid():
|
||||
all_terrains_found = False
|
||||
Report.critical_result(Tests.find_terrains, all_terrains_found)
|
||||
|
||||
# 5) Exit game mode
|
||||
helper.exit_game_mode(Tests.exit_game_mode)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(Terrain_MultipleTerrainComponentsWarning)
|
||||
+167
@@ -0,0 +1,167 @@
|
||||
"""
|
||||
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
|
||||
"""
|
||||
|
||||
|
||||
# Test case ID : C3510642
|
||||
# Test Case Title : Check that when no physX terrain component is added, collision of a PhysX object
|
||||
# with terrain does not work. Consequently, PhysX material assignment to terrain cannot be tested.
|
||||
|
||||
|
||||
|
||||
# fmt: off
|
||||
class Tests():
|
||||
enter_game_mode = ("Entered game mode", "Failed to enter game mode")
|
||||
find_box = ("Box entity found", "Box entity not found")
|
||||
find_bumper = ("Bumper box found", "Bumper box not found")
|
||||
box_above_terrain = ("The tester box is above terrain", "The test box is not higher than the terrain")
|
||||
bumper_below_terrain = ("The bumper is below terrain", "The bumper is not lower than the terrain")
|
||||
gravity_works = ("Box fell", "Box did not fall")
|
||||
falls_below_terrain_height = ("Box is below terrain", "Box did not fall below terrain before timeout")
|
||||
collision_underground = ("Box collided underground", "Box did not collide underground before timeout")
|
||||
exit_game_mode = ("Exited game mode", "Couldn't exit game mode")
|
||||
# fmt: on
|
||||
|
||||
|
||||
def Terrain_NoPhysTerrainComponentNoCollision():
|
||||
"""
|
||||
Summary:
|
||||
Runs an automated test to ensure that when no PhysX Terrain component is added,
|
||||
PhysX objects will not collide with terrain.
|
||||
|
||||
Level Description:
|
||||
Box (entity) - suspended over the terrain with gravity enabled; contains a box mesh,
|
||||
PhysX Collider (Box shape), and PhysX RigidBody
|
||||
Bumper (entity) - suspended under the terrain with gravity disabled; contains box mesh,
|
||||
PhysX Collider (Box shape), and PhysX RigidBody
|
||||
|
||||
Expected Behavior:
|
||||
When game mode is entered, the Box entity will experience gravity and fall toward the terrain.
|
||||
Since there is no PhysX Terrain component in the level, it should fall through the terrain.
|
||||
Once it passes through the terrain, it will collide with the Bumper entity in order to prove that
|
||||
it has passed the terrain.
|
||||
|
||||
Test Steps:
|
||||
1) Open level
|
||||
2) Enter game mode
|
||||
3) Find the entities
|
||||
4) Get the starting z position of the boxes
|
||||
5) Check and report that the entities are at the correct heights
|
||||
6) Check that the gravity works and the box falls
|
||||
7) Check that the box hits the trigger and is below the terrain
|
||||
8) Exit game mode
|
||||
9) Close the editor
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine Editor command terminal
|
||||
- Any passed and failed tests are written to the Editor.log file.
|
||||
Parsing the file or running a log_monitor are required to observe the test results.
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import azlmbr.legacy.general as general
|
||||
import azlmbr.bus
|
||||
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
|
||||
# Constants
|
||||
TIMEOUT = 2.0
|
||||
TERRAIN_HEIGHT = 32.0 # Default height of the terrain
|
||||
MIN_BELOW_TERRAIN = 0.5 # Minimum height below terrain the box must be in order to be 'under' it
|
||||
|
||||
helper.init_idle()
|
||||
# 1) Open level
|
||||
helper.open_level("Physics", "Terrain_NoPhysTerrainComponentNoCollision")
|
||||
|
||||
# 2) Enter game mode
|
||||
helper.enter_game_mode(Tests.enter_game_mode)
|
||||
|
||||
# 3) Find the entities
|
||||
box_id = general.find_game_entity("Box")
|
||||
Report.critical_result(Tests.find_box, box_id.IsValid())
|
||||
|
||||
bumper_id = general.find_game_entity("Bumper")
|
||||
Report.critical_result(Tests.find_bumper, bumper_id.IsValid())
|
||||
|
||||
# 4) Get the starting z position of the boxes
|
||||
class Box:
|
||||
"""
|
||||
Class to hold boolean values for test checks.
|
||||
Attributes:
|
||||
start_position_z: The initial z position of the box
|
||||
position_z : The z position of the box
|
||||
fell : When the box falls any distance below its original position, the value should be set True
|
||||
below_terrain : When the box falls below the specified terrain height, the value should be set True
|
||||
"""
|
||||
|
||||
start_position_z = None
|
||||
position_z = None
|
||||
fell = False
|
||||
below_terrain = False
|
||||
|
||||
Box.start_position_z = azlmbr.components.TransformBus(azlmbr.bus.Event, "GetWorldZ", box_id)
|
||||
bumper_start_z = azlmbr.components.TransformBus(azlmbr.bus.Event, "GetWorldZ", bumper_id)
|
||||
|
||||
# 5) Check that the test box is above the terrain and the bumper box is below terrain
|
||||
Report.info("Terrain Height: {}".format(TERRAIN_HEIGHT))
|
||||
Report.info("Box start height: {}".format(Box.start_position_z))
|
||||
Report.result(Tests.box_above_terrain, Box.start_position_z > TERRAIN_HEIGHT)
|
||||
Report.info("Bumper start height: {}".format(bumper_start_z))
|
||||
Report.result(Tests.bumper_below_terrain, bumper_start_z < TERRAIN_HEIGHT)
|
||||
|
||||
# 6) Check that the gravity works and the box falls
|
||||
def box_fell():
|
||||
if not Box.fell:
|
||||
Box.position_z = azlmbr.components.TransformBus(azlmbr.bus.Event, "GetWorldZ", box_id)
|
||||
if Box.position_z < Box.start_position_z:
|
||||
Report.info("Box position is now lower than the starting position")
|
||||
Box.fell = True
|
||||
return Box.fell
|
||||
|
||||
helper.wait_for_condition(box_fell, TIMEOUT)
|
||||
Report.result(Tests.gravity_works, Box.fell)
|
||||
|
||||
# 7) Check that the box hits the trigger and is below the terrain
|
||||
# Setup for collision check
|
||||
class BumperTriggerEntered:
|
||||
value = False
|
||||
|
||||
def on_collision_begin(args):
|
||||
other_id = args[0]
|
||||
if other_id.Equal(bumper_id):
|
||||
BumperTriggerEntered.value = True
|
||||
|
||||
handler = azlmbr.physics.CollisionNotificationBusHandler()
|
||||
handler.connect(box_id)
|
||||
handler.add_callback("OnCollisionBegin", on_collision_begin)
|
||||
|
||||
def box_below_terrain():
|
||||
if not Box.below_terrain:
|
||||
Box.position_z = azlmbr.components.TransformBus(azlmbr.bus.Event, "GetWorldZ", box_id)
|
||||
if Box.position_z < (TERRAIN_HEIGHT - MIN_BELOW_TERRAIN):
|
||||
Report.info("Box position is now below the terrain")
|
||||
Box.below_terrain = True
|
||||
return Box.below_terrain
|
||||
|
||||
def box_below_and_trigger_entered():
|
||||
return box_below_terrain() and BumperTriggerEntered.value
|
||||
|
||||
helper.wait_for_condition(box_below_and_trigger_entered, TIMEOUT)
|
||||
Report.result(Tests.collision_underground, BumperTriggerEntered.value)
|
||||
Report.result(Tests.falls_below_terrain_height, Box.below_terrain)
|
||||
|
||||
# 8) Exit game mode
|
||||
helper.exit_game_mode(Tests.exit_game_mode)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(Terrain_NoPhysTerrainComponentNoCollision)
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
"""
|
||||
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
|
||||
"""
|
||||
|
||||
|
||||
# Test case ID : C5689531
|
||||
# Test Case Title : Check that when you add a spawner component to a level to spawn a
|
||||
# terrain and also add a terrain component explicitly, no crash happens
|
||||
|
||||
|
||||
|
||||
# fmt: off
|
||||
class Tests:
|
||||
enter_game_mode = ("Entered game mode", "Failed to enter game mode")
|
||||
find_terrain = ("Terrain found", "Terrain not found")
|
||||
find_spawner = ("Spawner found", "Spawner not found")
|
||||
find_terrain_slice = ("Terrain slice found", "Terrain slice not found")
|
||||
warning_message_logged = ("The expected warning was logged", "The expected message was not logged")
|
||||
exit_game_mode = ("Exited game mode", "Couldn't exit game mode")
|
||||
# fmt: on
|
||||
|
||||
|
||||
def Terrain_SpawnSecondTerrainComponentWarning():
|
||||
|
||||
"""
|
||||
Summary:
|
||||
Check that when you add a spawner component to a level to spawn a terrain and also
|
||||
add a terrain component explicitly, no crash happens
|
||||
|
||||
Level Description:
|
||||
SpawnerEntity (entity) - Entity with Spawner component. Attached to it is a dynamic slice file which is used
|
||||
to create an entity "TerrainSlice" with a PhysX Terrain component.
|
||||
Spawn On Activate option is checked.
|
||||
TerrainEntity (entity) - Entity with PhysX Terrain component.
|
||||
|
||||
Expected Behavior:
|
||||
We are verifying if the entities are valid.
|
||||
We are checking for the messages in log as multiple terrains are added to the level.
|
||||
The log messages should be as follows:
|
||||
[Warning] (TerrainComponent) - Multiple TerrainComponents found in the scene on these entities:
|
||||
TerrainEntity
|
||||
TerrainSlice
|
||||
|
||||
Test Steps:
|
||||
1) Open level
|
||||
2) Enter game mode
|
||||
3) Retrieve and validate entities
|
||||
4) Wait for WAIT_TIME to check if any crash happened
|
||||
5) Check if the TerrainSlice spawner has spawned
|
||||
6) Look for warning
|
||||
7) Exit game mode
|
||||
8) Close the editor
|
||||
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine Editor command terminal
|
||||
- Any passed and failed tests are written to the Editor.log file.
|
||||
Parsing the file or running a log_monitor are required to observe the test results.
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
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
|
||||
|
||||
import azlmbr.legacy.general as general
|
||||
|
||||
# Constants
|
||||
WAIT_TIME = 1.0
|
||||
|
||||
helper.init_idle()
|
||||
|
||||
with Tracer() as warning_tracer:
|
||||
def has_terrain_warning():
|
||||
return warning_tracer.has_warnings and any(
|
||||
'TerrainComponent' in warningInfo.window for warningInfo in warning_tracer.warnings)
|
||||
|
||||
# 1) Open level
|
||||
helper.open_level("Physics", "Terrain_SpawnSecondTerrainComponentWarning")
|
||||
|
||||
# 2) Enter game mode
|
||||
helper.enter_game_mode(Tests.enter_game_mode)
|
||||
|
||||
# 3) Retrieve and validate entities
|
||||
terrain_id = general.find_game_entity("TerrainEntity")
|
||||
Report.critical_result(Tests.find_terrain, terrain_id.IsValid())
|
||||
spawner_id = general.find_game_entity("SpawnerEntity")
|
||||
Report.critical_result(Tests.find_spawner, spawner_id.IsValid())
|
||||
|
||||
# 4) Wait for WAIT_TIME to check if any crash happened
|
||||
general.idle_wait(WAIT_TIME)
|
||||
|
||||
# 5) Check if the TerrainSlice spawner has spawned
|
||||
terrain_slice_id = general.find_game_entity("TerrainSlice")
|
||||
Report.critical_result(Tests.find_terrain_slice, terrain_slice_id.IsValid())
|
||||
|
||||
# 6) Look for warning
|
||||
helper.wait_for_condition(has_terrain_warning, WAIT_TIME)
|
||||
Report.result(Tests.warning_message_logged, has_terrain_warning())
|
||||
|
||||
# 7) Exit game mode
|
||||
helper.exit_game_mode(Tests.exit_game_mode)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(Terrain_SpawnSecondTerrainComponentWarning)
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
"""
|
||||
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
|
||||
"""
|
||||
|
||||
|
||||
# Test case ID : C13508019
|
||||
# Test Case Title : Verify terrain materials are updated after using terrain texture layer painter.
|
||||
|
||||
|
||||
# fmt: off
|
||||
class Tests:
|
||||
enter_game_mode = ("Entered game mode", "Failed to enter game mode")
|
||||
find_box_bounce = ("Entity Bounce Box found", "Bounce Box not found")
|
||||
find_box_no_bounce = ("Entity No Bounce Box found", "No Bounce Box not found")
|
||||
find_terrain = ("Terrain found", "Terrain not found")
|
||||
entities_actions_finished = ("Entity actions completed", "Entity actions not completed")
|
||||
nonbouncy_box_not_bounced = ("Non-Bouncy Box didn't bounce", "Non-Bouncy Box did bounce")
|
||||
bouncy_box_not_bounced = ("Bouncy Box did bounce", "Bouncy Box didn't bounce")
|
||||
exit_game_mode = ("Exited game mode", "Couldn't exit game mode")
|
||||
# fmt: on
|
||||
|
||||
|
||||
def Terrain_TerrainTexturePainterWorks():
|
||||
# run() will open a a level and validate terrain material are updated after using terrain texture painter
|
||||
# It does this by:
|
||||
# 1) Opens level with a terrain that has been painted by two different physical materials with a box above each
|
||||
# 2) Enters Game mode
|
||||
# 3) Finds the entities in the scene
|
||||
# 5) Listens for boxes colliding with terrain
|
||||
# 7) Listens for boxes to exit(bounce) the collision or not (not bounce)
|
||||
# 8) Validate the results (The box above the blue terrain does not bounce and the box above the red terrain does)
|
||||
# 9) Exits game mode and editor
|
||||
|
||||
# Expected Result: Both the boxes will be affected by the physical material on the terrain. One box will
|
||||
# bounce and the other wont.
|
||||
|
||||
# Setup path
|
||||
import os, 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
|
||||
|
||||
TIME_OUT = 5.0 # Max time to complete test
|
||||
|
||||
class Box: # Holds box object attributes
|
||||
def __init__(self, boxID):
|
||||
self.box_id = boxID
|
||||
self.collided_with_terrain = False
|
||||
self.bounced = False
|
||||
|
||||
helper.init_idle()
|
||||
|
||||
# 1) Open level
|
||||
helper.open_level("Physics", "Terrain_TerrainTexturePainterWorks")
|
||||
|
||||
# 2) Enter game mode
|
||||
helper.enter_game_mode(Tests.enter_game_mode)
|
||||
|
||||
# Creat box objects and set id's
|
||||
# Box that is above terrain that will bounce
|
||||
bounce_box = Box(general.find_game_entity("Box_Yes_Bounce"))
|
||||
Report.result(Tests.find_box_bounce, bounce_box.box_id.IsValid())
|
||||
|
||||
# Box that is above terrain that will not bounce
|
||||
no_bounce_box = Box(general.find_game_entity("Box_No_Bounce"))
|
||||
Report.result(Tests.find_box_no_bounce, no_bounce_box.box_id.IsValid())
|
||||
|
||||
terrain_id = general.find_game_entity("Terrain")
|
||||
Report.result(Tests.find_terrain, terrain_id.IsValid())
|
||||
|
||||
# Listen for a collision to begin
|
||||
def on_collision_begin(args):
|
||||
other_id = args[0]
|
||||
if other_id.Equal(no_bounce_box.box_id) and no_bounce_box.collided_with_terrain is False:
|
||||
Report.info("Non-Bouncy box collided with terrain ")
|
||||
no_bounce_box.collided_with_terrain = True
|
||||
if other_id.Equal(bounce_box.box_id) and bounce_box.collided_with_terrain is False:
|
||||
Report.info("Bouncy box collided with terrain ")
|
||||
bounce_box.collided_with_terrain = True
|
||||
|
||||
# Listen for a collision to end
|
||||
def on_collision_end(args):
|
||||
other_id = args[0]
|
||||
if other_id.Equal(no_bounce_box.box_id):
|
||||
no_bounce_box.bounced = True
|
||||
if other_id.Equal(bounce_box.box_id):
|
||||
bounce_box.bounced = True
|
||||
|
||||
handler = azlmbr.physics.CollisionNotificationBusHandler()
|
||||
handler.connect(terrain_id)
|
||||
handler.add_callback("OnCollisionBegin", on_collision_begin)
|
||||
handler.add_callback("OnCollisionEnd", on_collision_end)
|
||||
|
||||
# The test_entities_actions_completed function below returns a boolean of if the following actions happened:
|
||||
# Did the bounce box hit the terrain
|
||||
# Did the no bounce box hit the terrain
|
||||
# Did the bounce box bounce
|
||||
# Did the no bounce box not bounce
|
||||
def test_entities_actions_completed():
|
||||
return (
|
||||
bounce_box.collided_with_terrain
|
||||
and no_bounce_box.collided_with_terrain
|
||||
and bounce_box.bounced
|
||||
and not no_bounce_box.bounced # not here because the no bounce box should not have bounced
|
||||
)
|
||||
|
||||
entities_actions_finished = helper.wait_for_condition(test_entities_actions_completed, TIME_OUT)
|
||||
|
||||
# Report is the entities in level finished their actions
|
||||
Report.result(Tests.entities_actions_finished, entities_actions_finished)
|
||||
|
||||
# Report Info
|
||||
Report.info("Bouncy Box hit terrain: Expected = True Actual = {}".format(bounce_box.collided_with_terrain))
|
||||
Report.info(
|
||||
"Non-Bouncy Box hit terrain: Expected = True Actual = {}".format(no_bounce_box.collided_with_terrain)
|
||||
)
|
||||
Report.info("Did Bouncy Box bounce: Expected = True Actual = {}".format(bounce_box.bounced))
|
||||
Report.info("Did Non-Bounce Box bounce: Expected = False Actual = {}".format(no_bounce_box.bounced))
|
||||
|
||||
# Check if the above test completed.
|
||||
if entities_actions_finished:
|
||||
Report.result(Tests.bouncy_box_not_bounced, bounce_box.bounced)
|
||||
Report.result(Tests.nonbouncy_box_not_bounced, not no_bounce_box.bounced)
|
||||
|
||||
# 4) Exit game mode
|
||||
helper.exit_game_mode(Tests.exit_game_mode)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(Terrain_TerrainTexturePainterWorks)
|
||||
Reference in New Issue
Block a user