ScriptEvent_AddRemoveParameter_ActionsSuccessful.py 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. import os
  7. from PySide2 import QtWidgets
  8. from editor_python_test_tools.utils import Report
  9. import pyside_utils
  10. import scripting_utils.scripting_tools as tools
  11. import azlmbr.legacy.general as general
  12. from scripting_utils.scripting_constants import (ASSET_EDITOR_UI, SCRIPT_EVENT_FILE_PATH)
  13. # fmt: off
  14. class Tests():
  15. file_saved = ("Successfully saved event asset", "Failed to save event asset")
  16. asset_editor_opened = ("asset editor successfully opened", "Asset editor failed to open")
  17. # fmt: on
  18. class ScriptEvent_AddRemoveParameter_ActionsSuccessful:
  19. """
  20. Summary:
  21. Parameter can be removed from a Script Event method
  22. Expected Behavior:
  23. Upon saving the updated .scriptevents asset the removed paramenter should no longer be present on the Script Event
  24. Test Steps:
  25. 1) Open Asset Editor
  26. 2) Initialize the editor and asset editor qt objects
  27. 3) Create new Script Event Asset
  28. 4) Add Parameter to Event
  29. 5) Remove Parameter from Event
  30. Note:
  31. - This test file must be called from the Open 3D Engine Editor command terminal
  32. - Any passed and failed tests are written to the Editor.log file.
  33. Parsing the file or running a log_monitor are required to observe the test results.
  34. :return: None
  35. """
  36. def __init__(self):
  37. self.editor_main_window = None
  38. self.asset_editor = None
  39. self.asset_editor_widget = None
  40. self.asset_editor_row_container = None
  41. self.asset_editor_menu_bar = None
  42. @pyside_utils.wrap_async
  43. async def run_test(self):
  44. # Preconditions
  45. general.idle_enable(True)
  46. general.close_pane(ASSET_EDITOR_UI)
  47. # 1) Open the asset editor
  48. result = tools.open_asset_editor()
  49. Report.result(Tests.asset_editor_opened, result)
  50. # 2) Initialize the editor and asset editor qt objects
  51. tools.initialize_editor_object(self)
  52. tools.initialize_asset_editor_object(self)
  53. # 3) Create new Script Event Asset
  54. tools.create_script_event(self)
  55. result = tools.save_script_event_file(self, SCRIPT_EVENT_FILE_PATH)
  56. Report.result(Tests.file_saved, result)
  57. # 4) Add Parameter to Event
  58. tools.create_script_event_parameter(self)
  59. result = tools.save_script_event_file(self, SCRIPT_EVENT_FILE_PATH)
  60. Report.result(Tests.file_saved, result)
  61. # 5) Remove Parameter from Event
  62. tools.remove_script_event_parameter(self)
  63. result = tools.save_script_event_file(self, SCRIPT_EVENT_FILE_PATH)
  64. Report.result(Tests.file_saved, result)
  65. test = ScriptEvent_AddRemoveParameter_ActionsSuccessful()
  66. test.run_test()