test_RotationModifier.py 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 logging
  11. import os
  12. import pytest
  13. # Bail on the test if ly_test_tools doesn't exist.
  14. pytest.importorskip("ly_test_tools")
  15. import automatedtesting_shared.hydra_test_utils as hydra
  16. import ly_test_tools.environment.file_system as file_system
  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 TestRotationModifier(object):
  24. @pytest.fixture(autouse=True)
  25. def setup_teardown(self, request, workspace, project, level):
  26. def teardown():
  27. # delete temp level
  28. file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
  29. # Setup - add the teardown finalizer
  30. request.addfinalizer(teardown)
  31. file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
  32. @pytest.mark.test_case_id("C4896922")
  33. @pytest.mark.SUITE_periodic
  34. def test_RotationModifier_InstancesRotateWithinRange(self, request, editor, level, launcher_platform) -> None:
  35. """
  36. Launches editor and run test script to test that rotation modifier works for all axis.
  37. Manual test case: C4896922
  38. """
  39. expected_lines = [
  40. "'Spawner Entity' created",
  41. "'Surface Entity' created",
  42. "'Gradient Entity' created",
  43. "Entity has a Vegetation Asset List component",
  44. "Entity has a Vegetation Layer Spawner component",
  45. "Entity has a Vegetation Rotation Modifier component",
  46. "Entity has a Box Shape component",
  47. "Entity has a Constant Gradient component",
  48. "RotationModifier_InstancesRotateWithinRange: result=SUCCESS"
  49. ]
  50. hydra.launch_and_validate_results(
  51. request,
  52. test_directory,
  53. editor,
  54. "RotationModifier_InstancesRotateWithinRange.py",
  55. expected_lines,
  56. cfg_args=[level]
  57. )
  58. @pytest.mark.test_case_id("C4814460")
  59. @pytest.mark.SUITE_periodic
  60. def test_RotationModifierOverrides_InstancesRotateWithinRange(self, request, editor, level, launcher_platform) -> None:
  61. expected_lines = [
  62. "'Spawner Entity' created",
  63. "'Surface Entity' created",
  64. "'Gradient Entity' created",
  65. "Entity has a Vegetation Layer Spawner component",
  66. "Entity has a Vegetation Asset List component",
  67. "Spawner Entity Box Shape|Box Configuration|Dimensions: SUCCESS",
  68. "Entity has a Vegetation Rotation Modifier component",
  69. "Spawner Entity Configuration|Embedded Assets|[0]|Rotation Modifier|Override Enabled: SUCCESS",
  70. "Spawner Entity Configuration|Allow Per-Item Overrides: SUCCESS",
  71. "Entity has a Constant Gradient component",
  72. "Entity has a Box Shape component",
  73. "Spawner Entity Configuration|Rotation Z|Gradient|Gradient Entity Id: SUCCESS",
  74. "RotationModifierOverrides_InstancesRotateWithinRange: result=SUCCESS"
  75. ]
  76. hydra.launch_and_validate_results(
  77. request,
  78. test_directory,
  79. editor,
  80. "RotationModifierOverrides_InstancesRotateWithinRange.py",
  81. expected_lines,
  82. cfg_args=[level]
  83. )