ScriptEvent_AddRemoveParameter_ActionsSuccessful.py 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. def ScriptEvent_AddRemoveParameter_ActionsSuccessful():
  7. """
  8. Summary:
  9. Parameter can be removed from a Script Event method
  10. Expected Behavior:
  11. clicking the "+" parameter button adds a parameter to a script event.
  12. Clicking the trash can button removes the parameter
  13. Test Steps:
  14. 1) Open Asset Editor
  15. 2) Initialize the editor and asset editor qt objects
  16. 3) Create new Script Event Asset
  17. 4) Add Parameter to Event
  18. 5) Remove Parameter from Event
  19. Note:
  20. - Any passed and failed tests are written to the Editor.log file.
  21. Parsing the file or running a log_monitor are required to observe the test results.
  22. :return: None
  23. """
  24. # Preconditions
  25. import os
  26. from PySide2 import QtWidgets
  27. from editor_python_test_tools.utils import Report
  28. import pyside_utils
  29. import scripting_utils.scripting_tools as tools
  30. import azlmbr.legacy.general as general
  31. from editor_python_test_tools.QtPy.QtPyO3DEEditor import QtPyO3DEEditor
  32. from scripting_utils.scripting_constants import (ASSET_EDITOR_UI, SCRIPT_EVENT_UI)
  33. general.idle_enable(True)
  34. general.close_pane(ASSET_EDITOR_UI)
  35. # 1) Get a handle on our O3DE QtPy objects then initialize the Asset Editor object
  36. qtpy_o3de_editor = QtPyO3DEEditor()
  37. # Close and reopen Asset Editor to ensure we don't have any existing assets open
  38. qtpy_o3de_editor.close_asset_editor()
  39. qtpy_asset_editor = qtpy_o3de_editor.open_asset_editor()
  40. # 2) Create new Script Event Asset
  41. qtpy_asset_editor.click_menu_bar_option(SCRIPT_EVENT_UI)
  42. # 3) Add a method to the script event
  43. qtpy_asset_editor.add_method_to_script_event("test_method")
  44. # 4) Add Parameter to Event
  45. qtpy_asset_editor.add_parameter_to_method("test_parameter_0")
  46. # 5) Remove Parameter from Event
  47. qtpy_asset_editor.delete_parameter_from_method(0)
  48. if __name__ == "__main__":
  49. import ImportPathHelper as imports
  50. imports.init()
  51. from editor_python_test_tools.utils import Report
  52. Report.start_test(ScriptEvent_AddRemoveParameter_ActionsSuccessful)