levelLoad_Atom_Sponza.py 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. """
  2. Copyright (c) Contributors to the Open 3D Engine Project.
  3. For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. SPDX-License-Identifier: Apache-2.0 OR MIT
  5. """
  6. class Tests:
  7. sponza_level_load = (
  8. "Sponza level loaded",
  9. "P0: Sponza level failed to load")
  10. sponza_enter_game_mode = (
  11. "Sponza entered gameplay successfully",
  12. "P0: Sponza failed to enter gameplay")
  13. sponza_exit_game_mode = (
  14. "Sponza exited gameplay successfully",
  15. "P0: Sponza failed to exit gameplay")
  16. empty_level_load = (
  17. "Empty level loaded successfully, Editor remains stable",
  18. "P0: Empty level fails to load, editor is either hung or crashed")
  19. def Atom_Editor_LevelLoad_Sponza():
  20. """
  21. Summary:
  22. Loads the "Sponza" level within an instance of Editor.exe using the null renderer. Test verifies that
  23. the level loads, can enter/exit gameplay, and that Editor.exe remains stable throughout this process.
  24. Test setup:
  25. - Launch Editor.exe
  26. Expected Behavior:
  27. Test verifies that level loads, enters/exits game mode, and editor remains stable.
  28. Test Steps:
  29. 1) Load level, confirm that correct level is loaded, and report results
  30. 2) Validate that editor can enter gameplay successfully
  31. 3) Validate that editor can exit gameplay successfully
  32. 4) Open an empty level to verify editor remains stable
  33. 5) Look for errors or asserts.
  34. :return: None
  35. """
  36. import azlmbr.legacy.general as general
  37. from editor_python_test_tools.utils import Report, Tracer, TestHelper
  38. with Tracer() as error_tracer:
  39. # 1. Load level Sponza, confirm that correct level is loaded, and report results
  40. TestHelper.init_idle()
  41. TestHelper.open_level("Graphics", "Sponza")
  42. Report.result(Tests.sponza_level_load, "Sponza" == general.get_current_level_name())
  43. # 2. Validate that editor can enter gameplay successfully.
  44. TestHelper.enter_game_mode(Tests.sponza_enter_game_mode)
  45. general.idle_wait_frames(1)
  46. # 3. Validate that editor can exit gameplay successfully.
  47. TestHelper.exit_game_mode(Tests.sponza_exit_game_mode)
  48. general.idle_wait_frames(1)
  49. # 4. Open an empty level to verify editor remains stable.
  50. TestHelper.open_level("Graphics", "base_empty")
  51. Report.result(Tests.empty_level_load, "base_empty" == general.get_current_level_name())
  52. # 5. Look for errors or asserts.
  53. TestHelper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0)
  54. for error_info in error_tracer.errors:
  55. Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}")
  56. for assert_info in error_tracer.asserts:
  57. Report.info(f"Assert: {assert_info.filename} {assert_info.function} | {assert_info.message}")
  58. if __name__ == "__main__":
  59. from editor_python_test_tools.utils import Report
  60. Report.start_test(Atom_Editor_LevelLoad_Sponza)