MaterialEditor_Atom_LaunchMaterialEditor.py 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. material_editor_launched = (
  8. "Inspector pane is visible, MaterialEditor launch succeeded",
  9. "P0: Inspector pane not visible, MaterialEditor launch failed"
  10. )
  11. def MaterialEditor_Launched_SuccessfullyLaunched():
  12. """
  13. Summary:
  14. Tests that the MaterialEditor can be launched successfully.
  15. Expected Behavior:
  16. The MaterialEditor executable can be launched and doesn't cause any crashes or errors.
  17. Test Steps:
  18. 1) Verify Material Inspector pane visibility to confirm the MaterialEditor launched.
  19. 2) Look for errors and asserts.
  20. :return: None
  21. """
  22. import Atom.atom_utils.atom_tools_utils as atom_tools_utils
  23. from editor_python_test_tools.utils import Report, Tracer, TestHelper
  24. with Tracer() as error_tracer:
  25. # 1. Verify Material Inspector pane visibility to confirm the MaterialEditor launched.
  26. atom_tools_utils.set_pane_visibility("Inspector", True)
  27. Report.result(
  28. Tests.material_editor_launched,
  29. atom_tools_utils.is_pane_visible("Inspector") is True)
  30. # 2. Look for errors and asserts.
  31. TestHelper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0)
  32. for error_info in error_tracer.errors:
  33. Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}")
  34. for assert_info in error_tracer.asserts:
  35. Report.info(f"Assert: {assert_info.filename} {assert_info.function} | {assert_info.message}")
  36. if __name__ == "__main__":
  37. from editor_python_test_tools.utils import Report
  38. Report.start_test(MaterialEditor_Launched_SuccessfullyLaunched)