You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.2 KiB
Python
73 lines
2.2 KiB
Python
"""
|
|
Copyright (c) Contributors to the Open 3D Engine Project.
|
|
For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
|
|
|
SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
"""
|
|
|
|
|
|
def Menus_FileMenuOptions_Work():
|
|
"""
|
|
Summary:
|
|
Interact with File Menu options and verify if all the options are working.
|
|
|
|
Expected Behavior:
|
|
The File menu functions normally.
|
|
|
|
Test Steps:
|
|
1) Open level
|
|
2) Interact with File Menu options
|
|
|
|
Note:
|
|
- This test file must be called from the O3DE Editor command terminal
|
|
- Any passed and failed tests are written to the Editor.log file.
|
|
Parsing the file or running a log_monitor are required to observe the test results.
|
|
|
|
:return: None
|
|
"""
|
|
|
|
import editor_python_test_tools.hydra_editor_utils as hydra
|
|
import editor_python_test_tools.pyside_utils as pyside_utils
|
|
from editor_python_test_tools.utils import Report
|
|
|
|
file_menu_options = [
|
|
("New Level",),
|
|
("Open Level",),
|
|
#("Import",), #Temporarily disabled due to https://github.com/o3de/o3de/issues/6746
|
|
("Save",),
|
|
("Save As",),
|
|
("Save Level Statistics",),
|
|
("Edit Project Settings",),
|
|
("Edit Platform Settings",),
|
|
("New Project",),
|
|
("Open Project",),
|
|
("Show Log File",),
|
|
("Exit",),
|
|
]
|
|
|
|
# 1) Open an existing simple level
|
|
hydra.open_base_level()
|
|
|
|
# 2) Interact with File Menu options
|
|
editor_window = pyside_utils.get_editor_main_window()
|
|
for option in file_menu_options:
|
|
try:
|
|
action = pyside_utils.get_action_for_menu_path(editor_window, "File", *option)
|
|
Report.info(f"Triggering {action.iconText()}")
|
|
action.trigger()
|
|
action_triggered = True
|
|
except Exception as e:
|
|
action_triggered = False
|
|
print(e)
|
|
menu_action_triggered = (
|
|
f"{action.iconText()} action triggered successfully",
|
|
f"Failed to trigger {action.iconText()} action"
|
|
)
|
|
Report.result(menu_action_triggered, action_triggered)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
from editor_python_test_tools.utils import Report
|
|
Report.start_test(Menus_FileMenuOptions_Work)
|