Adding setup step to remove temporary level that fails to cleanup (#6056)

* Adding setup step to remove temporary level that fails to cleanup with test teardown

Signed-off-by: jckand-amzn <82226555+jckand-amzn@users.noreply.github.com>

* Adding new create_level to TestHelper class with additional error logging

Signed-off-by: jckand-amzn <82226555+jckand-amzn@users.noreply.github.com>

* Cleaning up custom setup/teardown

Signed-off-by: jckand-amzn <82226555+jckand-amzn@users.noreply.github.com>
This commit is contained in:
jckand-amzn
2021-12-01 13:17:08 -06:00
committed by GitHub
parent e8750f8096
commit 68bf7c85ed
5 changed files with 67 additions and 24 deletions
@@ -34,6 +34,38 @@ class TestHelper:
# JIRA: SPEC-2880
# general.idle_wait_frames(1)
@staticmethod
def create_level(level_name: str) -> bool:
"""
:param level_name: The name of the level to be created
:return: True if ECreateLevelResult returns 0, False otherwise with logging to report reason
"""
Report.info(f"Creating level {level_name}")
# Use these hardcoded values to pass expected values for old terrain system until new create_level API is
# available
heightmap_resolution = 1024
heightmap_meters_per_pixel = 1
terrain_texture_resolution = 4096
use_terrain = False
result = general.create_level_no_prompt(level_name, heightmap_resolution, heightmap_meters_per_pixel,
terrain_texture_resolution, use_terrain)
# Result codes are ECreateLevelResult defined in CryEdit.h
if result == 1:
Report.info(f"{level_name} level already exists")
elif result == 2:
Report.info("Failed to create directory")
elif result == 3:
Report.info("Directory length is too long")
elif result != 0:
Report.info("Unknown error, failed to create level")
else:
Report.info(f"{level_name} level created successfully")
return result == 0
@staticmethod
def open_level(directory : str, level : str):
# type: (str, str) -> None