From 9d05168cfceb8aae13a55f68133053afa9234203 Mon Sep 17 00:00:00 2001 From: greerdv Date: Thu, 11 Nov 2021 15:10:46 +0000 Subject: [PATCH] address feedback from PR Signed-off-by: greerdv --- .../Gem/PythonTests/Physics/TestSuite_Main.py | 6 +++--- .../Tick_CharacterGameplayComponentMotionIsSmooth.py | 10 ++++++---- .../tick/Tick_InterpolatedRigidBodyMotionIsSmooth.py | 10 ++++++---- pytest.ini | 2 +- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/Physics/TestSuite_Main.py b/AutomatedTesting/Gem/PythonTests/Physics/TestSuite_Main.py index 3ef593612b..fb2744deda 100644 --- a/AutomatedTesting/Gem/PythonTests/Physics/TestSuite_Main.py +++ b/AutomatedTesting/Gem/PythonTests/Physics/TestSuite_Main.py @@ -93,14 +93,14 @@ class TestAutomation(TestAutomationBase): from .tests import Physics_UndoRedoWorksOnEntityWithPhysComponents as test_module self._run_test(request, workspace, editor, test_module) - @pytest.mark.tick + @pytest.mark.GROUP_tick @pytest.mark.xfail(reason="Test still under development.") def test_Tick_InterpolatedRigidBodyMotionIsSmooth(self, request, workspace, editor, launcher_platform): from .tests.tick import Tick_InterpolatedRigidBodyMotionIsSmooth as test_module self._run_test(request, workspace, editor, test_module) - @pytest.mark.tick + @pytest.mark.GROUP_tick @pytest.mark.xfail(reason="Test still under development.") - def test_Tick_Tick_CharacterGameplayComponentMotionIsSmooth(self, request, workspace, editor, launcher_platform): + def test_Tick_CharacterGameplayComponentMotionIsSmooth(self, request, workspace, editor, launcher_platform): from .tests.tick import Tick_CharacterGameplayComponentMotionIsSmooth as test_module self._run_test(request, workspace, editor, test_module) diff --git a/AutomatedTesting/Gem/PythonTests/Physics/tests/tick/Tick_CharacterGameplayComponentMotionIsSmooth.py b/AutomatedTesting/Gem/PythonTests/Physics/tests/tick/Tick_CharacterGameplayComponentMotionIsSmooth.py index 6425ece640..fe718d7247 100644 --- a/AutomatedTesting/Gem/PythonTests/Physics/tests/tick/Tick_CharacterGameplayComponentMotionIsSmooth.py +++ b/AutomatedTesting/Gem/PythonTests/Physics/tests/tick/Tick_CharacterGameplayComponentMotionIsSmooth.py @@ -13,6 +13,8 @@ class Tests(): create_entity = ("Created test entity", "Failed to create test entity") character_controller_added = ("Added PhysX Character Controller component", "Failed to add PhysX Character Controller component") character_gameplay_added = ("Added PhysX Character Gameplay component", "Failed to add PhysX Character Gameplay component") + enter_game_mode = ("Entered game mode", "Failed to enter game mode") + exit_game_mode = ("Exited game mode", "Failed to exit game mode") character_motion_smooth = ("Character motion passed smoothness threshold", "Failed to meet smoothness threshold for character motion") # fmt: on @@ -50,7 +52,7 @@ def Tick_CharacterGameplayComponentMotionIsSmooth(): helper.init_idle() # 1) Load the empty level - helper.open_level("Physics", "Base") + helper.open_level("", "Base") # 2) Create an entity test_entity = Entity.create_editor_entity("test_entity") @@ -68,14 +70,14 @@ def Tick_CharacterGameplayComponentMotionIsSmooth(): # 4) Enter game mode and collect data for the rigid body's z co-ordinate and the time values for a series of frames t = [] z = [] - general.enter_game_mode() + helper.enter_game_mode(Tests.enter_game_mode) general.idle_wait_frames(1) game_entity_id = general.find_game_entity("test_entity") - for timestep in range(100): + for frame in range(100): t.append(azlmbr.components.TickRequestBus(azlmbr.bus.Broadcast, "GetTimeAtCurrentTick").GetSeconds()) z.append(azlmbr.components.TransformBus(azlmbr.bus.Event, "GetWorldZ", game_entity_id)) general.idle_wait_frames(1) - general.exit_game_mode() + helper.exit_game_mode(Tests.exit_game_mode) # 5) Test that the z vs t curve is sufficiently smooth (if the interpolation is not working well, the curve will be less smooth) # normalize the t and z data diff --git a/AutomatedTesting/Gem/PythonTests/Physics/tests/tick/Tick_InterpolatedRigidBodyMotionIsSmooth.py b/AutomatedTesting/Gem/PythonTests/Physics/tests/tick/Tick_InterpolatedRigidBodyMotionIsSmooth.py index 1b9310910d..19e79355d9 100644 --- a/AutomatedTesting/Gem/PythonTests/Physics/tests/tick/Tick_InterpolatedRigidBodyMotionIsSmooth.py +++ b/AutomatedTesting/Gem/PythonTests/Physics/tests/tick/Tick_InterpolatedRigidBodyMotionIsSmooth.py @@ -12,6 +12,8 @@ Test Case Title : Verify that a rigid body with "Interpolate motion" option sele class Tests(): create_entity = ("Created test entity", "Failed to create test entity") rigid_body_added = ("Added PhysX Rigid Body component", "Failed to add PhysX Rigid Body component") + enter_game_mode = ("Entered game mode", "Failed to enter game mode") + exit_game_mode = ("Exited game mode", "Failed to exit game mode") rigid_body_smooth = ("Rigid body motion passed smoothness threshold", "Failed to meet smoothness threshold for rigid body motion") # fmt: on @@ -49,7 +51,7 @@ def Tick_InterpolatedRigidBodyMotionIsSmooth(): helper.init_idle() # 1) Load the empty level - helper.open_level("Physics", "Base") + helper.open_level("", "Base") # 2) Create an entity test_entity = Entity.create_editor_entity("test_entity") @@ -67,14 +69,14 @@ def Tick_InterpolatedRigidBodyMotionIsSmooth(): # 4) Enter game mode and collect data for the rigid body's z co-ordinate and the time values for a series of frames t = [] z = [] - general.enter_game_mode() + helper.enter_game_mode(Tests.enter_game_mode) general.idle_wait_frames(1) game_entity_id = general.find_game_entity("test_entity") - for timestep in range(100): + for frame in range(100): t.append(azlmbr.components.TickRequestBus(azlmbr.bus.Broadcast, "GetTimeAtCurrentTick").GetSeconds()) z.append(azlmbr.components.TransformBus(azlmbr.bus.Event, "GetWorldZ", game_entity_id)) general.idle_wait_frames(1) - general.exit_game_mode() + helper.exit_game_mode(Tests.exit_game_mode) # 5) Test that the z vs t curve is sufficiently smooth (if the interpolation is not working well, the curve will be less smooth) # normalize the t and z data diff --git a/pytest.ini b/pytest.ini index a863f8ca96..a229b19a4d 100644 --- a/pytest.ini +++ b/pytest.ini @@ -22,5 +22,5 @@ markers = SUITE_smoke: Tiny, quick tests of fundamental operation (tests with no SUITE_awsi: Time consuming AWS integration end-to-end tests # secondary markers which may appear alongisde a suite marker: REQUIRES_gpu: Tests which require a physical GPU - tick: Tests which verify if systems update correctly with system ticks (for example, physics bodies should move smoothly) + GROUP_tick: Tests which verify if systems update correctly with system ticks (for example, physics bodies should move smoothly) # custom markers not listed above will cause pytest to emit a typo warning