test_PositionModifier.py 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. import os
  11. import pytest
  12. import logging
  13. # Bail on the test if ly_test_tools doesn't exist.
  14. pytest.importorskip('ly_test_tools')
  15. import ly_test_tools.environment.file_system as file_system
  16. import automatedtesting_shared.hydra_test_utils as hydra
  17. logger = logging.getLogger(__name__)
  18. test_directory = os.path.join(os.path.dirname(__file__), 'EditorScripts')
  19. @pytest.mark.parametrize("project", ["AutomatedTesting"])
  20. @pytest.mark.parametrize("level", ["tmp_level"])
  21. @pytest.mark.usefixtures("automatic_process_killer")
  22. @pytest.mark.parametrize("launcher_platform", ['windows_editor'])
  23. class TestPositionModifier(object):
  24. @pytest.fixture(autouse=True)
  25. def setup_teardown(self, request, workspace, project, level):
  26. def teardown():
  27. file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
  28. request.addfinalizer(teardown)
  29. file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
  30. @pytest.mark.test_case_id("C4874099", "C4814461")
  31. @pytest.mark.SUITE_periodic
  32. def test_PositionModifier_ComponentAndOverrides_InstancesPlantAtSpecifiedOffsets(self, request, editor, level,
  33. launcher_platform):
  34. expected_lines = [
  35. "'Instance Spawner' created",
  36. "Vegetation Position Modifier component was added to entity",
  37. "'Planting Surface' created",
  38. "Entity has a Constant Gradient component",
  39. "PositionModifierComponentAndOverrides_InstanceOffset: result=SUCCESS",
  40. ]
  41. hydra.launch_and_validate_results(
  42. request,
  43. test_directory,
  44. editor,
  45. "PositionModifier_ComponentAndOverrides_InstancesPlantAtSpecifiedOffsets.py",
  46. expected_lines,
  47. cfg_args=[level]
  48. )
  49. @pytest.mark.test_case_id("C4874100")
  50. @pytest.mark.SUITE_sandbox
  51. def test_PositionModifier_AutoSnapToSurfaceWorks(self, request, editor, level, launcher_platform):
  52. expected_lines = [
  53. "'Instance Spawner' created",
  54. "'Planting Surface' created",
  55. "Instance Spawner Configuration|Position X|Range Min: SUCCESS",
  56. "Instance Spawner Configuration|Position X|Range Max: SUCCESS",
  57. "PositionModifier_AutoSnapToSurface: result=SUCCESS"
  58. ]
  59. hydra.launch_and_validate_results(
  60. request,
  61. test_directory,
  62. editor,
  63. "PositionModifier_AutoSnapToSurfaceWorks.py",
  64. expected_lines,
  65. cfg_args=[level]
  66. )