test_GradientIncompatibilities.py 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. """
  2. All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
  3. its licensors.
  4. For complete copyright and license terms please see the LICENSE at the root of this
  5. distribution (the "License"). All use of this software is governed by the License,
  6. or, if provided, by the license below or the license accompanying this file. Do not
  7. remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. """
  10. """
  11. Tests that the Gradient Generator components are incompatible with Vegetation Area components
  12. """
  13. import os
  14. import pytest
  15. pytest.importorskip('ly_test_tools')
  16. import ly_test_tools.environment.file_system as file_system
  17. import automatedtesting_shared.hydra_test_utils as hydra
  18. test_directory = os.path.join(os.path.dirname(__file__), 'EditorScripts')
  19. gradient_generators = [
  20. 'Altitude Gradient',
  21. 'Constant Gradient',
  22. 'FastNoise Gradient',
  23. 'Image Gradient',
  24. 'Perlin Noise Gradient',
  25. 'Random Noise Gradient',
  26. 'Shape Falloff Gradient',
  27. 'Slope Gradient',
  28. 'Surface Mask Gradient'
  29. ]
  30. gradient_modifiers = [
  31. 'Dither Gradient Modifier',
  32. 'Gradient Mixer',
  33. 'Invert Gradient Modifier',
  34. 'Levels Gradient Modifier',
  35. 'Posterize Gradient Modifier',
  36. 'Smooth-Step Gradient Modifier',
  37. 'Threshold Gradient Modifier'
  38. ]
  39. vegetation_areas = [
  40. 'Vegetation Layer Spawner',
  41. 'Vegetation Layer Blender',
  42. 'Vegetation Layer Blocker',
  43. 'Vegetation Layer Blocker (Mesh)'
  44. ]
  45. all_gradients = gradient_modifiers + gradient_generators
  46. @pytest.mark.parametrize('project', ['AutomatedTesting'])
  47. @pytest.mark.parametrize('level', ['tmp_level'])
  48. @pytest.mark.usefixtures("automatic_process_killer")
  49. @pytest.mark.parametrize("launcher_platform", ['windows_editor'])
  50. class TestGradientIncompatibilities(object):
  51. @pytest.fixture(autouse=True)
  52. def setup_teardown(self, request, workspace, project, level):
  53. def teardown():
  54. file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
  55. request.addfinalizer(teardown)
  56. @pytest.mark.test_case_id('C2691648', 'C2691649', 'C2691650', 'C2691651',
  57. 'C2691653', 'C2691656', 'C2691657', 'C2691658',
  58. 'C2691647', 'C2691655')
  59. @pytest.mark.SUITE_periodic
  60. def test_GradientGenerators_Incompatibilities(self, request, editor, level, launcher_platform):
  61. cfg_args = [level]
  62. expected_lines = []
  63. for gradient_generator in gradient_generators:
  64. for vegetation_area in vegetation_areas:
  65. expected_lines.append(f"{gradient_generator} is disabled before removing {vegetation_area} component")
  66. expected_lines.append(f"{gradient_generator} is enabled after removing {vegetation_area} component")
  67. expected_lines.append("GradientGeneratorIncompatibilities: result=SUCCESS")
  68. hydra.launch_and_validate_results(request, test_directory, editor,
  69. 'GradientGenerators_Incompatibilities.py',
  70. expected_lines=expected_lines, cfg_args=cfg_args)
  71. @pytest.mark.test_case_id('C3416464', 'C3416546', 'C3961318', 'C3961319',
  72. 'C3961323', 'C3961324', 'C3980656', 'C3980657',
  73. 'C3980661', 'C3980662', 'C3980666', 'C3980667',
  74. 'C2691652')
  75. @pytest.mark.SUITE_periodic
  76. def test_GradientModifiers_Incompatibilities(self, request, editor, level, launcher_platform):
  77. cfg_args = [level]
  78. expected_lines = []
  79. for gradient_modifier in gradient_modifiers:
  80. for vegetation_area in vegetation_areas:
  81. expected_lines.append(f"{gradient_modifier} is disabled before removing {vegetation_area} component")
  82. expected_lines.append(f"{gradient_modifier} is enabled after removing {vegetation_area} component")
  83. for conflicting_gradient in all_gradients:
  84. expected_lines.append(f"{gradient_modifier} is disabled before removing {conflicting_gradient} component")
  85. expected_lines.append(f"{gradient_modifier} is enabled after removing {conflicting_gradient} component")
  86. expected_lines.append("GradientModifiersIncompatibilities: result=SUCCESS")
  87. hydra.launch_and_validate_results(request, test_directory, editor,
  88. 'GradientModifiers_Incompatibilities.py',
  89. expected_lines=expected_lines, cfg_args=cfg_args)