Gradient Signal automation optimizations with TestAutomationBase/parallelization (#3316)
* GradientSignal automation optimizations with TestAutomationBase/parallelization * Changing Gradient Signal test registration to use TestAutomationBase Signed-off-by: jckand-amzn <jckand@amazon.com>
This commit is contained in:
@@ -157,7 +157,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS AND PAL_TRAIT_
|
||||
NAME AutomatedTesting::GradientSignalTests_Periodic
|
||||
TEST_SERIAL
|
||||
TEST_SUITE periodic
|
||||
PATH ${CMAKE_CURRENT_LIST_DIR}/gradient_signal
|
||||
PATH ${CMAKE_CURRENT_LIST_DIR}/gradient_signal/test_GradientSignal_Periodic.py
|
||||
RUNTIME_DEPENDENCIES
|
||||
AZ::AssetProcessor
|
||||
Legacy::Editor
|
||||
|
||||
+96
-102
@@ -4,124 +4,118 @@ For complete copyright and license terms please see the LICENSE at the root of t
|
||||
|
||||
SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
|
||||
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'))
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.editor_test_helper import EditorTestHelper
|
||||
|
||||
|
||||
class TestGradientGeneratorIncompatibilities(EditorTestHelper):
|
||||
def __init__(self):
|
||||
EditorTestHelper.__init__(self, log_prefix="GradientGeneratorIncompatibilities", args=["level"])
|
||||
def GradientGenerators_Incompatibilities():
|
||||
"""
|
||||
Summary:
|
||||
This test verifies that components are disabled when conflicting components are present on the same entity.
|
||||
|
||||
def run_test(self):
|
||||
"""
|
||||
Summary:
|
||||
This test verifies that components are disabled when conflicting components are present on the same entity.
|
||||
Expected Behavior:
|
||||
Gradient Generator components are incompatible with Vegetation area components.
|
||||
|
||||
Expected Behavior:
|
||||
Gradient Generator components are incompatible with Vegetation area components.
|
||||
Test Steps:
|
||||
1) Open a simple level
|
||||
2) Create a new entity in the level
|
||||
3) Add each Gradient Generator component to an entity, and add a Vegetation Area component to the same entity
|
||||
4) Verify that components are only enabled when entity is free of a conflicting component
|
||||
|
||||
Test Steps:
|
||||
1) Create a new level
|
||||
2) Create a new entity in the level
|
||||
3) Add each Gradient Generator component to an entity, and add a Vegetation Area component to the same entity
|
||||
4) Verify that components are only enabled when entity is free of a conflicting component
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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.
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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
|
||||
"""
|
||||
|
||||
:return: None
|
||||
"""
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.editor as editor
|
||||
import azlmbr.entity as entity
|
||||
|
||||
gradient_generators = [
|
||||
'Altitude Gradient',
|
||||
'Constant Gradient',
|
||||
'FastNoise Gradient',
|
||||
'Image Gradient',
|
||||
'Perlin Noise Gradient',
|
||||
'Random Noise Gradient',
|
||||
'Shape Falloff Gradient',
|
||||
'Slope Gradient',
|
||||
'Surface Mask Gradient'
|
||||
]
|
||||
require_transform_modifiers = [
|
||||
'FastNoise Gradient',
|
||||
'Image Gradient',
|
||||
'Perlin Noise Gradient',
|
||||
'Random Noise Gradient'
|
||||
]
|
||||
vegetation_areas = [
|
||||
'Vegetation Layer Spawner',
|
||||
'Vegetation Layer Blender',
|
||||
'Vegetation Layer Blocker',
|
||||
'Vegetation Layer Blocker (Mesh)'
|
||||
]
|
||||
area_dependencies = {
|
||||
'Vegetation Layer Spawner': 'Vegetation Asset List',
|
||||
'Vegetation Layer Blocker (Mesh)': 'Mesh'
|
||||
}
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
|
||||
# Create a new empty 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,
|
||||
)
|
||||
gradient_generators = [
|
||||
'Altitude Gradient',
|
||||
'Constant Gradient',
|
||||
'FastNoise Gradient',
|
||||
'Image Gradient',
|
||||
'Perlin Noise Gradient',
|
||||
'Random Noise Gradient',
|
||||
'Shape Falloff Gradient',
|
||||
'Slope Gradient',
|
||||
'Surface Mask Gradient'
|
||||
]
|
||||
require_transform_modifiers = [
|
||||
'FastNoise Gradient',
|
||||
'Image Gradient',
|
||||
'Perlin Noise Gradient',
|
||||
'Random Noise Gradient'
|
||||
]
|
||||
vegetation_areas = [
|
||||
'Vegetation Layer Spawner',
|
||||
'Vegetation Layer Blender',
|
||||
'Vegetation Layer Blocker',
|
||||
'Vegetation Layer Blocker (Mesh)'
|
||||
]
|
||||
area_dependencies = {
|
||||
'Vegetation Layer Spawner': 'Vegetation Asset List',
|
||||
'Vegetation Layer Blocker (Mesh)': 'Mesh'
|
||||
}
|
||||
|
||||
# For every gradient generator component, verify that they are incompatible
|
||||
# which each vegetation area component
|
||||
for component_name in gradient_generators:
|
||||
for vegetation_area_name in vegetation_areas:
|
||||
# Create a new Entity in the level
|
||||
entity_id = editor.ToolsApplicationRequestBus(bus.Broadcast, 'CreateNewEntity', entity.EntityId())
|
||||
# Open an existing simple level
|
||||
helper.init_idle()
|
||||
helper.open_level("Physics", "Base")
|
||||
|
||||
# Most of these need a shape, so use a Box Shape
|
||||
hydra.add_component('Box Shape', entity_id)
|
||||
# For every gradient generator component, verify that they are incompatible
|
||||
# which each vegetation area component
|
||||
for component_name in gradient_generators:
|
||||
for vegetation_area_name in vegetation_areas:
|
||||
# Create a new Entity in the level
|
||||
entity_id = editor.ToolsApplicationRequestBus(bus.Broadcast, 'CreateNewEntity', entity.EntityId())
|
||||
|
||||
# Add the specific vegetation area dependencies (if necessary)
|
||||
if vegetation_area_name in area_dependencies:
|
||||
hydra.add_component(area_dependencies[vegetation_area_name], entity_id)
|
||||
# Most of these need a shape, so use a Box Shape
|
||||
hydra.add_component('Box Shape', entity_id)
|
||||
|
||||
# Add the vegetation area component we are validating against, then add the
|
||||
# gradient generator afterwards, so that the gradient generator will actually
|
||||
# be disabled (if it was present before, it would only get deactivated instead of disabled
|
||||
# by the vegetation area)
|
||||
area_component = hydra.add_component(vegetation_area_name, entity_id)
|
||||
gradient_component = hydra.add_component(component_name, entity_id)
|
||||
# Add the specific vegetation area dependencies (if necessary)
|
||||
if vegetation_area_name in area_dependencies:
|
||||
hydra.add_component(area_dependencies[vegetation_area_name], entity_id)
|
||||
|
||||
# Verify the gradient generator component is disabled since the vegetation area is incompatible
|
||||
active = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', gradient_component)
|
||||
self.test_success = self.test_success and not active
|
||||
if not active:
|
||||
self.log(f"{component_name} is disabled before removing {vegetation_area_name} component")
|
||||
# Add the vegetation area component we are validating against, then add the
|
||||
# gradient generator afterwards, so that the gradient generator will actually
|
||||
# be disabled (if it was present before, it would only get deactivated instead of disabled
|
||||
# by the vegetation area)
|
||||
area_component = hydra.add_component(vegetation_area_name, entity_id)
|
||||
gradient_component = hydra.add_component(component_name, entity_id)
|
||||
|
||||
# Remove the vegetation area component
|
||||
editor.EditorComponentAPIBus(bus.Broadcast, 'RemoveComponents', [area_component])
|
||||
# Verify the gradient generator component is disabled since the vegetation area is incompatible
|
||||
active = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', gradient_component)
|
||||
component_is_disabled = (
|
||||
f"{component_name} is disabled before removing {vegetation_area_name} component",
|
||||
f"{component_name} is unexpectedly enabled before removing {vegetation_area_name} component"
|
||||
)
|
||||
Report.result(component_is_disabled, not active)
|
||||
|
||||
# Add required dependencies for our gradient generators after the vegetation
|
||||
# area has been removed, because the transform modifier is also incompatible
|
||||
# with the vegetation areas
|
||||
if component_name in require_transform_modifiers:
|
||||
hydra.add_component('Gradient Transform Modifier', entity_id)
|
||||
# Remove the vegetation area component
|
||||
editor.EditorComponentAPIBus(bus.Broadcast, 'RemoveComponents', [area_component])
|
||||
|
||||
# Verify the gradient generator component is enabled now that the vegetation area is gone
|
||||
active = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', gradient_component)
|
||||
self.test_success = self.test_success and active
|
||||
if active:
|
||||
self.log(f"{component_name} is enabled after removing {vegetation_area_name} component")
|
||||
# Add required dependencies for our gradient generators after the vegetation
|
||||
# area has been removed, because the transform modifier is also incompatible
|
||||
# with the vegetation areas
|
||||
if component_name in require_transform_modifiers:
|
||||
hydra.add_component('Gradient Transform Modifier', entity_id)
|
||||
|
||||
# Verify the gradient generator component is enabled now that the vegetation area is gone
|
||||
active = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', gradient_component)
|
||||
component_is_enabled = (
|
||||
f"{component_name} is enabled after removing {vegetation_area_name} component",
|
||||
f"{component_name} is unexpectedly disabled after removing {vegetation_area_name} component"
|
||||
)
|
||||
Report.result(component_is_enabled, active)
|
||||
|
||||
|
||||
test = TestGradientGeneratorIncompatibilities()
|
||||
test.run()
|
||||
if __name__ == "__main__":
|
||||
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(GradientGenerators_Incompatibilities)
|
||||
|
||||
+133
-135
@@ -4,164 +4,162 @@ For complete copyright and license terms please see the LICENSE at the root of t
|
||||
|
||||
SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
|
||||
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'))
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.editor_test_helper import EditorTestHelper
|
||||
|
||||
|
||||
class TestGradientModifiersIncompatibilities(EditorTestHelper):
|
||||
def __init__(self):
|
||||
EditorTestHelper.__init__(self, log_prefix="GradientModifiersIncompatibilities", args=["level"])
|
||||
def GradientModifiers_Incompatibilities():
|
||||
"""
|
||||
Summary:
|
||||
This test verifies that components are disabled when conflicting components are present on the same entity.
|
||||
|
||||
def run_test(self):
|
||||
"""
|
||||
Summary:
|
||||
This test verifies that components are disabled when conflicting components are present on the same entity.
|
||||
Expected Behavior:
|
||||
Gradient Modifier components are incompatible with Vegetation area components.
|
||||
|
||||
Expected Behavior:
|
||||
Gradient Modifier components are incompatible with Vegetation area components.
|
||||
Test Steps:
|
||||
1) Open a simple level
|
||||
2) Create a new entity in the level
|
||||
3) Add each Gradient Modifier component to an entity, and add a Vegetation Area component to the same entity
|
||||
4) Verify that components are only enabled when entity is free of a conflicting component
|
||||
|
||||
Test Steps:
|
||||
1) Create a new level
|
||||
2) Create a new entity in the level
|
||||
3) Add each Gradient Modifier component to an entity, and add a Vegetation Area component to the same entity
|
||||
4) Verify that components are only enabled when entity is free of a conflicting component
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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.
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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
|
||||
"""
|
||||
|
||||
:return: None
|
||||
"""
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.editor as editor
|
||||
import azlmbr.entity as entity
|
||||
|
||||
gradient_generators = [
|
||||
'Altitude Gradient',
|
||||
'Constant Gradient',
|
||||
'FastNoise Gradient',
|
||||
'Image Gradient',
|
||||
'Perlin Noise Gradient',
|
||||
'Random Noise Gradient',
|
||||
'Shape Falloff Gradient',
|
||||
'Slope Gradient',
|
||||
'Surface Mask Gradient'
|
||||
]
|
||||
require_transform_modifiers = [
|
||||
'FastNoise Gradient',
|
||||
'Image Gradient',
|
||||
'Perlin Noise Gradient',
|
||||
'Random Noise Gradient'
|
||||
]
|
||||
gradient_modifiers = [
|
||||
'Dither Gradient Modifier',
|
||||
'Gradient Mixer',
|
||||
'Invert Gradient Modifier',
|
||||
'Levels Gradient Modifier',
|
||||
'Posterize Gradient Modifier',
|
||||
'Smooth-Step Gradient Modifier',
|
||||
'Threshold Gradient Modifier'
|
||||
]
|
||||
vegetation_areas = [
|
||||
'Vegetation Layer Spawner',
|
||||
'Vegetation Layer Blender',
|
||||
'Vegetation Layer Blocker',
|
||||
'Vegetation Layer Blocker (Mesh)'
|
||||
]
|
||||
area_dependencies = {
|
||||
'Vegetation Layer Spawner': 'Vegetation Asset List',
|
||||
'Vegetation Layer Blocker (Mesh)': 'Mesh'
|
||||
}
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
|
||||
# Create a new empty 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,
|
||||
)
|
||||
gradient_generators = [
|
||||
'Altitude Gradient',
|
||||
'Constant Gradient',
|
||||
'FastNoise Gradient',
|
||||
'Image Gradient',
|
||||
'Perlin Noise Gradient',
|
||||
'Random Noise Gradient',
|
||||
'Shape Falloff Gradient',
|
||||
'Slope Gradient',
|
||||
'Surface Mask Gradient'
|
||||
]
|
||||
require_transform_modifiers = [
|
||||
'FastNoise Gradient',
|
||||
'Image Gradient',
|
||||
'Perlin Noise Gradient',
|
||||
'Random Noise Gradient'
|
||||
]
|
||||
gradient_modifiers = [
|
||||
'Dither Gradient Modifier',
|
||||
'Gradient Mixer',
|
||||
'Invert Gradient Modifier',
|
||||
'Levels Gradient Modifier',
|
||||
'Posterize Gradient Modifier',
|
||||
'Smooth-Step Gradient Modifier',
|
||||
'Threshold Gradient Modifier'
|
||||
]
|
||||
vegetation_areas = [
|
||||
'Vegetation Layer Spawner',
|
||||
'Vegetation Layer Blender',
|
||||
'Vegetation Layer Blocker',
|
||||
'Vegetation Layer Blocker (Mesh)'
|
||||
]
|
||||
area_dependencies = {
|
||||
'Vegetation Layer Spawner': 'Vegetation Asset List',
|
||||
'Vegetation Layer Blocker (Mesh)': 'Mesh'
|
||||
}
|
||||
|
||||
# For every gradient modifier component, verify that they are incompatible
|
||||
# which each vegetation area and gradient generator/modifier component
|
||||
all_gradients = gradient_modifiers + gradient_generators
|
||||
for component_name in gradient_modifiers:
|
||||
for vegetation_area_name in vegetation_areas:
|
||||
# Create a new Entity in the level
|
||||
entity_id = editor.ToolsApplicationRequestBus(bus.Broadcast, 'CreateNewEntity', entity.EntityId())
|
||||
# Open an existing simple level
|
||||
helper.init_idle()
|
||||
helper.open_level("Physics", "Base")
|
||||
|
||||
# Most of these need a shape, so use a Box Shape
|
||||
hydra.add_component('Box Shape', entity_id)
|
||||
# For every gradient modifier component, verify that they are incompatible
|
||||
# which each vegetation area and gradient generator/modifier component
|
||||
all_gradients = gradient_modifiers + gradient_generators
|
||||
for component_name in gradient_modifiers:
|
||||
for vegetation_area_name in vegetation_areas:
|
||||
# Create a new Entity in the level
|
||||
entity_id = editor.ToolsApplicationRequestBus(bus.Broadcast, 'CreateNewEntity', entity.EntityId())
|
||||
|
||||
# Add the specific vegetation area dependencies (if necessary)
|
||||
if vegetation_area_name in area_dependencies:
|
||||
hydra.add_component(area_dependencies[vegetation_area_name], entity_id)
|
||||
# Most of these need a shape, so use a Box Shape
|
||||
hydra.add_component('Box Shape', entity_id)
|
||||
|
||||
# Add the vegetation area component we are validating against, then add the
|
||||
# gradient modifier afterwards, so that the gradient modifier will actually
|
||||
# be disabled (if it was present before, it would only get deactivated instead of disabled
|
||||
# by the vegetation area)
|
||||
area_component = hydra.add_component(vegetation_area_name, entity_id)
|
||||
gradient_component = hydra.add_component(component_name, entity_id)
|
||||
# Add the specific vegetation area dependencies (if necessary)
|
||||
if vegetation_area_name in area_dependencies:
|
||||
hydra.add_component(area_dependencies[vegetation_area_name], entity_id)
|
||||
|
||||
# Verify the gradient modifier component is disabled since the vegetation area is incompatible
|
||||
active = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', gradient_component)
|
||||
self.test_success = self.test_success and not active
|
||||
if not active:
|
||||
self.log("{gradient} is disabled before removing {vegetation_area} component".format(gradient=component_name, vegetation_area=vegetation_area_name))
|
||||
# Add the vegetation area component we are validating against, then add the
|
||||
# gradient modifier afterwards, so that the gradient modifier will actually
|
||||
# be disabled (if it was present before, it would only get deactivated instead of disabled
|
||||
# by the vegetation area)
|
||||
area_component = hydra.add_component(vegetation_area_name, entity_id)
|
||||
gradient_component = hydra.add_component(component_name, entity_id)
|
||||
|
||||
# Remove the vegetation area component
|
||||
editor.EditorComponentAPIBus(bus.Broadcast, 'RemoveComponents', [area_component])
|
||||
# Verify the gradient modifier component is disabled since the vegetation area is incompatible
|
||||
active = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', gradient_component)
|
||||
component_is_disabled = (
|
||||
f"{component_name} is disabled before removing {vegetation_area_name} component",
|
||||
f"{component_name} is unexpectedly enabled before removing {vegetation_area_name} component"
|
||||
)
|
||||
Report.result(component_is_disabled, not active)
|
||||
|
||||
# Verify the gradient modifier component is enabled now that the vegetation area is gone
|
||||
active = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', gradient_component)
|
||||
self.test_success = self.test_success and active
|
||||
if active:
|
||||
self.log("{gradient} is enabled after removing {vegetation_area} component".format(gradient=component_name, vegetation_area=vegetation_area_name))
|
||||
# Remove the vegetation area component
|
||||
editor.EditorComponentAPIBus(bus.Broadcast, 'RemoveComponents', [area_component])
|
||||
|
||||
for gradient_name in all_gradients:
|
||||
# Create a new Entity in the level
|
||||
entity_id = editor.ToolsApplicationRequestBus(bus.Broadcast, 'CreateNewEntity', entity.EntityId())
|
||||
# Verify the gradient modifier component is enabled now that the vegetation area is gone
|
||||
active = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', gradient_component)
|
||||
component_is_enabled = (
|
||||
f"{component_name} is enabled after removing {vegetation_area_name} component",
|
||||
f"{component_name} is unexpectedly disabled after removing {vegetation_area_name} component"
|
||||
)
|
||||
Report.result(component_is_enabled, active)
|
||||
|
||||
# Most of these need a shape, so use a Box Shape
|
||||
hydra.add_component('Box Shape', entity_id)
|
||||
for gradient_name in all_gradients:
|
||||
# Create a new Entity in the level
|
||||
entity_id = editor.ToolsApplicationRequestBus(bus.Broadcast, 'CreateNewEntity', entity.EntityId())
|
||||
|
||||
# Add the specific gradient generator dependencies (if necessary)
|
||||
conflicting_components = []
|
||||
if gradient_name in require_transform_modifiers:
|
||||
component = hydra.add_component('Gradient Transform Modifier', entity_id)
|
||||
conflicting_components.append(component)
|
||||
# Most of these need a shape, so use a Box Shape
|
||||
hydra.add_component('Box Shape', entity_id)
|
||||
|
||||
# Add the gradient component we are validating against, then add the
|
||||
# gradient modifier afterwards, so that the gradient modifier will actually
|
||||
# be disabled (if it was present before, it would only get deactivated instead of disabled
|
||||
# by the other gradient)
|
||||
component = hydra.add_component(gradient_name, entity_id)
|
||||
# Add the specific gradient generator dependencies (if necessary)
|
||||
conflicting_components = []
|
||||
if gradient_name in require_transform_modifiers:
|
||||
component = hydra.add_component('Gradient Transform Modifier', entity_id)
|
||||
conflicting_components.append(component)
|
||||
gradient_component = hydra.add_component(component_name, entity_id)
|
||||
|
||||
# Verify the gradient modifier component is disabled since the other gradient is incompatible
|
||||
active = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', gradient_component)
|
||||
self.test_success = self.test_success and not active
|
||||
if not active:
|
||||
self.log("{gradient} is disabled before removing {conflicting_gradient} component".format(gradient=component_name, conflicting_gradient=gradient_name))
|
||||
# Add the gradient component we are validating against, then add the
|
||||
# gradient modifier afterwards, so that the gradient modifier will actually
|
||||
# be disabled (if it was present before, it would only get deactivated instead of disabled
|
||||
# by the other gradient)
|
||||
component = hydra.add_component(gradient_name, entity_id)
|
||||
conflicting_components.append(component)
|
||||
gradient_component = hydra.add_component(component_name, entity_id)
|
||||
|
||||
# Remove the conflicting gradient component (and transform modifier if it was added)
|
||||
editor.EditorComponentAPIBus(bus.Broadcast, 'RemoveComponents', conflicting_components)
|
||||
# Verify the gradient modifier component is disabled since the other gradient is incompatible
|
||||
active = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', gradient_component)
|
||||
component_is_disabled = (
|
||||
f"{component_name} is disabled before removing {gradient_name} component",
|
||||
f"{component_name} is unexpectedly enabled before removing {gradient_name} component"
|
||||
)
|
||||
Report.result(component_is_disabled, not active)
|
||||
|
||||
# Verify the gradient modifier component is enabled now that the other gradient is gone
|
||||
active = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', gradient_component)
|
||||
self.test_success = self.test_success and active
|
||||
if active:
|
||||
self.log("{gradient} is enabled after removing {conflicting_gradient} component".format(gradient=component_name, conflicting_gradient=gradient_name))
|
||||
# Remove the conflicting gradient component (and transform modifier if it was added)
|
||||
editor.EditorComponentAPIBus(bus.Broadcast, 'RemoveComponents', conflicting_components)
|
||||
|
||||
# Verify the gradient modifier component is enabled now that the other gradient is gone
|
||||
active = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', gradient_component)
|
||||
component_is_enabled = (
|
||||
f"{component_name} is enabled after removing {gradient_name} component",
|
||||
f"{component_name} is unexpectedly disabled after removing {gradient_name} component"
|
||||
)
|
||||
Report.result(component_is_enabled, active)
|
||||
|
||||
|
||||
test = TestGradientModifiersIncompatibilities()
|
||||
test.run()
|
||||
if __name__ == "__main__":
|
||||
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(GradientModifiers_Incompatibilities)
|
||||
|
||||
+98
-102
@@ -5,129 +5,125 @@ For complete copyright and license terms please see the LICENSE at the root of t
|
||||
SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.editor as editor
|
||||
import azlmbr.math as math
|
||||
import azlmbr.paths
|
||||
import azlmbr.entity as EntityId
|
||||
def GradientPreviewSettings_ClearingPinnedEntitySetsPreviewToOrigin():
|
||||
"""
|
||||
Summary:
|
||||
A temporary level is created. An entity for each test case is created and added with the corresponding
|
||||
components to verify if the gradient transform is set to the world origin.
|
||||
|
||||
sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.editor_test_helper import EditorTestHelper
|
||||
Expected Behavior:
|
||||
1) Preview image updates to reflect change in transform of the gradient sampler.
|
||||
2) New Preview Position property is exposed, and set to 0,0,0 (world origin).
|
||||
3) Preview Size is set to 1,1,1 by default.
|
||||
|
||||
Test Steps:
|
||||
1) Open level
|
||||
2) Create entity with Random Noise gradient and verify gradient position after clearing pinned entity
|
||||
3) Create entity with Levels Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
4) Create entity with Posterize Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
5) Create entity with Smooth-Step Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
6) Create entity with Threshold Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
7) Create entity with FastNoise Gradient and verify gradient position after clearing pinned entity
|
||||
8) Create entity with Dither Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
9) Create entity with Invert Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
10) Create entity with Perlin Noise Gradient and verify gradient position after clearing pinned entity
|
||||
|
||||
class TestGradientPreviewSettings(EditorTestHelper):
|
||||
def __init__(self):
|
||||
EditorTestHelper.__init__(self, log_prefix="GradientPreviewSettings_ClearPinnedEntity", args=["level"])
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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.
|
||||
|
||||
def run_test(self):
|
||||
"""
|
||||
Summary:
|
||||
A temporary level is created. An entity for each test case is created and added with the corresponding
|
||||
components to verify if the gradient transform is set to the world origin.
|
||||
:return: None
|
||||
"""
|
||||
|
||||
Expected Behavior:
|
||||
1) Preview image updates to reflect change in transform of the gradient sampler.
|
||||
2) New Preview Position property is exposed, and set to 0,0,0 (world origin).
|
||||
3) Preview Size is set to 1,1,1 by default.
|
||||
import sys
|
||||
|
||||
Test Steps:
|
||||
1) Open level
|
||||
2) Create entity with Random Noise gradient and verify gradient position after clearing pinned entity
|
||||
3) Create entity with Levels Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
4) Create entity with Posterize Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
5) Create entity with Smooth-Step Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
6) Create entity with Threshold Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
7) Create entity with FastNoise Gradient and verify gradient position after clearing pinned entity
|
||||
8) Create entity with Dither Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
9) Create entity with Invert Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
10) Create entity with Perlin Noise Gradient and verify gradient position after clearing pinned entity
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.editor as editor
|
||||
import azlmbr.math as math
|
||||
import azlmbr.entity as EntityId
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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.
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
|
||||
:return: None
|
||||
"""
|
||||
WORLD_ORIGIN = math.Vector3(0.0, 0.0, 0.0)
|
||||
EXPECTED_SIZE = math.Vector3(1.0, 1.0, 1.0)
|
||||
CLOSE_THRESHOLD = sys.float_info.min
|
||||
|
||||
WORLD_ORIGIN = math.Vector3(0.0, 0.0, 0.0)
|
||||
EXPECTED_SIZE = math.Vector3(1.0, 1.0, 1.0)
|
||||
CLOSE_THRESHOLD = sys.float_info.min
|
||||
def create_entity(entity_name, components_to_add):
|
||||
entity_position = math.Vector3(125.0, 136.0, 32.0)
|
||||
entity_id = editor.ToolsApplicationRequestBus(
|
||||
bus.Broadcast, "CreateNewEntityAtPosition", entity_position, EntityId.EntityId()
|
||||
)
|
||||
entity = hydra.Entity(entity_name, entity_id)
|
||||
if entity_id.IsValid():
|
||||
print(f"{entity_name} entity Created")
|
||||
entity.components = []
|
||||
for component in components_to_add:
|
||||
entity.components.append(hydra.add_component(component, entity_id))
|
||||
return entity
|
||||
|
||||
def create_entity(enity_name, components_to_add):
|
||||
entity_position = math.Vector3(125.0, 136.0, 32.0)
|
||||
entity_id = editor.ToolsApplicationRequestBus(
|
||||
bus.Broadcast, "CreateNewEntityAtPosition", entity_position, EntityId.EntityId()
|
||||
def clear_entityid_check_position(entity_name, components_to_add, check_preview_size=False):
|
||||
entity = create_entity(entity_name, components_to_add)
|
||||
hydra.get_set_test(entity, 0, "Preview Settings|Pin Preview to Shape", EntityId.EntityId())
|
||||
preview_position = hydra.get_component_property_value(
|
||||
entity.components[0], "Preview Settings|Preview Position"
|
||||
)
|
||||
preview_set_to_origin = (
|
||||
f"{entity_name}: Preview Position set to world origin",
|
||||
f"{entity_name}: Preview Position set to unexpected coords"
|
||||
)
|
||||
Report.result(preview_set_to_origin, preview_position.IsClose(WORLD_ORIGIN, CLOSE_THRESHOLD))
|
||||
if check_preview_size:
|
||||
preview_size = hydra.get_component_property_value(entity.components[0], "Preview Settings|Preview Size")
|
||||
preview_size_default_set = (
|
||||
f"{entity_name}: Preview Size set as expected",
|
||||
f"{entity_name}: Preview Size set to unexpected value. Expected {EXPECTED_SIZE}, Found {preview_size}"
|
||||
)
|
||||
entity = hydra.Entity(enity_name, entity_id)
|
||||
if entity_id.IsValid():
|
||||
print(f"{enity_name} entity Created")
|
||||
entity.components = []
|
||||
for component in components_to_add:
|
||||
entity.components.append(hydra.add_component(component, entity_id))
|
||||
return entity
|
||||
Report.result(preview_size_default_set, preview_size.IsClose(EXPECTED_SIZE, CLOSE_THRESHOLD))
|
||||
return entity
|
||||
|
||||
def clear_entityid_check_position(entity_name, components_to_add, check_preview_size=False):
|
||||
entity = create_entity(entity_name, components_to_add)
|
||||
hydra.get_set_test(entity, 0, "Preview Settings|Pin Preview to Shape", EntityId.EntityId())
|
||||
preview_position = hydra.get_component_property_value(
|
||||
entity.components[0], "Preview Settings|Preview Position"
|
||||
)
|
||||
if preview_position.IsClose(WORLD_ORIGIN, CLOSE_THRESHOLD):
|
||||
print(f"{entity_name} --- Preview Position set to world origin")
|
||||
if check_preview_size:
|
||||
preview_size = hydra.get_component_property_value(entity.components[0], "Preview Settings|Preview Size")
|
||||
if preview_size.IsClose(EXPECTED_SIZE, CLOSE_THRESHOLD):
|
||||
print(f"{entity_name} --- Preview Size set to (1, 1, 1)")
|
||||
return entity
|
||||
# 1) Open an existing simple level
|
||||
helper.init_idle()
|
||||
helper.open_level("Physics", "Base")
|
||||
|
||||
# 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,
|
||||
)
|
||||
# 2) Create entity with Random Noise gradient and verify gradient position after clearing pinned entity
|
||||
clear_entityid_check_position(
|
||||
"Random Noise Gradient", ["Random Noise Gradient", "Gradient Transform Modifier", "Box Shape"], True
|
||||
)
|
||||
|
||||
# 2) Create entity with Random Noise gradient and verify gradient position after clearing pinned entity
|
||||
clear_entityid_check_position(
|
||||
"Random Noise Gradient", ["Random Noise Gradient", "Gradient Transform Modifier", "Box Shape"], True
|
||||
)
|
||||
# 3) Create entity with Levels Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
clear_entityid_check_position("Levels Gradient Modifier", ["Levels Gradient Modifier"])
|
||||
|
||||
# 3) Create entity with Levels Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
clear_entityid_check_position("Levels Gradient Modifier", ["Levels Gradient Modifier"])
|
||||
# 4) Create entity with Posterize Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
clear_entityid_check_position("Posterize Gradient Modifier", ["Posterize Gradient Modifier"])
|
||||
|
||||
# 4) Create entity with Posterize Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
clear_entityid_check_position("Posterize Gradient Modifier", ["Posterize Gradient Modifier"])
|
||||
# 5) Create entity with Smooth-Step Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
clear_entityid_check_position("Smooth-Step Gradient Modifier", ["Smooth-Step Gradient Modifier"])
|
||||
|
||||
# 5) Create entity with Smooth-Step Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
clear_entityid_check_position("Smooth-Step Gradient Modifier", ["Smooth-Step Gradient Modifier"])
|
||||
# 6) Create entity with Threshold Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
clear_entityid_check_position("Threshold Gradient Modifier", ["Threshold Gradient Modifier"])
|
||||
|
||||
# 6) Create entity with Threshold Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
clear_entityid_check_position("Threshold Gradient Modifier", ["Threshold Gradient Modifier"])
|
||||
# 7) Create entity with FastNoise Gradient and verify gradient position after clearing pinned entity
|
||||
clear_entityid_check_position(
|
||||
"FastNoise Gradient", ["FastNoise Gradient", "Gradient Transform Modifier", "Box Shape"], True
|
||||
)
|
||||
|
||||
# 7) Create entity with FastNoise Gradient and verify gradient position after clearing pinned entity
|
||||
clear_entityid_check_position(
|
||||
"FastNoise Gradient", ["FastNoise Gradient", "Gradient Transform Modifier", "Box Shape"], True
|
||||
)
|
||||
# 8) Create entity with Dither Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
clear_entityid_check_position("Dither Gradient Modifier", ["Dither Gradient Modifier"], True)
|
||||
|
||||
# 8) Create entity with Dither Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
clear_entityid_check_position("Dither Gradient Modifier", ["Dither Gradient Modifier"], True)
|
||||
# 9) Create entity with Invert Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
clear_entityid_check_position("Invert Gradient Modifier", ["Invert Gradient Modifier"])
|
||||
|
||||
# 9) Create entity with Invert Gradient Modifier and verify gradient position after clearing pinned entity
|
||||
clear_entityid_check_position("Invert Gradient Modifier", ["Invert Gradient Modifier"])
|
||||
|
||||
# 10) Create entity with Perlin Noise Gradient and verify gradient position after clearing pinned entity
|
||||
clear_entityid_check_position(
|
||||
"Perlin Noise Gradient", ["Perlin Noise Gradient", "Gradient Transform Modifier", "Box Shape"], True
|
||||
)
|
||||
# 10) Create entity with Perlin Noise Gradient and verify gradient position after clearing pinned entity
|
||||
clear_entityid_check_position(
|
||||
"Perlin Noise Gradient", ["Perlin Noise Gradient", "Gradient Transform Modifier", "Box Shape"], True
|
||||
)
|
||||
|
||||
|
||||
test = TestGradientPreviewSettings()
|
||||
test.run()
|
||||
if __name__ == "__main__":
|
||||
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(GradientPreviewSettings_ClearingPinnedEntitySetsPreviewToOrigin)
|
||||
|
||||
+70
-79
@@ -5,18 +5,6 @@ For complete copyright and license terms please see the LICENSE at the root of t
|
||||
SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
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'))
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.editor_test_helper import EditorTestHelper
|
||||
|
||||
|
||||
class Scoped:
|
||||
def __init__(self, constructor, destructor, *args):
|
||||
@@ -33,81 +21,84 @@ class TestParams:
|
||||
self.accessed_component = accessed_component
|
||||
|
||||
|
||||
class TestGradientPreviewSettings(EditorTestHelper):
|
||||
def __init__(self):
|
||||
EditorTestHelper.__init__(self, log_prefix="GradientPreviewSettings_DefaultPinnedEntity", args=["level"])
|
||||
def GradientPreviewSettings_DefaultPinnedEntityIsSelf():
|
||||
"""
|
||||
Summary:
|
||||
This test verifies default values for the pinned entity for Gradient Preview settings.
|
||||
|
||||
def run_test(self):
|
||||
"""
|
||||
Summary:
|
||||
This test verifies default values for the pinned entity for Gradient Preview settings.
|
||||
Expected Behavior:
|
||||
Pinned entity is self for all gradient generator/modifiers.
|
||||
|
||||
Expected Behavior:
|
||||
Pinned entity is self for all gradient generator/modifiers.
|
||||
Test Steps:
|
||||
1) Open a simple level
|
||||
2) Create a new entity in the level
|
||||
3) Add each Gradient Generator component to an entity, and verify the Pin Preview to Shape property is set to
|
||||
self
|
||||
|
||||
Test Steps:
|
||||
1) Create a new level
|
||||
2) Create a new entity in the level
|
||||
3) Add each Gradient Generator component to an entity, and verify the Pin Preview to Shape property is set to
|
||||
self
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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.
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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
|
||||
"""
|
||||
|
||||
:return: None
|
||||
"""
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.editor as editor
|
||||
import azlmbr.entity as entity
|
||||
|
||||
def execute_test(test_id, function, *args):
|
||||
if function(*args):
|
||||
self.log(test_id + ' has Preview pinned to own Entity result: SUCCESS')
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
|
||||
def create_entity():
|
||||
return editor.ToolsApplicationRequestBus(bus.Broadcast, 'CreateNewEntity', entity.EntityId())
|
||||
|
||||
def delete_entity(entity_id):
|
||||
editor.ToolsApplicationRequestBus(bus.Broadcast, 'DeleteEntityAndAllDescendants', entity_id)
|
||||
|
||||
def attach_components(component_list, entity_id):
|
||||
components = []
|
||||
for i in component_list:
|
||||
components.append(hydra.add_component(i, entity_id))
|
||||
return components
|
||||
|
||||
def validate_id_is_current(param):
|
||||
entity_ptr = Scoped(create_entity, delete_entity)
|
||||
added_components = attach_components(param.required_components, entity_ptr.data)
|
||||
value = hydra.get_component_property_value(added_components[param.accessed_component],
|
||||
'Preview Settings|Pin Preview to Shape')
|
||||
self.test_success = self.test_success and entity_ptr.data.Equal(value)
|
||||
return entity_ptr.data.Equal(value)
|
||||
|
||||
param_list = [
|
||||
TestParams(['Gradient Transform Modifier', 'Box Shape', 'Perlin Noise Gradient'], 2),
|
||||
TestParams(['Random Noise Gradient', 'Gradient Transform Modifier', 'Box Shape'], 0),
|
||||
TestParams(['FastNoise Gradient', 'Gradient Transform Modifier', 'Box Shape'], 0),
|
||||
TestParams(['Dither Gradient Modifier'], 0),
|
||||
TestParams(['Invert Gradient Modifier'], 0),
|
||||
TestParams(['Levels Gradient Modifier'], 0),
|
||||
TestParams(['Posterize Gradient Modifier'], 0),
|
||||
TestParams(['Smooth-Step Gradient Modifier'], 0),
|
||||
TestParams(['Threshold Gradient Modifier'], 0)
|
||||
]
|
||||
|
||||
# Create a new empty 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 execute_test(test_id, function, *args):
|
||||
pinned_to_self = (
|
||||
f"{test_id} has Preview pinned to self",
|
||||
f"{test_id} has Preview pinned to a different entity"
|
||||
)
|
||||
Report.result(pinned_to_self, function(*args))
|
||||
|
||||
for param in param_list:
|
||||
execute_test(param.required_components[param.accessed_component],
|
||||
validate_id_is_current, param)
|
||||
def create_entity():
|
||||
return editor.ToolsApplicationRequestBus(bus.Broadcast, 'CreateNewEntity', entity.EntityId())
|
||||
|
||||
def delete_entity(entity_id):
|
||||
editor.ToolsApplicationRequestBus(bus.Broadcast, 'DeleteEntityAndAllDescendants', entity_id)
|
||||
|
||||
def attach_components(component_list, entity_id):
|
||||
components = []
|
||||
for i in component_list:
|
||||
components.append(hydra.add_component(i, entity_id))
|
||||
return components
|
||||
|
||||
def validate_id_is_current(param):
|
||||
entity_ptr = Scoped(create_entity, delete_entity)
|
||||
added_components = attach_components(param.required_components, entity_ptr.data)
|
||||
value = hydra.get_component_property_value(added_components[param.accessed_component],
|
||||
'Preview Settings|Pin Preview to Shape')
|
||||
return entity_ptr.data.Equal(value)
|
||||
|
||||
param_list = [
|
||||
TestParams(['Gradient Transform Modifier', 'Box Shape', 'Perlin Noise Gradient'], 2),
|
||||
TestParams(['Random Noise Gradient', 'Gradient Transform Modifier', 'Box Shape'], 0),
|
||||
TestParams(['FastNoise Gradient', 'Gradient Transform Modifier', 'Box Shape'], 0),
|
||||
TestParams(['Dither Gradient Modifier'], 0),
|
||||
TestParams(['Invert Gradient Modifier'], 0),
|
||||
TestParams(['Levels Gradient Modifier'], 0),
|
||||
TestParams(['Posterize Gradient Modifier'], 0),
|
||||
TestParams(['Smooth-Step Gradient Modifier'], 0),
|
||||
TestParams(['Threshold Gradient Modifier'], 0)
|
||||
]
|
||||
|
||||
# 1) Open an existing simple level
|
||||
helper.init_idle()
|
||||
helper.open_level("Physics", "Base")
|
||||
|
||||
for param in param_list:
|
||||
execute_test(param.required_components[param.accessed_component],
|
||||
validate_id_is_current, param)
|
||||
|
||||
|
||||
test = TestGradientPreviewSettings()
|
||||
test.run()
|
||||
if __name__ == "__main__":
|
||||
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(GradientPreviewSettings_DefaultPinnedEntityIsSelf)
|
||||
|
||||
+67
-77
@@ -5,92 +5,82 @@ For complete copyright and license terms please see the LICENSE at the root of t
|
||||
SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
import azlmbr.math as math
|
||||
import azlmbr.paths
|
||||
import azlmbr.entity as EntityId
|
||||
def GradientSampling_GradientReferencesAddRemoveSuccessfully():
|
||||
"""
|
||||
Summary:
|
||||
An existing gradient generator can be pinned and cleared to/from the Gradient Entity Id field
|
||||
|
||||
sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.editor_test_helper import EditorTestHelper
|
||||
Expected Behavior:
|
||||
Gradient generator is assigned to the Gradient Entity Id field.
|
||||
Gradient generator is removed from the field.
|
||||
|
||||
Test Steps:
|
||||
1) Open level
|
||||
2) Create a new entity with components "Random Noise Gradient", "Gradient Transform Modifier" and "Box Shape"
|
||||
3) Create a new entity with Gradient Modifier's, pin and clear the random noise entity id to the Gradient Id
|
||||
field in Gradient Modifier
|
||||
|
||||
class TestGradientSampling(EditorTestHelper):
|
||||
def __init__(self):
|
||||
EditorTestHelper.__init__(self, log_prefix="GradientSampling_GradientReferences", args=["level"])
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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.
|
||||
|
||||
def run_test(self):
|
||||
"""
|
||||
Summary:
|
||||
An existing gradient generator can be pinned and cleared to/from the Gradient Entity Id field
|
||||
:return: None
|
||||
"""
|
||||
|
||||
Expected Behavior:
|
||||
Gradient generator is assigned to the Gradient Entity Id field.
|
||||
Gradient generator is removed from the field.
|
||||
import azlmbr.math as math
|
||||
import azlmbr.entity as EntityId
|
||||
|
||||
Test Steps:
|
||||
1) Open level
|
||||
2) Create a new entity with components "Random Noise Gradient", "Gradient Transform Modifier" and "Box Shape"
|
||||
3) Create a new entity with Gradient Modifier's, pin and clear the random noise entity id to the Gradient Id
|
||||
field in Gradient Modifier
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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
|
||||
"""
|
||||
|
||||
def modifier_pin_clear_to_gradiententityid(modifier):
|
||||
entity_position = math.Vector3(125.0, 136.0, 32.0)
|
||||
component_to_add = [modifier]
|
||||
gradient_modifier = hydra.Entity(modifier)
|
||||
gradient_modifier.create_entity(entity_position, component_to_add)
|
||||
gradient_modifier.get_set_test(0, "Configuration|Gradient|Gradient Entity Id", random_noise.id)
|
||||
entity = hydra.get_component_property_value(
|
||||
gradient_modifier.components[0], "Configuration|Gradient|Gradient Entity Id"
|
||||
)
|
||||
if entity.Equal(random_noise.id):
|
||||
print(f"Gradient Generator is pinned to the {modifier} successfully")
|
||||
else:
|
||||
print(f"Failed to pin Gradient Generator to the {modifier}")
|
||||
hydra.get_set_test(gradient_modifier, 0, "Configuration|Gradient|Gradient Entity Id", EntityId.EntityId())
|
||||
entity = hydra.get_component_property_value(
|
||||
gradient_modifier.components[0], "Configuration|Gradient|Gradient Entity Id"
|
||||
)
|
||||
if entity.Equal(EntityId.EntityId()):
|
||||
print(f"Gradient Generator is cleared from the {modifier} successfully")
|
||||
else:
|
||||
print(f"Failed to clear Gradient Generator from the {modifier}")
|
||||
|
||||
# 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,
|
||||
)
|
||||
|
||||
# 2) Create a new entity with components "Random Noise Gradient", "Gradient Transform Modifier" and "Box Shape"
|
||||
def modifier_pin_clear_to_gradiententityid(modifier):
|
||||
entity_position = math.Vector3(125.0, 136.0, 32.0)
|
||||
components_to_add = ["Random Noise Gradient", "Gradient Transform Modifier", "Box Shape"]
|
||||
random_noise = hydra.Entity("Random_Noise")
|
||||
random_noise.create_entity(entity_position, components_to_add)
|
||||
component_to_add = [modifier]
|
||||
gradient_modifier = hydra.Entity(modifier)
|
||||
gradient_modifier.create_entity(entity_position, component_to_add)
|
||||
gradient_modifier.get_set_test(0, "Configuration|Gradient|Gradient Entity Id", random_noise.id)
|
||||
entity = hydra.get_component_property_value(
|
||||
gradient_modifier.components[0], "Configuration|Gradient|Gradient Entity Id"
|
||||
)
|
||||
gradient_pinned_to_modifier = (
|
||||
f"Gradient Generator is pinned to the {modifier} successfully",
|
||||
f"Failed to pin Gradient Generator to the {modifier}"
|
||||
)
|
||||
Report.result(gradient_pinned_to_modifier, entity.Equal(random_noise.id))
|
||||
hydra.get_set_test(gradient_modifier, 0, "Configuration|Gradient|Gradient Entity Id", EntityId.EntityId())
|
||||
entity = hydra.get_component_property_value(
|
||||
gradient_modifier.components[0], "Configuration|Gradient|Gradient Entity Id"
|
||||
)
|
||||
gradient_cleared_from_modifier = (
|
||||
f"Gradient Generator is cleared from the {modifier} successfully",
|
||||
f"Failed to clear Gradient Generator from the {modifier}"
|
||||
)
|
||||
Report.result(gradient_cleared_from_modifier, entity.Equal(EntityId.EntityId()))
|
||||
|
||||
# 3) Create a new entity with Gradient Modifier's, pin and clear the random noise entity id to the Gradient Id
|
||||
# field in Gradient Modifier
|
||||
modifier_pin_clear_to_gradiententityid("Dither Gradient Modifier")
|
||||
modifier_pin_clear_to_gradiententityid("Invert Gradient Modifier")
|
||||
modifier_pin_clear_to_gradiententityid("Levels Gradient Modifier")
|
||||
modifier_pin_clear_to_gradiententityid("Posterize Gradient Modifier")
|
||||
modifier_pin_clear_to_gradiententityid("Smooth-Step Gradient Modifier")
|
||||
modifier_pin_clear_to_gradiententityid("Threshold Gradient Modifier")
|
||||
# 1) Open an existing simple level
|
||||
helper.init_idle()
|
||||
helper.open_level("Physics", "Base")
|
||||
|
||||
# 2) Create a new entity with components "Random Noise Gradient", "Gradient Transform Modifier" and "Box Shape"
|
||||
entity_position = math.Vector3(125.0, 136.0, 32.0)
|
||||
components_to_add = ["Random Noise Gradient", "Gradient Transform Modifier", "Box Shape"]
|
||||
random_noise = hydra.Entity("Random_Noise")
|
||||
random_noise.create_entity(entity_position, components_to_add)
|
||||
|
||||
# 3) Create a new entity with Gradient Modifier's, pin and clear the random noise entity id to the Gradient Id
|
||||
# field in Gradient Modifier
|
||||
modifier_pin_clear_to_gradiententityid("Dither Gradient Modifier")
|
||||
modifier_pin_clear_to_gradiententityid("Invert Gradient Modifier")
|
||||
modifier_pin_clear_to_gradiententityid("Levels Gradient Modifier")
|
||||
modifier_pin_clear_to_gradiententityid("Posterize Gradient Modifier")
|
||||
modifier_pin_clear_to_gradiententityid("Smooth-Step Gradient Modifier")
|
||||
modifier_pin_clear_to_gradiententityid("Threshold Gradient Modifier")
|
||||
|
||||
|
||||
test = TestGradientSampling()
|
||||
test.run()
|
||||
if __name__ == "__main__":
|
||||
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(GradientSampling_GradientReferencesAddRemoveSuccessfully)
|
||||
|
||||
+95
-105
@@ -5,114 +5,104 @@ For complete copyright and license terms please see the LICENSE at the root of t
|
||||
SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import azlmbr.math as math
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.entity as entity
|
||||
import azlmbr.paths
|
||||
import azlmbr.editor as editor
|
||||
|
||||
sys.path.append(os.path.join(azlmbr.paths.devroot, "AutomatedTesting", "Gem", "PythonTests"))
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.editor_test_helper import EditorTestHelper
|
||||
|
||||
|
||||
class TestGradientSurfaceTagEmitterDependencies(EditorTestHelper):
|
||||
def __init__(self):
|
||||
EditorTestHelper.__init__(
|
||||
self, log_prefix="GradientSurfaceTagEmitter_ComponentDependencies", args=["level"]
|
||||
def GradientSurfaceTagEmitter_ComponentDependencies():
|
||||
"""
|
||||
Summary:
|
||||
This test verifies that the Gradient Surface Tag Emitter component is dependent on a gradient component.
|
||||
|
||||
Expected Result:
|
||||
Gradient Surface Tag Emitter component is disabled until a Gradient Generator, Modifier or Gradient Reference
|
||||
component (and any sub-dependencies) is added to the entity.
|
||||
|
||||
Test Steps:
|
||||
1) Open level
|
||||
2) Create a new entity with a Gradient Surface Tag Emitter component
|
||||
3) Verify the component is disabled until a dependent component is also added to the entity
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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 azlmbr.math as math
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.entity as entity
|
||||
import azlmbr.editor as editor
|
||||
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
|
||||
def is_enabled(EntityComponentIdPair):
|
||||
return editor.EditorComponentAPIBus(bus.Broadcast, "IsComponentEnabled", EntityComponentIdPair)
|
||||
|
||||
# Open an existing simple level
|
||||
helper.init_idle()
|
||||
helper.open_level("Physics", "Base")
|
||||
|
||||
# Create an entity with Gradient Surface Tag Emitter component
|
||||
position = math.Vector3(512.0, 512.0, 32.0)
|
||||
gradient = hydra.Entity("gradient")
|
||||
gradient.create_entity(position, ["Gradient Surface Tag Emitter"])
|
||||
|
||||
# Make sure Gradient Surface Tag Emitter is disabled
|
||||
gradient_surface_tag_disabled = (
|
||||
"Gradient Surface Tag Emitter is Disabled",
|
||||
"Gradient Surface Tag Emitter is Enabled, but should be Disabled without dependencies met"
|
||||
)
|
||||
Report.result(gradient_surface_tag_disabled, not is_enabled(gradient.components[0]))
|
||||
|
||||
# Verify Gradient Surface Tag Emitter component is enabled after adding Gradient, Generator, Modifier
|
||||
# or Reference component
|
||||
new_components_to_add = [
|
||||
"Dither Gradient Modifier",
|
||||
"Gradient Mixer",
|
||||
"Invert Gradient Modifier",
|
||||
"Levels Gradient Modifier",
|
||||
"Posterize Gradient Modifier",
|
||||
"Smooth-Step Gradient Modifier",
|
||||
"Threshold Gradient Modifier",
|
||||
"Altitude Gradient",
|
||||
"Constant Gradient",
|
||||
"FastNoise Gradient",
|
||||
"Image Gradient",
|
||||
"Perlin Noise Gradient",
|
||||
"Random Noise Gradient",
|
||||
"Reference Gradient",
|
||||
"Shape Falloff Gradient",
|
||||
"Slope Gradient",
|
||||
"Surface Mask Gradient",
|
||||
]
|
||||
for component in new_components_to_add:
|
||||
component_list = ["FastNoise Gradient", "Image Gradient", "Perlin Noise Gradient", "Random Noise Gradient"]
|
||||
if component in component_list:
|
||||
for Component in ["Gradient Transform Modifier", "Box Shape"]:
|
||||
hydra.add_component(Component, gradient.id)
|
||||
typeIdsList = editor.EditorComponentAPIBus(bus.Broadcast, 'FindComponentTypeIdsByEntityType', [component],
|
||||
entity.EntityType().Game)
|
||||
ComponentOutcome = editor.EditorComponentAPIBus(bus.Broadcast, 'AddComponentsOfType', gradient.id, [typeIdsList[0]])
|
||||
Components = ComponentOutcome.GetValue()
|
||||
ComponentIdPair = Components[0]
|
||||
gradient_enabled = is_enabled(gradient.components[0])
|
||||
new_components_enabled = is_enabled(ComponentIdPair)
|
||||
dependencies_met = (
|
||||
f"{component} and Gradient Surface Tag Emitter are enabled",
|
||||
f"{component} and Gradient Surface Tag Emitter are disabled"
|
||||
)
|
||||
Report.result(dependencies_met, new_components_enabled and gradient_enabled)
|
||||
|
||||
def run_test(self):
|
||||
"""
|
||||
Summary:
|
||||
This test verifies that the Gradient Surface Tag Emitter component is dependent on a gradient component.
|
||||
|
||||
Expected Result:
|
||||
Gradient Surface Tag Emitter component is disabled until a Gradient Generator, Modifier or Gradient Reference
|
||||
component (and any sub-dependencies) is added to the entity.
|
||||
|
||||
Test Steps:
|
||||
1) Open level
|
||||
2) Create a new entity with a Gradient Surface Tag Emitter component
|
||||
3) Verify the component is disabled until a dependent component is also added to the entity
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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
|
||||
"""
|
||||
|
||||
def is_enabled(EntityComponentIdPair):
|
||||
return editor.EditorComponentAPIBus(bus.Broadcast, "IsComponentEnabled", EntityComponentIdPair)
|
||||
|
||||
# Create empty 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,
|
||||
)
|
||||
|
||||
# Create an entity with Gradient Surface Tag Emitter component
|
||||
position = math.Vector3(512.0, 512.0, 32.0)
|
||||
gradient = hydra.Entity("gradient")
|
||||
gradient.create_entity(position, ["Gradient Surface Tag Emitter"])
|
||||
|
||||
# Make sure Gradient Surface Tag Emitter is disabled
|
||||
is_enable = is_enabled(gradient.components[0])
|
||||
if not is_enable:
|
||||
self.log("Gradient Surface Tag Emitter is Disabled")
|
||||
elif not is_enable:
|
||||
self.log("Gradient Surface Tag Emitter is Enabled, but should be Disabled without dependencies met")
|
||||
|
||||
# Verify Gradient Surface Tag Emitter component is enabled after adding Gradient, Generator, Modifier
|
||||
# or Reference component
|
||||
new_components_to_add = [
|
||||
"Dither Gradient Modifier",
|
||||
"Gradient Mixer",
|
||||
"Invert Gradient Modifier",
|
||||
"Levels Gradient Modifier",
|
||||
"Posterize Gradient Modifier",
|
||||
"Smooth-Step Gradient Modifier",
|
||||
"Threshold Gradient Modifier",
|
||||
"Altitude Gradient",
|
||||
"Constant Gradient",
|
||||
"FastNoise Gradient",
|
||||
"Image Gradient",
|
||||
"Perlin Noise Gradient",
|
||||
"Random Noise Gradient",
|
||||
"Reference Gradient",
|
||||
"Shape Falloff Gradient",
|
||||
"Slope Gradient",
|
||||
"Surface Mask Gradient",
|
||||
]
|
||||
for component in new_components_to_add:
|
||||
component_list = ["FastNoise Gradient", "Image Gradient", "Perlin Noise Gradient", "Random Noise Gradient"]
|
||||
if component in component_list:
|
||||
for Component in ["Gradient Transform Modifier", "Box Shape"]:
|
||||
hydra.add_component(Component, gradient.id)
|
||||
typeIdsList = editor.EditorComponentAPIBus(bus.Broadcast, 'FindComponentTypeIdsByEntityType', [component],
|
||||
entity.EntityType().Game)
|
||||
ComponentOutcome = editor.EditorComponentAPIBus(bus.Broadcast, 'AddComponentsOfType', gradient.id, [typeIdsList[0]])
|
||||
Components = ComponentOutcome.GetValue()
|
||||
ComponentIdPair = Components[0]
|
||||
gradient_enabled = new_components_enabled = False
|
||||
gradient_enabled = is_enabled(gradient.components[0])
|
||||
new_components_enabled = is_enabled(ComponentIdPair)
|
||||
if new_components_enabled and gradient_enabled:
|
||||
self.log(f"{component} and Gradient Surface Tag Emitter are enabled")
|
||||
else:
|
||||
self.log(f"{component} and Gradient Surface Tag Emitter are disabled")
|
||||
if component in component_list:
|
||||
hydra.remove_component("Gradient Transform Modifier", gradient.id)
|
||||
hydra.remove_component("Box Shape", gradient.id)
|
||||
hydra.remove_component(component, gradient.id)
|
||||
if component in component_list:
|
||||
hydra.remove_component("Gradient Transform Modifier", gradient.id)
|
||||
hydra.remove_component("Box Shape", gradient.id)
|
||||
hydra.remove_component(component, gradient.id)
|
||||
|
||||
|
||||
test = TestGradientSurfaceTagEmitterDependencies()
|
||||
test.run()
|
||||
if __name__ == "__main__":
|
||||
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(GradientSurfaceTagEmitter_ComponentDependencies)
|
||||
|
||||
+60
-66
@@ -5,75 +5,69 @@ For complete copyright and license terms please see the LICENSE at the root of t
|
||||
SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
import azlmbr.math as math
|
||||
import azlmbr.paths
|
||||
import azlmbr.surface_data as surface_data
|
||||
def GradientSurfaceTagEmitter_SurfaceTagsAddRemoveSuccessfully():
|
||||
"""
|
||||
Summary:
|
||||
Entity with Gradient Surface Tag Emitter and Reference Gradient components is created.
|
||||
And new surface tag has been added and removed.
|
||||
|
||||
sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.editor_test_helper import EditorTestHelper
|
||||
Expected Behavior:
|
||||
A new Surface Tag can be added and removed from the component
|
||||
|
||||
Test Steps:
|
||||
1) Open level
|
||||
2) Create an entity with Gradient Surface Tag Emitter and Reference Gradient components.
|
||||
3) Add/ remove Surface Tags
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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 azlmbr.math as math
|
||||
import azlmbr.surface_data as surface_data
|
||||
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
|
||||
# 1) Open an existing simple level
|
||||
helper.init_idle()
|
||||
helper.open_level("Physics", "Base")
|
||||
|
||||
# 2) Create an entity with Gradient Surface Tag Emitter and Reference Gradient components.
|
||||
entity_position = math.Vector3(125.0, 136.0, 32.0)
|
||||
components_to_add = ["Gradient Surface Tag Emitter", "Reference Gradient"]
|
||||
entity = hydra.Entity("entity")
|
||||
entity.create_entity(entity_position, components_to_add)
|
||||
|
||||
# 3) Add/ remove Surface Tags
|
||||
tag = surface_data.SurfaceTag()
|
||||
tag.SetTag("water")
|
||||
pte = hydra.get_property_tree(entity.components[0])
|
||||
path = "Configuration|Extended Tags"
|
||||
pte.add_container_item(path, 0, tag)
|
||||
success = helper.wait_for_condition(lambda: pte.get_container_count(path).GetValue() == 1, 1.0)
|
||||
tag_added_to_container = (
|
||||
"Successfully added surface tag",
|
||||
"Failed to add surface tag"
|
||||
)
|
||||
Report.result(tag_added_to_container, success)
|
||||
pte.remove_container_item(path, 0)
|
||||
success = helper.wait_for_condition(lambda: pte.get_container_count(path).GetValue() == 0, 1.0)
|
||||
tag_removed_from_container = (
|
||||
"Successfully removed surface tag",
|
||||
"Failed to remove surface tag"
|
||||
)
|
||||
Report.result(tag_removed_from_container, success)
|
||||
|
||||
|
||||
class TestGradientSurfaceTagEmitter(EditorTestHelper):
|
||||
def __init__(self):
|
||||
EditorTestHelper.__init__(self, log_prefix="GradientSurfaceTagEmitter_SurfaceTagsAddRemoveSucessfully",
|
||||
args=["level"])
|
||||
if __name__ == "__main__":
|
||||
|
||||
def run_test(self):
|
||||
"""
|
||||
Summary:
|
||||
Entity with Gradient Surface Tag Emitter and Reference Gradient components is created.
|
||||
And new surface tag has been added and removed.
|
||||
|
||||
Expected Behavior:
|
||||
A new Surface Tag can be added and removed from the component
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(GradientSurfaceTagEmitter_SurfaceTagsAddRemoveSuccessfully)
|
||||
|
||||
Test Steps:
|
||||
1) Open level
|
||||
2) Create an entity with Gradient Surface Tag Emitter and Reference Gradient components.
|
||||
3) Add/ remove Surface Tags
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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
|
||||
"""
|
||||
|
||||
# 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,
|
||||
)
|
||||
|
||||
# 2) Create an entity with Gradient Surface Tag Emitter and Reference Gradient components.
|
||||
entity_position = math.Vector3(125.0, 136.0, 32.0)
|
||||
components_to_add = ["Gradient Surface Tag Emitter", "Reference Gradient"]
|
||||
entity = hydra.Entity("entity")
|
||||
entity.create_entity(entity_position, components_to_add)
|
||||
|
||||
# 3) Add/ remove Surface Tags
|
||||
tag = surface_data.SurfaceTag()
|
||||
tag.SetTag("water")
|
||||
pte = hydra.get_property_tree(entity.components[0])
|
||||
path = "Configuration|Extended Tags"
|
||||
pte.add_container_item(path, 0, tag)
|
||||
success = self.wait_for_condition(lambda: pte.get_container_count(path).GetValue() == 1)
|
||||
self.test_success = self.test_success and success
|
||||
print(f"Added SurfaceTag: container count is {pte.get_container_count(path).GetValue()}")
|
||||
pte.remove_container_item(path, 0)
|
||||
success = self.wait_for_condition(lambda: pte.get_container_count(path).GetValue() == 0)
|
||||
self.test_success = self.test_success and success
|
||||
print(f"Removed SurfaceTag: container count is {pte.get_container_count(path).GetValue()}")
|
||||
|
||||
|
||||
test = TestGradientSurfaceTagEmitter()
|
||||
test.run()
|
||||
|
||||
+81
-97
@@ -5,118 +5,102 @@ For complete copyright and license terms please see the LICENSE at the root of t
|
||||
SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.editor as editor
|
||||
import azlmbr.math as math
|
||||
import azlmbr.entity as EntityId
|
||||
def GradientTransform_ComponentIncompatibleWithExpectedGradients():
|
||||
"""
|
||||
Summary:
|
||||
A New level is created. A New entity is created with components Gradient Transform Modifier and Box Shape.
|
||||
Adding components Constant Gradient, Altitude Gradient, Gradient Mixer, Reference Gradient, Shape
|
||||
Falloff Gradient, Slope Gradient and Surface Mask Gradient to the same entity.
|
||||
|
||||
sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.editor_test_helper import EditorTestHelper
|
||||
Expected Behavior:
|
||||
All added components are disabled and inform the user that they are incompatible with the Gradient Transform
|
||||
Modifier
|
||||
|
||||
Test Steps:
|
||||
1) Create level
|
||||
2) Create a new entity with components Gradient Transform Modifier and Box Shape
|
||||
3) Make sure all components are enabled in Entity
|
||||
4) Add Constant Gradient, Altitude Gradient, Gradient Mixer, Reference Gradient, Shape
|
||||
Falloff Gradient, Slope Gradient and Surface Mask Gradient to the same entity
|
||||
5) Make sure all newly added components are disabled
|
||||
|
||||
class TestGradientTransform_ComponentIncompatibleWithExpectedGradients(EditorTestHelper):
|
||||
def __init__(self):
|
||||
EditorTestHelper.__init__(self, log_prefix="GradientTransform_ComponentIncompatibleWithExpectedGradients",
|
||||
args=["level"])
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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.
|
||||
|
||||
def run_test(self):
|
||||
"""
|
||||
Summary:
|
||||
A New level is created. A New entity is created with components Gradient Transform Modifier and Box Shape.
|
||||
Adding components Constant Gradient, Altitude Gradient, Gradient Mixer, Reference Gradient, Shape
|
||||
Falloff Gradient, Slope Gradient and Surface Mask Gradient to the same entity.
|
||||
:return: None
|
||||
"""
|
||||
|
||||
Expected Behavior:
|
||||
All added components are disabled and inform the user that they are incompatible with the Gradient Transform
|
||||
Modifier
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.editor as editor
|
||||
import azlmbr.math as math
|
||||
import azlmbr.entity as EntityId
|
||||
|
||||
Test Steps:
|
||||
1) Create level
|
||||
2) Create a new entity with components Gradient Transform Modifier and Box Shape
|
||||
3) Make sure all components are enabled in Entity
|
||||
4) Add Constant Gradient, Altitude Gradient, Gradient Mixer, Reference Gradient, Shape
|
||||
Falloff Gradient, Slope Gradient and Surface Mask Gradient to the same entity
|
||||
5) Make sure all newly added components are disabled
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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.
|
||||
def is_enabled(EntityComponentIdPair):
|
||||
return editor.EditorComponentAPIBus(bus.Broadcast, "IsComponentEnabled", EntityComponentIdPair)
|
||||
|
||||
:return: None
|
||||
"""
|
||||
# 1) Open an existing simple level
|
||||
helper.init_idle()
|
||||
helper.open_level("Physics", "Base")
|
||||
|
||||
def is_enabled(EntityComponentIdPair):
|
||||
return editor.EditorComponentAPIBus(bus.Broadcast, "IsComponentEnabled", EntityComponentIdPair)
|
||||
# 2) Create a new entity with components Gradient Transform Modifier and Box Shape
|
||||
entity_position = math.Vector3(125.0, 136.0, 32.0)
|
||||
components_to_add = ["Gradient Transform Modifier", "Box Shape"]
|
||||
gradient_id = editor.ToolsApplicationRequestBus(
|
||||
bus.Broadcast, "CreateNewEntityAtPosition", entity_position, EntityId.EntityId()
|
||||
)
|
||||
gradient = hydra.Entity("gradient", gradient_id)
|
||||
|
||||
# 1) Create 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,
|
||||
gradient.components = []
|
||||
|
||||
for component in components_to_add:
|
||||
gradient.components.append(hydra.add_component(component, gradient_id))
|
||||
entity_created = (
|
||||
"Entity created successfully",
|
||||
"Failed to create entity"
|
||||
)
|
||||
Report.critical_result(entity_created, gradient_id.isValid())
|
||||
|
||||
# 3) Make sure all components are enabled in Entity
|
||||
index = 0
|
||||
for component in components_to_add:
|
||||
components_enabled = (
|
||||
f"{component} is enabled",
|
||||
f"{component} is unexpectedly disabled"
|
||||
)
|
||||
Report.critical_result(components_enabled, is_enabled(gradient.components[index]))
|
||||
index += 1
|
||||
|
||||
# 2) Create a new entity with components Gradient Transform Modifier and Box Shape
|
||||
entity_position = math.Vector3(125.0, 136.0, 32.0)
|
||||
components_to_add = ["Gradient Transform Modifier", "Box Shape"]
|
||||
gradient_id = editor.ToolsApplicationRequestBus(
|
||||
bus.Broadcast, "CreateNewEntityAtPosition", entity_position, EntityId.EntityId()
|
||||
# 4) Add Constant Gradient, Altitude Gradient, Gradient Mixer, Reference Gradient, Shape
|
||||
# Falloff Gradient, Slope Gradient and Surface Mask Gradient to the same entity
|
||||
new_components_to_add = [
|
||||
"Constant Gradient",
|
||||
"Altitude Gradient",
|
||||
"Gradient Mixer",
|
||||
"Reference Gradient",
|
||||
"Shape Falloff Gradient",
|
||||
"Slope Gradient",
|
||||
"Surface Mask Gradient",
|
||||
]
|
||||
new_components_enabled = False
|
||||
for component in new_components_to_add:
|
||||
gradient.components.append(hydra.add_component(component, gradient_id))
|
||||
gradient_components_disabled = (
|
||||
f"{component} is disabled",
|
||||
f"{component} is enabled, but should be disabled"
|
||||
)
|
||||
gradient = hydra.Entity("gradient", gradient_id)
|
||||
|
||||
gradient.components = []
|
||||
|
||||
for component in components_to_add:
|
||||
gradient.components.append(hydra.add_component(component, gradient_id))
|
||||
if gradient_id.isValid():
|
||||
self.log("New Entity Created")
|
||||
|
||||
# 3) Make sure all components are enabled in Entity
|
||||
index = 0
|
||||
for component in components_to_add:
|
||||
is_enable = is_enabled(gradient.components[index])
|
||||
if is_enable:
|
||||
self.log(f"{component} is Enabled")
|
||||
self.test_success = self.test_success and is_enable
|
||||
elif not is_enable:
|
||||
self.log(f"{component} is disabled, but it should be enabled")
|
||||
self.test_success = self.test_success and is_enable
|
||||
break
|
||||
index += 1
|
||||
|
||||
# 4) Add Constant Gradient, Altitude Gradient, Gradient Mixer, Reference Gradient, Shape
|
||||
# Falloff Gradient, Slope Gradient and Surface Mask Gradient to the same entity
|
||||
new_components_to_add = [
|
||||
"Constant Gradient",
|
||||
"Altitude Gradient",
|
||||
"Gradient Mixer",
|
||||
"Reference Gradient",
|
||||
"Shape Falloff Gradient",
|
||||
"Slope Gradient",
|
||||
"Surface Mask Gradient",
|
||||
]
|
||||
index = 2
|
||||
new_components_enabled = False
|
||||
for component in new_components_to_add:
|
||||
gradient.components.append(hydra.add_component(component, gradient_id))
|
||||
new_components_enabled = is_enabled(gradient.components[index])
|
||||
if new_components_enabled:
|
||||
self.log(f"{component} is enabled, but should be disabled")
|
||||
break
|
||||
Report.result(gradient_components_disabled, not is_enabled(gradient.components[2]))
|
||||
if not is_enabled(gradient.components[2]):
|
||||
editor.EditorComponentAPIBus(bus.Broadcast, "RemoveComponents", component)
|
||||
|
||||
# 5) Make sure all newly added components are disabled
|
||||
if not new_components_enabled:
|
||||
self.log("All newly added components are incompatible and disabled")
|
||||
self.test_success = self.test_success and not new_components_enabled
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
test = TestGradientTransform_ComponentIncompatibleWithExpectedGradients()
|
||||
test.run()
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(GradientTransform_ComponentIncompatibleWithExpectedGradients)
|
||||
|
||||
+69
-85
@@ -5,104 +5,88 @@ For complete copyright and license terms please see the LICENSE at the root of t
|
||||
SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.editor as editor
|
||||
import azlmbr.math as math
|
||||
import azlmbr.entity as EntityId
|
||||
def GradientTransform_ComponentIncompatibleWithSpawners():
|
||||
"""
|
||||
Summary:
|
||||
A simple level is opened. A New entity is created with components Gradient Transform Modifier and Box Shape.
|
||||
Adding a component Vegetation Layer Spawner to the same entity.
|
||||
|
||||
sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.editor_test_helper import EditorTestHelper
|
||||
Expected Behavior:
|
||||
The Vegetation Layer Spawner is deactivated and it is communicated that it is incompatible with Gradient
|
||||
Transform Modifier
|
||||
|
||||
Test Steps:
|
||||
1) Open a simple level
|
||||
2) Create a new entity with components Gradient Transform Modifier and Box Shape
|
||||
3) Make sure all components are enabled in Entity
|
||||
4) Add Vegetation Layer Spawner to the same entity
|
||||
5) Make sure newly added component is disabled
|
||||
|
||||
class TestGradientTransform_ComponentIncompatibleWithSpawners(EditorTestHelper):
|
||||
def __init__(self):
|
||||
EditorTestHelper.__init__(self, log_prefix="GradientTransform_ComponentIncompatibleWithSpawners",
|
||||
args=["level"])
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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.
|
||||
|
||||
def run_test(self):
|
||||
"""
|
||||
Summary:
|
||||
A New level is created. A New entity is created with components Gradient Transform Modifier and Box Shape.
|
||||
Adding a component Vegetation Layer Spawner to the same entity.
|
||||
:return: None
|
||||
"""
|
||||
|
||||
Expected Behavior:
|
||||
The Vegetation Layer Spawner is deactivated and it is communicated that it is incompatible with Gradient
|
||||
Transform Modifier
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.editor as editor
|
||||
import azlmbr.math as math
|
||||
import azlmbr.entity as EntityId
|
||||
|
||||
Test Steps:
|
||||
1) Create level
|
||||
2) Create a new entity with components Gradient Transform Modifier and Box Shape
|
||||
3) Make sure all components are enabled in Entity
|
||||
4) Add Vegetation Layer Spawner to the same entity
|
||||
5) Make sure newly added component is disabled
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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.
|
||||
def is_enabled(EntityComponentIdPair):
|
||||
return editor.EditorComponentAPIBus(bus.Broadcast, "IsComponentEnabled", EntityComponentIdPair)
|
||||
|
||||
:return: None
|
||||
"""
|
||||
# 1) Open an existing simple level
|
||||
helper.init_idle()
|
||||
helper.open_level("Physics", "Base")
|
||||
|
||||
def is_enabled(EntityComponentIdPair):
|
||||
return editor.EditorComponentAPIBus(bus.Broadcast, "IsComponentEnabled", EntityComponentIdPair)
|
||||
# 2) Create a new entity with components Gradient Transform Modifier and Box Shape
|
||||
entity_position = math.Vector3(125.0, 136.0, 32.0)
|
||||
components_to_add = ["Gradient Transform Modifier", "Box Shape"]
|
||||
gradient_id = editor.ToolsApplicationRequestBus(
|
||||
bus.Broadcast, "CreateNewEntityAtPosition", entity_position, EntityId.EntityId()
|
||||
)
|
||||
gradient = hydra.Entity("gradient", gradient_id)
|
||||
|
||||
# 1) Create 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,
|
||||
gradient.components = []
|
||||
|
||||
for component in components_to_add:
|
||||
gradient.components.append(hydra.add_component(component, gradient_id))
|
||||
entity_created = (
|
||||
"Entity created successfully",
|
||||
"Failed to create entity"
|
||||
)
|
||||
Report.critical_result(entity_created, gradient_id.isValid())
|
||||
|
||||
# 3) Make sure all components are enabled in Entity
|
||||
index = 0
|
||||
for component in components_to_add:
|
||||
components_enabled = (
|
||||
f"{component} is enabled",
|
||||
f"{component} is unexpectedly disabled"
|
||||
)
|
||||
Report.critical_result(components_enabled, is_enabled(gradient.components[index]))
|
||||
index += 1
|
||||
|
||||
# 2) Create a new entity with components Gradient Transform Modifier and Box Shape
|
||||
entity_position = math.Vector3(125.0, 136.0, 32.0)
|
||||
components_to_add = ["Gradient Transform Modifier", "Box Shape"]
|
||||
gradient_id = editor.ToolsApplicationRequestBus(
|
||||
bus.Broadcast, "CreateNewEntityAtPosition", entity_position, EntityId.EntityId()
|
||||
)
|
||||
gradient = hydra.Entity("gradient", gradient_id)
|
||||
# 4) Add Vegetation Layer Spawner to the same entity
|
||||
gradient.components.append(hydra.add_component("Vegetation Layer Spawner", gradient_id))
|
||||
|
||||
gradient.components = []
|
||||
|
||||
for component in components_to_add:
|
||||
gradient.components.append(hydra.add_component(component, gradient_id))
|
||||
if gradient_id.isValid():
|
||||
self.log("New Entity Created")
|
||||
|
||||
# 3) Make sure all components are enabled in Entity
|
||||
index = 0
|
||||
for component in components_to_add:
|
||||
is_enable = is_enabled(gradient.components[index])
|
||||
if is_enable:
|
||||
self.log(f"{component} is Enabled")
|
||||
self.test_success = self.test_success and is_enable
|
||||
elif not is_enable:
|
||||
self.log(f"{component} is Disabled. But It should be Enabled in an Entity")
|
||||
self.test_success = self.test_success and is_enable
|
||||
break
|
||||
index += 1
|
||||
|
||||
# 4) Add Vegetation Layer Spawner to the same entity
|
||||
new_component_to_add = "Vegetation Layer Spawner"
|
||||
index = 2
|
||||
gradient.components.append(hydra.add_component(new_component_to_add, gradient_id))
|
||||
new_component_enabled = is_enabled(gradient.components[index])
|
||||
|
||||
# 5) Make sure newly added component is disabled
|
||||
if not new_component_enabled:
|
||||
self.log(f"{new_component_to_add} is incompatible and disabled")
|
||||
self.test_success = self.test_success and not new_component_enabled
|
||||
elif new_component_enabled:
|
||||
self.log(f"{new_component_to_add} is compatible and enabled. But It should be Incompatible and disabled")
|
||||
self.test_success = self.test_success and new_component_enabled
|
||||
# 5) Make sure newly added component is disabled
|
||||
spawner_component_disabled = (
|
||||
"Spawner component is disabled",
|
||||
"Spawner component is unexpectedly enabled"
|
||||
)
|
||||
Report.result(spawner_component_disabled, not is_enabled(gradient.components[2]))
|
||||
|
||||
|
||||
test = TestGradientTransform_ComponentIncompatibleWithSpawners()
|
||||
test.run()
|
||||
if __name__ == "__main__":
|
||||
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(GradientTransform_ComponentIncompatibleWithSpawners)
|
||||
|
||||
+64
-69
@@ -5,87 +5,82 @@ For complete copyright and license terms please see the LICENSE at the root of t
|
||||
SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
"""
|
||||
|
||||
"""
|
||||
C3430292: Frequency Zoom can manually be set higher than 8.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.editor as editor
|
||||
import azlmbr.math as math
|
||||
import azlmbr.paths
|
||||
import azlmbr.entity as EntityId
|
||||
|
||||
sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.editor_test_helper import EditorTestHelper
|
||||
class Tests:
|
||||
entity_created = (
|
||||
"Entity created successfully",
|
||||
"Failed to create entity"
|
||||
)
|
||||
components_added = (
|
||||
"All expected components added to entity",
|
||||
"Failed to add expected components to entity"
|
||||
)
|
||||
higher_zoom_value_set = (
|
||||
"Frequency Zoom is equal to expected value",
|
||||
"Frequency Zoom is not equal to expected value"
|
||||
)
|
||||
|
||||
|
||||
class TestGradientTransformFrequencyZoom(EditorTestHelper):
|
||||
def __init__(self):
|
||||
EditorTestHelper.__init__(self, log_prefix="GradientTransform_FrequencyZoomBeyondSliders", args=["level"])
|
||||
def GradientTransform_FrequencyZoomCanBeSetBeyondSliderRange():
|
||||
"""
|
||||
Summary:
|
||||
Frequency Zoom can manually be set higher than 8 in a random noise gradient
|
||||
|
||||
def run_test(self):
|
||||
"""
|
||||
Summary:
|
||||
Frequency Zoom can manually be set higher than 8 in a random noise gradient
|
||||
Expected Behavior:
|
||||
The value properly changes, despite the value being outside of the slider limit
|
||||
|
||||
Expected Behavior:
|
||||
The value properly changes, despite the value being outside of the slider limit
|
||||
Test Steps:
|
||||
1) Open level
|
||||
2) Create entity
|
||||
3) Add components to the entity
|
||||
4) Set the frequency value of the component
|
||||
5) Verify if the frequency value is set to higher value
|
||||
|
||||
Test Steps:
|
||||
1) Open level
|
||||
2) Create entity
|
||||
3) Add components to the entity
|
||||
4) Set the frequency value of the component
|
||||
5) Verify if the frequency value is set to higher value
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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.
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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
|
||||
"""
|
||||
|
||||
:return: None
|
||||
"""
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.editor as editor
|
||||
import azlmbr.math as math
|
||||
import azlmbr.entity as EntityId
|
||||
|
||||
# 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,
|
||||
)
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
|
||||
# 2) Create entity
|
||||
entity_position = math.Vector3(125.0, 136.0, 32.0)
|
||||
entity_id = editor.ToolsApplicationRequestBus(
|
||||
bus.Broadcast, "CreateNewEntityAtPosition", entity_position, EntityId.EntityId()
|
||||
)
|
||||
if entity_id.IsValid():
|
||||
print("Entity Created")
|
||||
# 1) Open an existing simple level
|
||||
helper.init_idle()
|
||||
helper.open_level("Physics", "Base")
|
||||
|
||||
# 3) Add components to the entity
|
||||
components_to_add = ["Random Noise Gradient", "Gradient Transform Modifier", "Box Shape"]
|
||||
entity = hydra.Entity("entity", entity_id)
|
||||
entity.components = []
|
||||
for component in components_to_add:
|
||||
entity.components.append(hydra.add_component(component, entity_id))
|
||||
print("Components added to the entity")
|
||||
# 2) Create entity
|
||||
entity_position = math.Vector3(125.0, 136.0, 32.0)
|
||||
entity_id = editor.ToolsApplicationRequestBus(
|
||||
bus.Broadcast, "CreateNewEntityAtPosition", entity_position, EntityId.EntityId()
|
||||
)
|
||||
Report.critical_result(Tests.entity_created, entity_id.IsValid())
|
||||
|
||||
# 4) Set the frequency value of the component
|
||||
hydra.get_set_test(entity, 1, "Configuration|Frequency Zoom", 10)
|
||||
# 3) Add components to the entity
|
||||
components_to_add = ["Random Noise Gradient", "Gradient Transform Modifier", "Box Shape"]
|
||||
entity = hydra.Entity("entity", entity_id)
|
||||
entity.components = []
|
||||
for component in components_to_add:
|
||||
entity.components.append(hydra.add_component(component, entity_id))
|
||||
Report.critical_result(Tests.components_added, len(entity.components) == 3)
|
||||
|
||||
# 5) Verify if the frequency value is set to higher value
|
||||
curr_value = hydra.get_component_property_value(entity.components[1], "Configuration|Frequency Zoom")
|
||||
if curr_value == 10.0:
|
||||
print("Frequency Zoom is equal to expected value")
|
||||
else:
|
||||
print("Frequency Zoom is not equal to expected value")
|
||||
# 4) Set the frequency value of the component
|
||||
hydra.get_set_test(entity, 1, "Configuration|Frequency Zoom", 10)
|
||||
|
||||
# 5) Verify if the frequency value is set to higher value
|
||||
curr_value = hydra.get_component_property_value(entity.components[1], "Configuration|Frequency Zoom")
|
||||
Report.result(Tests.higher_zoom_value_set, curr_value == 10.0)
|
||||
|
||||
|
||||
test = TestGradientTransformFrequencyZoom()
|
||||
test.run()
|
||||
if __name__ == "__main__":
|
||||
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(GradientTransform_FrequencyZoomCanBeSetBeyondSliderRange)
|
||||
|
||||
+64
-66
@@ -4,73 +4,71 @@ For complete copyright and license terms please see the LICENSE at the root of t
|
||||
|
||||
SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
|
||||
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'))
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.editor_test_helper import EditorTestHelper
|
||||
|
||||
|
||||
class TestGradientTransformRequiresShape(EditorTestHelper):
|
||||
def __init__(self):
|
||||
EditorTestHelper.__init__(self, log_prefix="GradientTransformRequiresShape", args=["level"])
|
||||
|
||||
def run_test(self):
|
||||
"""
|
||||
Summary:
|
||||
This test verifies that the Gradient Transform Modifier component is dependent on a shape component.
|
||||
|
||||
Expected Result:
|
||||
Gradient Transform Modifier component is disabled until a shape component is added to the entity.
|
||||
|
||||
Test Steps:
|
||||
1) Open level
|
||||
2) Create a new entity with a Gradient Transform Modifier component
|
||||
3) Verify the component is disabled until a shape component is also added to the entity
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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
|
||||
"""
|
||||
# Create a new empty 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,
|
||||
)
|
||||
|
||||
# Create a new Entity in the level
|
||||
entity_id = editor.ToolsApplicationRequestBus(bus.Broadcast, 'CreateNewEntity', entity.EntityId())
|
||||
|
||||
# Add a Gradient Transform Component (that will be disabled since there is no shape on the Entity)
|
||||
gradient_transform_component = hydra.add_component('Gradient Transform Modifier', entity_id)
|
||||
|
||||
# Verify the Gradient Transform Component is not active before adding the Shape
|
||||
active = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', gradient_transform_component)
|
||||
self.test_success = self.test_success and not active
|
||||
if not active:
|
||||
self.log("Gradient Transform component is not active without a Shape component on the Entity")
|
||||
|
||||
# Add a Shape component to the same Entity
|
||||
hydra.add_component('Box Shape', entity_id)
|
||||
|
||||
# Check if the Gradient Transform Component is active now after adding the Shape
|
||||
active = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', gradient_transform_component)
|
||||
self.test_success = self.test_success and active
|
||||
if active:
|
||||
self.log("Gradient Transform Modifier component is active now that the Entity has a Shape")
|
||||
class Tests:
|
||||
disabled_without_shape = (
|
||||
"Gradient Transform Modifier component is disabled without a Shape component on the Entity",
|
||||
"Gradient Transform Modifier component is unexpectedly enabled without a Shape component on the Entity",
|
||||
)
|
||||
enabled_with_shape = (
|
||||
"Gradient Transform Modifier component is enabled now that the Entity has a Shape",
|
||||
"Gradient Transform Modifier component is still disabled alongside a Shape component",
|
||||
)
|
||||
|
||||
|
||||
test = TestGradientTransformRequiresShape()
|
||||
test.run()
|
||||
def GradientTransform_RequiresShape():
|
||||
"""
|
||||
Summary:
|
||||
This test verifies that the Gradient Transform Modifier component is dependent on a shape component.
|
||||
|
||||
Expected Result:
|
||||
Gradient Transform Modifier component is disabled until a shape component is added to the entity.
|
||||
|
||||
Test Steps:
|
||||
1) Open level
|
||||
2) Create a new entity with a Gradient Transform Modifier component
|
||||
3) Verify the component is disabled until a shape component is also added to the entity
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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 azlmbr.bus as bus
|
||||
import azlmbr.editor as editor
|
||||
import azlmbr.entity as entity
|
||||
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
|
||||
# Open an existing simple level
|
||||
helper.init_idle()
|
||||
helper.open_level("Physics", "Base")
|
||||
|
||||
# Create a new Entity in the level
|
||||
entity_id = editor.ToolsApplicationRequestBus(bus.Broadcast, 'CreateNewEntity', entity.EntityId())
|
||||
|
||||
# Add a Gradient Transform Component (that will be disabled since there is no shape on the Entity)
|
||||
gradient_transform_component = hydra.add_component('Gradient Transform Modifier', entity_id)
|
||||
|
||||
# Verify the Gradient Transform Component is not active before adding the Shape
|
||||
active = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', gradient_transform_component)
|
||||
Report.result(Tests.disabled_without_shape, not active)
|
||||
|
||||
# Add a Shape component to the same Entity
|
||||
hydra.add_component('Box Shape', entity_id)
|
||||
|
||||
# Check if the Gradient Transform Component is active now after adding the Shape
|
||||
active = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', gradient_transform_component)
|
||||
Report.result(Tests.enabled_with_shape, active)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(GradientTransform_RequiresShape)
|
||||
|
||||
+73
-71
@@ -5,89 +5,91 @@ For complete copyright and license terms please see the LICENSE at the root of t
|
||||
SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
import azlmbr.asset as asset
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.entity as EntityId
|
||||
import azlmbr.editor as editor
|
||||
import azlmbr.math as math
|
||||
import azlmbr.paths
|
||||
|
||||
sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.editor_test_helper import EditorTestHelper
|
||||
class Tests:
|
||||
image_gradient_entity_created = (
|
||||
"Image Gradient entity created",
|
||||
"Failed to create Image Gradient entity",
|
||||
)
|
||||
image_gradient_asset_found = (
|
||||
"image_grad_test_gsi.png was found in the workspace",
|
||||
"image_grad_test_gsi.png was not found in the workspace"
|
||||
)
|
||||
image_gradient_assigned = (
|
||||
"Successfully assigned image gradient asset",
|
||||
"Failed to assign image gradient asset"
|
||||
)
|
||||
|
||||
|
||||
class TestImageGradient(EditorTestHelper):
|
||||
def __init__(self):
|
||||
EditorTestHelper.__init__(self, log_prefix="ImageGradient_ProcessedImageAssignedSucessfully",
|
||||
args=["level"])
|
||||
def ImageGradient_ProcessedImageAssignedSuccessfully():
|
||||
"""
|
||||
Summary:
|
||||
Level created with Entity having Image Gradient and Gradient Transform Modifier components.
|
||||
Save any new image to your workspace with the suffix "_gsi" and assign as image asset.
|
||||
|
||||
def run_test(self):
|
||||
"""
|
||||
Summary:
|
||||
Level created with Entity having Image Gradient and Gradient Transform Modifier components.
|
||||
Save any new image to your workspace with the suffix "_gsi" and assign as image asset.
|
||||
|
||||
Expected Behavior:
|
||||
Image can be assigned as the Image Asset for the Image as Gradient component.
|
||||
Expected Behavior:
|
||||
Image can be assigned as the Image Asset for the Image as Gradient component.
|
||||
|
||||
Test Steps:
|
||||
1) Create level
|
||||
2) Create an entity with Image Gradient and Gradient Transform Modifier components.
|
||||
3) Assign the newly processed gradient image as Image asset.
|
||||
Test Steps:
|
||||
1) Open a level
|
||||
2) Create an entity with Image Gradient and Gradient Transform Modifier components.
|
||||
3) Assign the newly processed gradient image as Image asset.
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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.
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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
|
||||
"""
|
||||
:return: None
|
||||
"""
|
||||
|
||||
# 1) Create 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,
|
||||
)
|
||||
import os
|
||||
|
||||
# 2) Create an entity with Image Gradient and Gradient Transform Modifier components
|
||||
components_to_add = ["Image Gradient", "Gradient Transform Modifier", "Box Shape"]
|
||||
entity_position = math.Vector3(512.0, 512.0, 32.0)
|
||||
new_entity_id = editor.ToolsApplicationRequestBus(
|
||||
bus.Broadcast, "CreateNewEntityAtPosition", entity_position, EntityId.EntityId()
|
||||
)
|
||||
if new_entity_id.IsValid():
|
||||
print("Image Gradient Entity created")
|
||||
image_gradient_entity = hydra.Entity("Image Gradient Entity", new_entity_id)
|
||||
image_gradient_entity.components = []
|
||||
for component in components_to_add:
|
||||
image_gradient_entity.add_component(component)
|
||||
import azlmbr.asset as asset
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.entity as EntityId
|
||||
import azlmbr.editor as editor
|
||||
import azlmbr.math as math
|
||||
|
||||
# 3) Assign the processed gradient signal image as the Image Gradient's image asset and verify success
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
|
||||
# First, check for the base image in the workspace
|
||||
base_image = "image_grad_test_gsi.png"
|
||||
base_image_path = os.path.join("AutomatedTesting", "Assets", "ImageGradients", base_image)
|
||||
if os.path.isfile(base_image_path):
|
||||
print(f"{base_image} was found in the workspace")
|
||||
# 1) Open an existing simple level
|
||||
helper.init_idle()
|
||||
helper.open_level("Physics", "Base")
|
||||
|
||||
# Next, assign the processed image to the Image Gradient's Image Asset property
|
||||
processed_image_path = os.path.join("Assets", "ImageGradients", "image_grad_test_gsi.gradimage")
|
||||
asset_id = asset.AssetCatalogRequestBus(bus.Broadcast, "GetAssetIdByPath", processed_image_path, math.Uuid(),
|
||||
False)
|
||||
hydra.get_set_test(image_gradient_entity, 0, "Configuration|Image Asset", asset_id)
|
||||
# 2) Create an entity with Image Gradient and Gradient Transform Modifier components
|
||||
components_to_add = ["Image Gradient", "Gradient Transform Modifier", "Box Shape"]
|
||||
entity_position = math.Vector3(512.0, 512.0, 32.0)
|
||||
new_entity_id = editor.ToolsApplicationRequestBus(
|
||||
bus.Broadcast, "CreateNewEntityAtPosition", entity_position, EntityId.EntityId()
|
||||
)
|
||||
Report.critical_result(Tests.image_gradient_entity_created, new_entity_id.IsValid())
|
||||
image_gradient_entity = hydra.Entity("Image Gradient Entity", new_entity_id)
|
||||
image_gradient_entity.components = []
|
||||
for component in components_to_add:
|
||||
image_gradient_entity.add_component(component)
|
||||
|
||||
# Finally, verify if the gradient image is assigned as the Image Asset
|
||||
success = hydra.get_component_property_value(image_gradient_entity.components[0], "Configuration|Image Asset") == asset_id
|
||||
self.test_success = self.test_success and success
|
||||
# 3) Assign the processed gradient signal image as the Image Gradient's image asset and verify success
|
||||
|
||||
# First, check for the base image in the workspace
|
||||
base_image = "image_grad_test_gsi.png"
|
||||
base_image_path = os.path.join("AutomatedTesting", "Assets", "ImageGradients", base_image)
|
||||
Report.critical_result(Tests.image_gradient_asset_found, os.path.isfile(base_image_path))
|
||||
|
||||
# Next, assign the processed image to the Image Gradient's Image Asset property
|
||||
processed_image_path = os.path.join("Assets", "ImageGradients", "image_grad_test_gsi.gradimage")
|
||||
asset_id = asset.AssetCatalogRequestBus(bus.Broadcast, "GetAssetIdByPath", processed_image_path, math.Uuid(),
|
||||
False)
|
||||
hydra.get_set_test(image_gradient_entity, 0, "Configuration|Image Asset", asset_id)
|
||||
|
||||
# Finally, verify if the gradient image is assigned as the Image Asset
|
||||
success = hydra.get_component_property_value(image_gradient_entity.components[0], "Configuration|Image Asset") == asset_id
|
||||
Report.result(Tests.image_gradient_assigned, success)
|
||||
|
||||
|
||||
test = TestImageGradient()
|
||||
test.run()
|
||||
if __name__ == "__main__":
|
||||
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(ImageGradient_ProcessedImageAssignedSuccessfully)
|
||||
|
||||
+65
-67
@@ -4,74 +4,72 @@ For complete copyright and license terms please see the LICENSE at the root of t
|
||||
|
||||
SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
|
||||
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'))
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.editor_test_helper import EditorTestHelper
|
||||
|
||||
|
||||
class TestImageGradientRequiresShape(EditorTestHelper):
|
||||
def __init__(self):
|
||||
EditorTestHelper.__init__(self, log_prefix="ImageGradientRequiresShape", args=["level"])
|
||||
|
||||
def run_test(self):
|
||||
"""
|
||||
Summary:
|
||||
This test verifies that the Image Gradient component is dependent on a shape component.
|
||||
|
||||
Expected Result:
|
||||
Gradient Transform Modifier component is disabled until a shape component is added to the entity.
|
||||
|
||||
Test Steps:
|
||||
1) Open level
|
||||
2) Create a new entity with a Image Gradient component
|
||||
3) Verify the component is disabled until a shape component is also added to the entity
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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
|
||||
"""
|
||||
# Create a new empty 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,
|
||||
)
|
||||
|
||||
# Create a new Entity in the level
|
||||
entity_id = editor.ToolsApplicationRequestBus(bus.Broadcast, 'CreateNewEntity', entity.EntityId())
|
||||
|
||||
# Add an Image Gradient and Gradient Transform Component (should be disabled until a Shape exists on the Entity)
|
||||
image_gradient_component = hydra.add_component('Image Gradient', entity_id)
|
||||
hydra.add_component('Gradient Transform Modifier', entity_id)
|
||||
|
||||
# Verify the Image Gradient Component is not active before adding the Shape
|
||||
active = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', image_gradient_component)
|
||||
self.test_success = self.test_success and not active
|
||||
if not active:
|
||||
self.log("Image Gradient component is not active without a Shape component on the Entity")
|
||||
|
||||
# Add a Shape component to the same Entity
|
||||
hydra.add_component('Box Shape', entity_id)
|
||||
|
||||
# Check if the Image Gradient Component is active now after adding the Shape
|
||||
active = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', image_gradient_component)
|
||||
self.test_success = self.test_success and active
|
||||
if active:
|
||||
self.log("Image Gradient component is active now that the Entity has a Shape")
|
||||
class Tests:
|
||||
disabled_without_shape = (
|
||||
"Image Gradient component is disabled without a Shape component on the Entity",
|
||||
"Image Gradient component is unexpectedly enabled without a Shape component on the Entity",
|
||||
)
|
||||
enabled_with_shape = (
|
||||
"Image Gradient component is enabled now that the Entity has a Shape",
|
||||
"Image Gradient component is still disabled alongside a Shape component",
|
||||
)
|
||||
|
||||
|
||||
test = TestImageGradientRequiresShape()
|
||||
test.run()
|
||||
def ImageGradient_RequiresShape():
|
||||
"""
|
||||
Summary:
|
||||
This test verifies that the Image Gradient component is dependent on a shape component.
|
||||
|
||||
Expected Result:
|
||||
Gradient Transform Modifier component is disabled until a shape component is added to the entity.
|
||||
|
||||
Test Steps:
|
||||
1) Open level
|
||||
2) Create a new entity with a Image Gradient component
|
||||
3) Verify the component is disabled until a shape component is also added to the entity
|
||||
|
||||
Note:
|
||||
- This test file must be called from the Open 3D Engine 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 azlmbr.bus as bus
|
||||
import azlmbr.editor as editor
|
||||
import azlmbr.entity as entity
|
||||
|
||||
import editor_python_test_tools.hydra_editor_utils as hydra
|
||||
from editor_python_test_tools.utils import Report
|
||||
from editor_python_test_tools.utils import TestHelper as helper
|
||||
|
||||
# Open an existing simple level
|
||||
helper.init_idle()
|
||||
helper.open_level("Physics", "Base")
|
||||
|
||||
# Create a new Entity in the level
|
||||
entity_id = editor.ToolsApplicationRequestBus(bus.Broadcast, 'CreateNewEntity', entity.EntityId())
|
||||
|
||||
# Add an Image Gradient and Gradient Transform Component (should be disabled until a Shape exists on the Entity)
|
||||
image_gradient_component = hydra.add_component('Image Gradient', entity_id)
|
||||
hydra.add_component('Gradient Transform Modifier', entity_id)
|
||||
|
||||
# Verify the Image Gradient Component is not active before adding the Shape
|
||||
active = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', image_gradient_component)
|
||||
Report.result(Tests.disabled_without_shape, not active)
|
||||
|
||||
# Add a Shape component to the same Entity
|
||||
hydra.add_component('Box Shape', entity_id)
|
||||
|
||||
# Check if the Image Gradient Component is active now after adding the Shape
|
||||
active = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', image_gradient_component)
|
||||
Report.result(Tests.enabled_with_shape, active)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
from editor_python_test_tools.utils import Report
|
||||
Report.start_test(ImageGradient_RequiresShape)
|
||||
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
"""
|
||||
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
|
||||
"""
|
||||
|
||||
import os
|
||||
import pytest
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../../automatedtesting_shared')
|
||||
from base import TestAutomationBase
|
||||
|
||||
|
||||
@pytest.mark.SUITE_periodic
|
||||
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
|
||||
@pytest.mark.parametrize("project", ["AutomatedTesting"])
|
||||
class TestAutomation(TestAutomationBase):
|
||||
|
||||
def test_GradientGenerators_Incompatibilities(self, request, workspace, editor, launcher_platform):
|
||||
from .EditorScripts import GradientGenerators_Incompatibilities as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
def test_GradientModifiers_Incompatibilities(self, request, workspace, editor, launcher_platform):
|
||||
from .EditorScripts import GradientModifiers_Incompatibilities as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
def test_GradientPreviewSettings_DefaultPinnedEntityIsSelf(self, request, workspace, editor, launcher_platform):
|
||||
from .EditorScripts import GradientPreviewSettings_DefaultPinnedEntityIsSelf as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
def test_GradientPreviewSettings_ClearingPinnedEntitySetsPreviewToOrigin(self, request, workspace, editor, launcher_platform):
|
||||
from .EditorScripts import GradientPreviewSettings_ClearingPinnedEntitySetsPreviewToOrigin as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
def test_GradientSampling_GradientReferencesAddRemoveSuccessfully(self, request, workspace, editor, launcher_platform):
|
||||
from .EditorScripts import GradientSampling_GradientReferencesAddRemoveSuccessfully as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
def test_GradientSurfaceTagEmitter_ComponentDependencies(self, request, workspace, editor, launcher_platform):
|
||||
from .EditorScripts import GradientSurfaceTagEmitter_ComponentDependencies as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
def test_GradientSurfaceTagEmitter_SurfaceTagsAddRemoveSuccessfully(self, request, workspace, editor, launcher_platform):
|
||||
from .EditorScripts import GradientSurfaceTagEmitter_SurfaceTagsAddRemoveSuccessfully as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
def test_GradientTransform_RequiresShape(self, request, workspace, editor, launcher_platform):
|
||||
from .EditorScripts import GradientTransform_RequiresShape as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
def test_GradientTransform_FrequencyZoomCanBeSetBeyondSliderRange(self, request, workspace, editor, launcher_platform):
|
||||
from .EditorScripts import GradientTransform_FrequencyZoomCanBeSetBeyondSliderRange as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
def test_GradientTransform_ComponentIncompatibleWithSpawners(self, request, workspace, editor, launcher_platform):
|
||||
from .EditorScripts import GradientTransform_ComponentIncompatibleWithSpawners as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
def test_GradientTransform_ComponentIncompatibleWithExpectedGradients(self, request, workspace, editor, launcher_platform):
|
||||
from .EditorScripts import GradientTransform_ComponentIncompatibleWithExpectedGradients as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
def test_ImageGradient_RequiresShape(self, request, workspace, editor, launcher_platform):
|
||||
from .EditorScripts import ImageGradient_RequiresShape as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
|
||||
def test_ImageGradient_ProcessedImageAssignedSuccessfully(self, request, workspace, editor, launcher_platform):
|
||||
from .EditorScripts import ImageGradient_ProcessedImageAssignedSuccessfully as test_module
|
||||
self._run_test(request, workspace, editor, test_module)
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
"""
|
||||
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
|
||||
"""
|
||||
|
||||
import pytest
|
||||
|
||||
from ly_test_tools.o3de.editor_test import EditorSingleTest, EditorSharedTest, EditorParallelTest, EditorTestSuite
|
||||
|
||||
|
||||
@pytest.mark.SUITE_periodic
|
||||
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
|
||||
@pytest.mark.parametrize("project", ["AutomatedTesting"])
|
||||
class TestAutomation(EditorTestSuite):
|
||||
|
||||
class test_GradientGenerators_Incompatibilities(EditorSharedTest):
|
||||
from .EditorScripts import GradientGenerators_Incompatibilities as test_module
|
||||
|
||||
class test_GradientModifiers_Incompatibilities(EditorSharedTest):
|
||||
from .EditorScripts import GradientModifiers_Incompatibilities as test_module
|
||||
|
||||
class test_GradientPreviewSettings_DefaultPinnedEntityIsSelf(EditorSharedTest):
|
||||
from .EditorScripts import GradientPreviewSettings_DefaultPinnedEntityIsSelf as test_module
|
||||
|
||||
class test_GradientPreviewSettings_ClearingPinnedEntitySetsPreviewToOrigin(EditorSharedTest):
|
||||
from .EditorScripts import GradientPreviewSettings_ClearingPinnedEntitySetsPreviewToOrigin as test_module
|
||||
|
||||
class test_GradientSampling_GradientReferencesAddRemoveSuccessfully(EditorSharedTest):
|
||||
from .EditorScripts import GradientSampling_GradientReferencesAddRemoveSuccessfully as test_module
|
||||
|
||||
class test_GradientSurfaceTagEmitter_ComponentDependencies(EditorSharedTest):
|
||||
from .EditorScripts import GradientSurfaceTagEmitter_ComponentDependencies as test_module
|
||||
|
||||
class test_GradientSurfaceTagEmitter_SurfaceTagsAddRemoveSuccessfully(EditorSharedTest):
|
||||
from .EditorScripts import GradientSurfaceTagEmitter_SurfaceTagsAddRemoveSuccessfully as test_module
|
||||
|
||||
class test_GradientTransform_RequiresShape(EditorSharedTest):
|
||||
from .EditorScripts import GradientTransform_RequiresShape as test_module
|
||||
|
||||
class test_GradientTransform_FrequencyZoomCanBeSetBeyondSliderRange(EditorSharedTest):
|
||||
from .EditorScripts import GradientTransform_FrequencyZoomCanBeSetBeyondSliderRange as test_module
|
||||
|
||||
class test_GradientTransform_ComponentIncompatibleWithSpawners(EditorSharedTest):
|
||||
from .EditorScripts import GradientTransform_ComponentIncompatibleWithSpawners as test_module
|
||||
|
||||
class test_GradientTransform_ComponentIncompatibleWithExpectedGradients(EditorSharedTest):
|
||||
from .EditorScripts import GradientTransform_ComponentIncompatibleWithExpectedGradients as test_module
|
||||
|
||||
class test_ImageGradient_RequiresShape(EditorSharedTest):
|
||||
from .EditorScripts import ImageGradient_RequiresShape as test_module
|
||||
|
||||
class test_ImageGradient_ProcessedImageAssignedSuccessfully(EditorSharedTest):
|
||||
from .EditorScripts import ImageGradient_ProcessedImageAssignedSuccessfully as test_module
|
||||
Reference in New Issue
Block a user