Menus_EditMenuOptions.py 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. """
  2. All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
  3. its licensors.
  4. For complete copyright and license terms please see the LICENSE at the root of this
  5. distribution (the "License"). All use of this software is governed by the License,
  6. or, if provided, by the license below or the license accompanying this file. Do not
  7. remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. """
  10. """
  11. C24064529: Base Edit Menu Options
  12. """
  13. import os
  14. import sys
  15. import azlmbr.paths
  16. sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
  17. from automatedtesting_shared.editor_test_helper import EditorTestHelper
  18. import automatedtesting_shared.pyside_utils as pyside_utils
  19. class TestEditMenuOptions(EditorTestHelper):
  20. def __init__(self):
  21. EditorTestHelper.__init__(self, log_prefix="Menus_EditMenuOptions", args=["level"])
  22. def run_test(self):
  23. """
  24. Summary:
  25. Interact with Edit Menu options and verify if all the options are working.
  26. Expected Behavior:
  27. The Edit menu functions normally.
  28. Test Steps:
  29. 1) Create a temp level
  30. 2) Interact with Edit Menu options
  31. Note:
  32. - This test file must be called from the Lumberyard Editor command terminal
  33. - Any passed and failed tests are written to the Editor.log file.
  34. Parsing the file or running a log_monitor are required to observe the test results.
  35. :return: None
  36. """
  37. edit_menu_options = [
  38. ("Undo",),
  39. ("Redo",),
  40. ("Duplicate",),
  41. ("Delete",),
  42. ("Select All",),
  43. ("Invert Selection",),
  44. ("Toggle Pivot Location",),
  45. ("Reset Entity Transform",),
  46. ("Reset Manipulator",),
  47. ("Reset Transform (Local)",),
  48. ("Reset Transform (World)",),
  49. ("Hide Selection",),
  50. ("Show All",),
  51. ("Modify", "Snap", "Snap angle"),
  52. ("Modify", "Transform Mode", "Move"),
  53. ("Modify", "Transform Mode", "Rotate"),
  54. ("Modify", "Transform Mode", "Scale"),
  55. ("Lock Selection",),
  56. ("Unlock All Entities",),
  57. ("Editor Settings", "Global Preferences"),
  58. ("Editor Settings", "Graphics Settings"),
  59. ("Editor Settings", "Editor Settings Manager"),
  60. ("Editor Settings", "Graphics Performance", "PC", "Very High"),
  61. ("Editor Settings", "Graphics Performance", "PC", "High"),
  62. ("Editor Settings", "Graphics Performance", "PC", "Medium"),
  63. ("Editor Settings", "Graphics Performance", "PC", "Low"),
  64. ("Editor Settings", "Graphics Performance", "OSX Metal", "Very High"),
  65. ("Editor Settings", "Graphics Performance", "OSX Metal", "High"),
  66. ("Editor Settings", "Graphics Performance", "OSX Metal", "Medium"),
  67. ("Editor Settings", "Graphics Performance", "OSX Metal", "Low"),
  68. ("Editor Settings", "Graphics Performance", "Android", "Very High"),
  69. ("Editor Settings", "Graphics Performance", "Android", "High"),
  70. ("Editor Settings", "Graphics Performance", "Android", "Medium"),
  71. ("Editor Settings", "Graphics Performance", "Android", "Low"),
  72. ("Editor Settings", "Graphics Performance", "iOS", "Very High"),
  73. ("Editor Settings", "Graphics Performance", "iOS", "High"),
  74. ("Editor Settings", "Graphics Performance", "iOS", "Medium"),
  75. ("Editor Settings", "Graphics Performance", "iOS", "Low"),
  76. ("Editor Settings", "Keyboard Customization", "Customize Keyboard"),
  77. ("Editor Settings", "Keyboard Customization", "Export Keyboard Settings"),
  78. ("Editor Settings", "Keyboard Customization", "Import Keyboard Settings"),
  79. ]
  80. # 1) Create and open the temp level
  81. self.test_success = self.create_level(
  82. self.args["level"],
  83. heightmap_resolution=1024,
  84. heightmap_meters_per_pixel=1,
  85. terrain_texture_resolution=4096,
  86. use_terrain=False,
  87. )
  88. def on_action_triggered(action_name):
  89. print(f"{action_name} Action triggered")
  90. # 2) Interact with Edit Menu options
  91. try:
  92. editor_window = pyside_utils.get_editor_main_window()
  93. for option in edit_menu_options:
  94. action = pyside_utils.get_action_for_menu_path(editor_window, "Edit", *option)
  95. trig_func = lambda: on_action_triggered(action.iconText())
  96. action.triggered.connect(trig_func)
  97. action.trigger()
  98. action.triggered.disconnect(trig_func)
  99. except Exception as e:
  100. self.test_success = False
  101. print(e)
  102. test = TestEditMenuOptions()
  103. test.run()