Integrating github/staging through commit ab87ed9
This commit is contained in:
Executable → Regular
+3
-3
@@ -27,9 +27,9 @@ from automatedtesting_shared.editor_test_helper import EditorTestHelper
|
||||
import automatedtesting_shared.pyside_utils as pyside_utils
|
||||
|
||||
|
||||
class TestAssetBrowserSearchFiltering(EditorTestHelper):
|
||||
class AssetBrowserSearchFilteringTest(EditorTestHelper):
|
||||
def __init__(self):
|
||||
EditorTestHelper.__init__(self, log_prefix="SearchFiltering_Asset_Browser_Filtering", args=["level"])
|
||||
EditorTestHelper.__init__(self, log_prefix="AssetBrowser_SearchFiltering", args=["level"])
|
||||
|
||||
@pyside_utils.wrap_async
|
||||
async def run_test(self):
|
||||
@@ -161,5 +161,5 @@ class TestAssetBrowserSearchFiltering(EditorTestHelper):
|
||||
asset_browser.close()
|
||||
|
||||
|
||||
test = TestAssetBrowserSearchFiltering()
|
||||
test = AssetBrowserSearchFilteringTest()
|
||||
test.run()
|
||||
Executable → Regular
+1
-1
@@ -27,7 +27,7 @@ import automatedtesting_shared.pyside_utils as pyside_utils
|
||||
|
||||
class AssetBrowserTreeNavigationTest(EditorTestHelper):
|
||||
def __init__(self):
|
||||
EditorTestHelper.__init__(self, log_prefix="TreeNavigation_Asset_Browser", args=["level"])
|
||||
EditorTestHelper.__init__(self, log_prefix="AssetBrowser_TreeNavigation", args=["level"])
|
||||
|
||||
def run_test(self):
|
||||
"""
|
||||
@@ -0,0 +1,262 @@
|
||||
"""
|
||||
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
its licensors.
|
||||
|
||||
For complete copyright and license terms please see the LICENSE at the root of this
|
||||
distribution (the "License"). All use of this software is governed by the License,
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
"""
|
||||
|
||||
"""
|
||||
C13751579: Asset Picker UI/UX
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
from PySide2 import QtWidgets, QtTest, QtCore
|
||||
from PySide2.QtCore import Qt
|
||||
|
||||
import azlmbr.asset as asset
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.legacy.general as general
|
||||
import azlmbr.paths
|
||||
import azlmbr.math as math
|
||||
|
||||
sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
|
||||
import automatedtesting_shared.hydra_editor_utils as hydra
|
||||
from automatedtesting_shared.editor_test_helper import EditorTestHelper
|
||||
import automatedtesting_shared.pyside_utils as pyside_utils
|
||||
|
||||
|
||||
class AssetPickerUIUXTest(EditorTestHelper):
|
||||
def __init__(self):
|
||||
EditorTestHelper.__init__(self, log_prefix="AssetPicker_UI_UX", args=["level"])
|
||||
|
||||
@pyside_utils.wrap_async
|
||||
async def run_test(self):
|
||||
"""
|
||||
Summary:
|
||||
Verify the functionality of Asset Picker and UI/UX properties
|
||||
|
||||
Expected Behavior:
|
||||
The asset picker opens and is labeled appropriately ("Pick Model Asset" in this instance).
|
||||
The Asset Picker window can be resized and moved around the screen.
|
||||
The file tree expands/retracts appropriately and a scroll bar is present when the menus extend
|
||||
beyond the length of the window.
|
||||
The assets are limited to a valid type for the field selected (mesh assets in this instance)
|
||||
The asset picker is closed and the selected asset is assigned to the mesh component.
|
||||
|
||||
Test Steps:
|
||||
1) Open a new level
|
||||
2) Create entity and add Mesh component
|
||||
3) Access Entity Inspector
|
||||
4) Click Asset Picker (Mesh Asset)
|
||||
a) Collapse all the files initially and verify if scroll bar is not visible
|
||||
b) Expand/Verify Top folder of file path
|
||||
c) Expand/Verify Nested folder of file path
|
||||
d) Verify if the ScrollBar appears after expanding folders
|
||||
e) Collapse Nested and Top Level folders and verify if collapsed
|
||||
f) Verify if the correct files are appearing in the Asset Picker
|
||||
g) Move the widget and verify position
|
||||
h) Resize the widget
|
||||
g) Assign Mesh asset
|
||||
5) Verify if Mesh Asset is assigned via both OK/Enter options
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Lumberyard 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
|
||||
"""
|
||||
|
||||
self.file_path = ["AutomatedTesting", "Assets", "Objects", "Foliage"]
|
||||
self.incorrect_file_found = False
|
||||
self.mesh_asset = "cedar.azmodel"
|
||||
self.prefix = ""
|
||||
|
||||
def is_asset_assigned(component, interaction_option):
|
||||
path = os.path.join("assets", "objects", "foliage", "cedar.azmodel")
|
||||
expected_asset_id = asset.AssetCatalogRequestBus(bus.Broadcast, 'GetAssetIdByPath', path, math.Uuid(),
|
||||
False)
|
||||
result = hydra.get_component_property_value(component, "Controller|Configuration|Mesh Asset")
|
||||
expected_asset_str = expected_asset_id.invoke("ToString")
|
||||
result_str = result.invoke("ToString")
|
||||
print(f"Asset assigned for {interaction_option} option: {expected_asset_str == result_str}")
|
||||
return expected_asset_str == result_str
|
||||
|
||||
def move_and_resize_widget(widget):
|
||||
# Move the widget and verify position
|
||||
initial_position = widget.pos()
|
||||
x, y = initial_position.x() + 5, initial_position.y() + 5
|
||||
widget.move(x, y)
|
||||
curr_position = widget.pos()
|
||||
move_success = curr_position.x() == x and curr_position.y() == y
|
||||
self.test_success = move_success and self.test_success
|
||||
self.log(f"Widget Move Test: {move_success}")
|
||||
|
||||
# Resize the widget and verify size
|
||||
width, height = (
|
||||
widget.geometry().width() + 10,
|
||||
widget.geometry().height() + 10,
|
||||
)
|
||||
widget.resize(width, height)
|
||||
resize_success = widget.geometry().width() == width and widget.geometry().height() == height
|
||||
self.test_success = resize_success and self.test_success
|
||||
self.log(f"Widget Resize Test: {resize_success}")
|
||||
|
||||
def verify_files_appeared(model, allowed_asset_extensions, parent_index=QtCore.QModelIndex()):
|
||||
indices = [parent_index]
|
||||
while len(indices) > 0:
|
||||
parent_index = indices.pop(0)
|
||||
for row in range(model.rowCount(parent_index)):
|
||||
cur_index = model.index(row, 0, parent_index)
|
||||
cur_data = cur_index.data(Qt.DisplayRole)
|
||||
if (
|
||||
"." in cur_data
|
||||
and (cur_data.lower().split(".")[-1] not in allowed_asset_extensions)
|
||||
and not cur_data[-1] == ")"
|
||||
):
|
||||
print(f"Incorrect file found: {cur_data}")
|
||||
self.incorrect_file_found = True
|
||||
indices = list()
|
||||
break
|
||||
indices.append(cur_index)
|
||||
self.test_success = not self.incorrect_file_found and self.test_success
|
||||
|
||||
def print_message_prefix(message):
|
||||
print(f"{self.prefix}: {message}")
|
||||
|
||||
async def asset_picker(prefix, allowed_asset_extensions, asset, interaction_option):
|
||||
active_modal_widget = await pyside_utils.wait_for_modal_widget()
|
||||
if active_modal_widget and self.prefix == "":
|
||||
self.prefix = prefix
|
||||
dialog = active_modal_widget.findChildren(QtWidgets.QDialog, "AssetPickerDialogClass")[0]
|
||||
print_message_prefix(f"Asset Picker title for Mesh: {dialog.windowTitle()}")
|
||||
tree = dialog.findChildren(QtWidgets.QTreeView, "m_assetBrowserTreeViewWidget")[0]
|
||||
scroll_area = tree.findChild(QtWidgets.QWidget, "qt_scrollarea_vcontainer")
|
||||
scroll_bar = scroll_area.findChild(QtWidgets.QScrollBar)
|
||||
|
||||
# a) Collapse all the files initially and verify if scroll bar is not visible
|
||||
tree.collapseAll()
|
||||
await pyside_utils.wait_for_condition(lambda: not scroll_bar.isVisible(), 0.5)
|
||||
print_message_prefix(
|
||||
f"Scroll Bar is not visible before expanding the tree: {not scroll_bar.isVisible()}"
|
||||
)
|
||||
|
||||
# Get Model Index of the file paths
|
||||
model_index_1 = pyside_utils.find_child_by_pattern(tree, self.file_path[0])
|
||||
print(model_index_1.model())
|
||||
model_index_2 = pyside_utils.find_child_by_pattern(model_index_1, self.file_path[1])
|
||||
|
||||
# b) Expand/Verify Top folder of file path
|
||||
print_message_prefix(f"Top level folder initially collapsed: {not tree.isExpanded(model_index_1)}")
|
||||
tree.expand(model_index_1)
|
||||
print_message_prefix(f"Top level folder expanded: {tree.isExpanded(model_index_1)}")
|
||||
|
||||
# c) Expand/Verify Nested folder of file path
|
||||
print_message_prefix(f"Nested folder initially collapsed: {not tree.isExpanded(model_index_2)}")
|
||||
tree.expand(model_index_2)
|
||||
print_message_prefix(f"Nested folder expanded: {tree.isExpanded(model_index_2)}")
|
||||
|
||||
# d) Verify if the ScrollBar appears after expanding folders
|
||||
tree.expandAll()
|
||||
await pyside_utils.wait_for_condition(lambda: scroll_bar.isVisible(), 0.5)
|
||||
print_message_prefix(f"Scroll Bar appeared after expanding tree: {scroll_bar.isVisible()}")
|
||||
|
||||
# e) Collapse Nested and Top Level folders and verify if collapsed
|
||||
tree.collapse(model_index_2)
|
||||
print_message_prefix(f"Nested folder collapsed: {not tree.isExpanded(model_index_2)}")
|
||||
tree.collapse(model_index_1)
|
||||
print_message_prefix(f"Top level folder collapsed: {not tree.isExpanded(model_index_1)}")
|
||||
|
||||
# f) Verify if the correct files are appearing in the Asset Picker
|
||||
verify_files_appeared(tree.model(), allowed_asset_extensions)
|
||||
print_message_prefix(f"Expected Assets populated in the file picker: {not self.incorrect_file_found}")
|
||||
|
||||
# While we are here we can also check if we can resize and move the widget
|
||||
move_and_resize_widget(active_modal_widget)
|
||||
|
||||
# g) Assign asset
|
||||
tree.collapseAll()
|
||||
await pyside_utils.wait_for_condition(
|
||||
lambda: len(dialog.findChildren(QtWidgets.QFrame, "m_searchWidget")) > 0, 0.5)
|
||||
search_widget = dialog.findChildren(QtWidgets.QFrame, "m_searchWidget")[0]
|
||||
search_line_edit = search_widget.findChildren(QtWidgets.QLineEdit, "textSearch")[0]
|
||||
search_line_edit.setText(asset)
|
||||
tree.expandAll()
|
||||
asset_model_index = pyside_utils.find_child_by_pattern(tree, asset)
|
||||
await pyside_utils.wait_for_condition(lambda: asset_model_index.isValid(), 2.0)
|
||||
tree.expand(asset_model_index)
|
||||
tree.setCurrentIndex(asset_model_index)
|
||||
if interaction_option == "ok":
|
||||
button_box = dialog.findChild(QtWidgets.QDialogButtonBox, "m_buttonBox")
|
||||
ok_button = button_box.button(QtWidgets.QDialogButtonBox.Ok)
|
||||
await pyside_utils.click_button_async(ok_button)
|
||||
elif interaction_option == "enter":
|
||||
QtTest.QTest.keyClick(tree, Qt.Key_Enter, Qt.NoModifier)
|
||||
self.prefix = ""
|
||||
|
||||
# 1) Open a new level
|
||||
self.test_success = self.create_level(
|
||||
self.args["level"],
|
||||
heightmap_resolution=1024,
|
||||
heightmap_meters_per_pixel=1,
|
||||
terrain_texture_resolution=4096,
|
||||
use_terrain=False,
|
||||
)
|
||||
|
||||
# 2) Create entity and add Mesh component
|
||||
entity_position = math.Vector3(125.0, 136.0, 32.0)
|
||||
entity = hydra.Entity("TestEntity")
|
||||
entity.create_entity(entity_position, ["Mesh"])
|
||||
|
||||
# 3) Access Entity Inspector
|
||||
editor_window = pyside_utils.get_editor_main_window()
|
||||
entity_inspector = editor_window.findChild(QtWidgets.QDockWidget, "Entity Inspector")
|
||||
component_list_widget = entity_inspector.findChild(QtWidgets.QWidget, "m_componentListContents")
|
||||
|
||||
# 4) Click on Asset Picker (Mesh Asset)
|
||||
general.select_object("TestEntity")
|
||||
general.idle_wait(0.5)
|
||||
mesh_asset = component_list_widget.findChildren(QtWidgets.QFrame, "Mesh Asset")[0]
|
||||
attached_button = mesh_asset.findChildren(QtWidgets.QPushButton, "attached-button")[0]
|
||||
|
||||
# Assign Mesh Asset via OK button
|
||||
pyside_utils.click_button_async(attached_button)
|
||||
await asset_picker("Mesh Asset", ["azmodel", "fbx"], "cedar (ModelAsset)", "ok")
|
||||
|
||||
# 5) Verify if Mesh Asset is assigned
|
||||
try:
|
||||
mesh_success = await pyside_utils.wait_for_condition(lambda: is_asset_assigned(entity.components[0],
|
||||
"ok"))
|
||||
except pyside_utils.EventLoopTimeoutException as err:
|
||||
print(err)
|
||||
mesh_success = False
|
||||
self.test_success = mesh_success and self.test_success
|
||||
|
||||
# Clear Mesh Asset
|
||||
hydra.get_set_test(entity, 0, "Controller|Configuration|Mesh Asset", None)
|
||||
general.select_object("TestEntity")
|
||||
general.idle_wait(0.5)
|
||||
mesh_asset = component_list_widget.findChildren(QtWidgets.QFrame, "Mesh Asset")[0]
|
||||
attached_button = mesh_asset.findChildren(QtWidgets.QPushButton, "attached-button")[0]
|
||||
|
||||
# Assign Mesh Asset via Enter
|
||||
pyside_utils.click_button_async(attached_button)
|
||||
await asset_picker("Mesh Asset", ["azmodel", "fbx"], "cedar (ModelAsset)", "enter")
|
||||
|
||||
# 5) Verify if Mesh Asset is assigned
|
||||
try:
|
||||
mesh_success = await pyside_utils.wait_for_condition(lambda: is_asset_assigned(entity.components[0],
|
||||
"enter"))
|
||||
except pyside_utils.EventLoopTimeoutException as err:
|
||||
print(err)
|
||||
mesh_success = False
|
||||
self.test_success = mesh_success and self.test_success
|
||||
|
||||
|
||||
test = AssetPickerUIUXTest()
|
||||
test.run()
|
||||
+3
-5
@@ -72,6 +72,7 @@ class AddDeleteComponentsTest(EditorTestHelper):
|
||||
component_index = pyside_utils.find_child_by_pattern(tree, component_name)
|
||||
if component_index.isValid():
|
||||
print(f"{component_name} found")
|
||||
tree.expand(component_index)
|
||||
tree.setCurrentIndex(component_index)
|
||||
QtTest.QTest.keyClick(tree, Qt.Key_Enter, Qt.NoModifier)
|
||||
|
||||
@@ -93,8 +94,8 @@ class AddDeleteComponentsTest(EditorTestHelper):
|
||||
print("Entity Created")
|
||||
|
||||
# 3) Select the newly created entity
|
||||
general.clear_selection()
|
||||
general.select_object("Entity2")
|
||||
|
||||
# Give the Entity Inspector time to fully create its contents
|
||||
general.idle_wait(0.5)
|
||||
|
||||
@@ -103,14 +104,11 @@ class AddDeleteComponentsTest(EditorTestHelper):
|
||||
entity_inspector = editor_window.findChild(QtWidgets.QDockWidget, "Entity Inspector")
|
||||
add_comp_btn = entity_inspector.findChild(QtWidgets.QPushButton, "m_addComponentButton")
|
||||
await add_component("Box Shape")
|
||||
|
||||
print(f"Box Shape Component added: {hydra.has_components(entity_id, ['Box Shape'])}")
|
||||
|
||||
# 5) Add/verify Mesh component
|
||||
await add_component("Mesh")
|
||||
print(
|
||||
f"Box Shape and Mesh Components present in the entity: {hydra.has_components(entity_id, ['Box Shape', 'Mesh'])}"
|
||||
)
|
||||
print(f"Mesh Component added: {hydra.has_components(entity_id, ['Mesh'])}")
|
||||
|
||||
# 6) Delete Mesh Component
|
||||
general.idle_wait(0.5)
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
"""
|
||||
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
its licensors.
|
||||
|
||||
For complete copyright and license terms please see the LICENSE at the root of this
|
||||
distribution (the "License"). All use of this software is governed by the License,
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
C6376081: Basic Function: Docked/Undocked Tools
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
from PySide2 import QtWidgets, QtTest, QtCore
|
||||
|
||||
import azlmbr.legacy.general as general
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.editor as editor
|
||||
import azlmbr.entity as entity
|
||||
import azlmbr.paths
|
||||
|
||||
sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
|
||||
from automatedtesting_shared.editor_test_helper import EditorTestHelper
|
||||
import automatedtesting_shared.pyside_utils as pyside_utils
|
||||
|
||||
|
||||
class TestDockingBasicDockedTools(EditorTestHelper):
|
||||
def __init__(self):
|
||||
EditorTestHelper.__init__(self, log_prefix="Docking_BasicDockedTools", args=["level"])
|
||||
|
||||
@pyside_utils.wrap_async
|
||||
async def run_test(self):
|
||||
"""
|
||||
Summary:
|
||||
Test that tools still work as expected when docked together.
|
||||
|
||||
Expected Behavior:
|
||||
Multiple tools can be docked together.
|
||||
Tools function while docked together and the main editor responds appropriately.
|
||||
|
||||
Test Steps:
|
||||
1) Open the tools and dock them together in a floating tabbed widget.
|
||||
2) Perform actions in the docked tools to verify they still work as expected.
|
||||
2.1) Select the Entity Outliner in the floating window.
|
||||
2.2) Select an Entity in the Entity Outliner.
|
||||
2.3) Select the Entity Inspector in the floating window.
|
||||
2.4) Change the name of the selected Entity via the Entity Inspector.
|
||||
2.5) Select the Console inside the floating window.
|
||||
2.6) Send a console command.
|
||||
2.7) Check the Editor to verify all changes were made.
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
# Create a level since we are going to be dealing with an Entity.
|
||||
self.create_level(
|
||||
self.args["level"],
|
||||
heightmap_resolution=1024,
|
||||
heightmap_meters_per_pixel=1,
|
||||
terrain_texture_resolution=4096,
|
||||
use_terrain=False,
|
||||
)
|
||||
|
||||
# Make sure the Entity Outliner, Entity Inspector and Console tools are open
|
||||
general.open_pane("Entity Outliner (PREVIEW)")
|
||||
general.open_pane("Entity Inspector")
|
||||
general.open_pane("Console")
|
||||
|
||||
# Create an Entity to test with
|
||||
entity_original_name = 'MyTestEntity'
|
||||
entity_id = editor.ToolsApplicationRequestBus(bus.Broadcast, 'CreateNewEntity', entity.EntityId())
|
||||
editor.EditorEntityAPIBus(bus.Event, 'SetName', entity_id, entity_original_name)
|
||||
|
||||
editor_window = pyside_utils.get_editor_main_window()
|
||||
entity_outliner = editor_window.findChild(QtWidgets.QDockWidget, "Entity Outliner (PREVIEW)")
|
||||
|
||||
# 1) Open the tools and dock them together in a floating tabbed widget.
|
||||
# We drag/drop it over the viewport since it doesn't allow docking, so this will undock it
|
||||
render_overlay = editor_window.findChild(QtWidgets.QWidget, "renderOverlay")
|
||||
pyside_utils.drag_and_drop(entity_outliner, render_overlay)
|
||||
|
||||
# We need to grab a new reference to the Entity Outliner QDockWidget because when it gets moved
|
||||
# to the floating window, its parent changes so the wrapped intance we had becomes invalid
|
||||
entity_outliner = editor_window.findChild(QtWidgets.QDockWidget, "Entity Outliner (PREVIEW)")
|
||||
|
||||
# Dock the Entity Inspector tabbed with the floating Entity Outliner
|
||||
entity_inspector = editor_window.findChild(QtWidgets.QDockWidget, "Entity Inspector")
|
||||
pyside_utils.drag_and_drop(entity_inspector, entity_outliner)
|
||||
|
||||
# We need to grab a new reference to the Entity Inspector QDockWidget because when it gets moved
|
||||
# to the floating window, its parent changes so the wrapped intance we had becomes invalid
|
||||
entity_inspector = editor_window.findChild(QtWidgets.QDockWidget, "Entity Inspector")
|
||||
|
||||
# Dock the Console tabbed with the floating Entity Inspector
|
||||
console = editor_window.findChild(QtWidgets.QDockWidget, "Console")
|
||||
pyside_utils.drag_and_drop(console, entity_inspector)
|
||||
|
||||
# Check to ensure all the tools are parented to the same QStackedWidget
|
||||
def check_all_panes_tabbed():
|
||||
entity_inspector = editor_window.findChild(QtWidgets.QDockWidget, "Entity Inspector")
|
||||
entity_outliner = editor_window.findChild(QtWidgets.QDockWidget, "Entity Outliner (PREVIEW)")
|
||||
console = editor_window.findChild(QtWidgets.QDockWidget, "Console")
|
||||
entity_inspector_parent = entity_inspector.parentWidget()
|
||||
entity_outliner_parent = entity_outliner.parentWidget()
|
||||
console_parent = console.parentWidget()
|
||||
print(f"Entity Inspector parent = {entity_inspector_parent}, Entity Outliner parent = {entity_outliner_parent}, Console parent = {console_parent}")
|
||||
return isinstance(entity_inspector_parent, QtWidgets.QStackedWidget) and (entity_inspector_parent == entity_outliner_parent) and (entity_outliner_parent == console_parent)
|
||||
|
||||
success = await pyside_utils.wait_for(check_all_panes_tabbed, timeout=3.0)
|
||||
if success:
|
||||
print("The tools are all docked together in a tabbed widget")
|
||||
|
||||
# 2.1,2) Select an Entity in the Entity Outliner.
|
||||
entity_inspector = editor_window.findChild(QtWidgets.QDockWidget, "Entity Inspector")
|
||||
entity_outliner = editor_window.findChild(QtWidgets.QDockWidget, "Entity Outliner (PREVIEW)")
|
||||
console = editor_window.findChild(QtWidgets.QDockWidget, "Console")
|
||||
object_tree = entity_outliner.findChild(QtWidgets.QTreeView, "m_objectTree")
|
||||
test_entity_index = pyside_utils.find_child_by_pattern(object_tree, entity_original_name)
|
||||
object_tree.clearSelection()
|
||||
object_tree.setCurrentIndex(test_entity_index)
|
||||
if object_tree.currentIndex():
|
||||
print("Entity Outliner works when docked, can select an Entity")
|
||||
|
||||
# 2.3,4) Change the name of the selected Entity via the Entity Inspector.
|
||||
entity_inspector_name_field = entity_inspector.findChild(QtWidgets.QLineEdit, "m_entityNameEditor")
|
||||
expected_new_name = "DifferentName"
|
||||
entity_inspector_name_field.setText(expected_new_name)
|
||||
QtTest.QTest.keyClick(entity_inspector_name_field, QtCore.Qt.Key_Enter)
|
||||
entity_new_name = editor.EditorEntityInfoRequestBus(bus.Event, "GetName", entity_id)
|
||||
if entity_new_name == expected_new_name:
|
||||
print(f"Entity Inspector works when docked, Entity name changed to {entity_new_name}")
|
||||
|
||||
# 2.5,6) Send a console command.
|
||||
console_line_edit = console.findChild(QtWidgets.QLineEdit, "lineEdit")
|
||||
console_line_edit.setText("Hello, world!")
|
||||
QtTest.QTest.keyClick(console_line_edit, QtCore.Qt.Key_Enter)
|
||||
|
||||
|
||||
test = TestDockingBasicDockedTools()
|
||||
test.run()
|
||||
@@ -0,0 +1,120 @@
|
||||
"""
|
||||
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
its licensors.
|
||||
|
||||
For complete copyright and license terms please see the LICENSE at the root of this
|
||||
distribution (the "License"). All use of this software is governed by the License,
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
"""
|
||||
|
||||
"""
|
||||
C24064529: Base Edit Menu Options
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import azlmbr.paths
|
||||
|
||||
sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
|
||||
from automatedtesting_shared.editor_test_helper import EditorTestHelper
|
||||
import automatedtesting_shared.pyside_utils as pyside_utils
|
||||
|
||||
|
||||
class TestEditMenuOptions(EditorTestHelper):
|
||||
def __init__(self):
|
||||
EditorTestHelper.__init__(self, log_prefix="Menus_EditMenuOptions", args=["level"])
|
||||
|
||||
def run_test(self):
|
||||
"""
|
||||
Summary:
|
||||
Interact with Edit Menu options and verify if all the options are working.
|
||||
|
||||
Expected Behavior:
|
||||
The Edit menu functions normally.
|
||||
|
||||
Test Steps:
|
||||
1) Create a temp level
|
||||
2) Interact with Edit Menu options
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Lumberyard 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
|
||||
"""
|
||||
edit_menu_options = [
|
||||
("Undo",),
|
||||
("Redo",),
|
||||
("Duplicate",),
|
||||
("Delete",),
|
||||
("Select All",),
|
||||
("Invert Selection",),
|
||||
("Toggle Pivot Location",),
|
||||
("Reset Entity Transform",),
|
||||
("Reset Manipulator",),
|
||||
("Reset Transform (Local)",),
|
||||
("Reset Transform (World)",),
|
||||
("Hide Selection",),
|
||||
("Show All",),
|
||||
("Modify", "Snap", "Snap angle"),
|
||||
("Modify", "Transform Mode", "Move"),
|
||||
("Modify", "Transform Mode", "Rotate"),
|
||||
("Modify", "Transform Mode", "Scale"),
|
||||
("Lock Selection",),
|
||||
("Unlock All Entities",),
|
||||
("Editor Settings", "Global Preferences"),
|
||||
("Editor Settings", "Graphics Settings"),
|
||||
("Editor Settings", "Editor Settings Manager"),
|
||||
("Editor Settings", "Graphics Performance", "PC", "Very High"),
|
||||
("Editor Settings", "Graphics Performance", "PC", "High"),
|
||||
("Editor Settings", "Graphics Performance", "PC", "Medium"),
|
||||
("Editor Settings", "Graphics Performance", "PC", "Low"),
|
||||
("Editor Settings", "Graphics Performance", "OSX Metal", "Very High"),
|
||||
("Editor Settings", "Graphics Performance", "OSX Metal", "High"),
|
||||
("Editor Settings", "Graphics Performance", "OSX Metal", "Medium"),
|
||||
("Editor Settings", "Graphics Performance", "OSX Metal", "Low"),
|
||||
("Editor Settings", "Graphics Performance", "Android", "Very High"),
|
||||
("Editor Settings", "Graphics Performance", "Android", "High"),
|
||||
("Editor Settings", "Graphics Performance", "Android", "Medium"),
|
||||
("Editor Settings", "Graphics Performance", "Android", "Low"),
|
||||
("Editor Settings", "Graphics Performance", "iOS", "Very High"),
|
||||
("Editor Settings", "Graphics Performance", "iOS", "High"),
|
||||
("Editor Settings", "Graphics Performance", "iOS", "Medium"),
|
||||
("Editor Settings", "Graphics Performance", "iOS", "Low"),
|
||||
("Editor Settings", "Keyboard Customization", "Customize Keyboard"),
|
||||
("Editor Settings", "Keyboard Customization", "Export Keyboard Settings"),
|
||||
("Editor Settings", "Keyboard Customization", "Import Keyboard Settings"),
|
||||
]
|
||||
|
||||
# 1) Create and open the temp level
|
||||
self.test_success = self.create_level(
|
||||
self.args["level"],
|
||||
heightmap_resolution=1024,
|
||||
heightmap_meters_per_pixel=1,
|
||||
terrain_texture_resolution=4096,
|
||||
use_terrain=False,
|
||||
)
|
||||
|
||||
def on_action_triggered(action_name):
|
||||
print(f"{action_name} Action triggered")
|
||||
|
||||
# 2) Interact with Edit Menu options
|
||||
try:
|
||||
editor_window = pyside_utils.get_editor_main_window()
|
||||
for option in edit_menu_options:
|
||||
action = pyside_utils.get_action_for_menu_path(editor_window, "Edit", *option)
|
||||
trig_func = lambda: on_action_triggered(action.iconText())
|
||||
action.triggered.connect(trig_func)
|
||||
action.trigger()
|
||||
action.triggered.disconnect(trig_func)
|
||||
except Exception as e:
|
||||
self.test_success = False
|
||||
print(e)
|
||||
|
||||
|
||||
test = TestEditMenuOptions()
|
||||
test.run()
|
||||
@@ -0,0 +1,90 @@
|
||||
"""
|
||||
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
its licensors.
|
||||
|
||||
For complete copyright and license terms please see the LICENSE at the root of this
|
||||
distribution (the "License"). All use of this software is governed by the License,
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
"""
|
||||
|
||||
"""
|
||||
C24064528: The File menu options function normally
|
||||
C16780778: The File menu options function normally-New view interaction Model enabled
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import azlmbr.paths
|
||||
|
||||
sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
|
||||
from automatedtesting_shared.editor_test_helper import EditorTestHelper
|
||||
import automatedtesting_shared.pyside_utils as pyside_utils
|
||||
|
||||
|
||||
class TestFileMenuOptions(EditorTestHelper):
|
||||
def __init__(self):
|
||||
EditorTestHelper.__init__(self, log_prefix="file_menu_options: ", args=["level"])
|
||||
|
||||
def run_test(self):
|
||||
"""
|
||||
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 Lumberyard 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
|
||||
"""
|
||||
file_menu_options = [
|
||||
("New Level",),
|
||||
("Open Level",),
|
||||
("Import",),
|
||||
("Save",),
|
||||
("Save As",),
|
||||
("Save Level Statistics",),
|
||||
("Project Settings", "Project Settings Tool"),
|
||||
("Show Log File",),
|
||||
("Resave All Slices",),
|
||||
("Exit",),
|
||||
]
|
||||
|
||||
# 1) Open level
|
||||
self.test_success = self.create_level(
|
||||
self.args["level"],
|
||||
heightmap_resolution=1024,
|
||||
heightmap_meters_per_pixel=1,
|
||||
terrain_texture_resolution=4096,
|
||||
use_terrain=False,
|
||||
)
|
||||
|
||||
def on_action_triggered(action_name):
|
||||
print(f"{action_name} Action triggered")
|
||||
|
||||
# 2) Interact with File Menu options
|
||||
try:
|
||||
editor_window = pyside_utils.get_editor_main_window()
|
||||
for option in file_menu_options:
|
||||
action = pyside_utils.get_action_for_menu_path(editor_window, "File", *option)
|
||||
trig_func = lambda: on_action_triggered(action.iconText())
|
||||
action.triggered.connect(trig_func)
|
||||
action.trigger()
|
||||
action.triggered.disconnect(trig_func)
|
||||
except Exception as e:
|
||||
self.test_success = False
|
||||
print(e)
|
||||
|
||||
|
||||
test = TestFileMenuOptions()
|
||||
test.run()
|
||||
@@ -0,0 +1,91 @@
|
||||
"""
|
||||
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
its licensors.
|
||||
|
||||
For complete copyright and license terms please see the LICENSE at the root of this
|
||||
distribution (the "License"). All use of this software is governed by the License,
|
||||
or, if provided, by the license below or the license accompanying this file. Do not
|
||||
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
"""
|
||||
|
||||
"""
|
||||
C24064534: The View menu options function normally
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import azlmbr.paths
|
||||
|
||||
sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
|
||||
from automatedtesting_shared.editor_test_helper import EditorTestHelper
|
||||
import automatedtesting_shared.pyside_utils as pyside_utils
|
||||
|
||||
|
||||
class TestViewMenuOptions(EditorTestHelper):
|
||||
def __init__(self):
|
||||
EditorTestHelper.__init__(self, log_prefix="Menus_EditMenuOptions", args=["level"])
|
||||
|
||||
def run_test(self):
|
||||
"""
|
||||
Summary:
|
||||
Interact with View Menu options and verify if all the options are working.
|
||||
|
||||
Expected Behavior:
|
||||
The View menu functions normally.
|
||||
|
||||
Test Steps:
|
||||
1) Create a temp level
|
||||
2) Interact with View Menu options
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Lumberyard 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
|
||||
"""
|
||||
view_menu_options = [
|
||||
("Center on Selection",),
|
||||
("Show Quick Access Bar",),
|
||||
("Viewport", "Wireframe"),
|
||||
("Viewport", "Grid Settings"),
|
||||
("Viewport", "Go to Position"),
|
||||
("Viewport", "Center on Selection"),
|
||||
("Viewport", "Go to Location"),
|
||||
("Viewport", "Remember Location"),
|
||||
("Viewport", "Change Move Speed"),
|
||||
("Viewport", "Switch Camera"),
|
||||
("Viewport", "Show/Hide Helpers"),
|
||||
("Refresh Style",),
|
||||
]
|
||||
|
||||
# 1) Create and open the temp level
|
||||
self.test_success = self.create_level(
|
||||
self.args["level"],
|
||||
heightmap_resolution=1024,
|
||||
heightmap_meters_per_pixel=1,
|
||||
terrain_texture_resolution=4096,
|
||||
use_terrain=False,
|
||||
)
|
||||
|
||||
def on_action_triggered(action_name):
|
||||
print(f"{action_name} Action triggered")
|
||||
|
||||
# 2) Interact with View Menu options
|
||||
try:
|
||||
editor_window = pyside_utils.get_editor_main_window()
|
||||
for option in view_menu_options:
|
||||
action = pyside_utils.get_action_for_menu_path(editor_window, "View", *option)
|
||||
trig_func = lambda: on_action_triggered(action.iconText())
|
||||
action.triggered.connect(trig_func)
|
||||
action.trigger()
|
||||
action.triggered.disconnect(trig_func)
|
||||
except Exception as e:
|
||||
self.test_success = False
|
||||
print(e)
|
||||
|
||||
|
||||
test = TestViewMenuOptions()
|
||||
test.run()
|
||||
Reference in New Issue
Block a user