test_GradientSampling.py 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 TestGradientSampling(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("C3526311")
  31. @pytest.mark.SUITE_periodic
  32. def test_GradientSampling_GradientReferencesAddRemoveSuccessfully(self, request, editor, level, launcher_platform):
  33. expected_lines = [
  34. "Entity has a Random Noise Gradient component",
  35. "Entity has a Gradient Transform Modifier component",
  36. "Entity has a Box Shape component",
  37. "Entity has a Dither Gradient Modifier component",
  38. "Gradient Generator is pinned to the Dither Gradient Modifier successfully",
  39. "Gradient Generator is cleared from the Dither Gradient Modifier successfully",
  40. "Entity has a Invert Gradient Modifier component",
  41. "Gradient Generator is pinned to the Invert Gradient Modifier successfully",
  42. "Gradient Generator is cleared from the Invert Gradient Modifier successfully",
  43. "Entity has a Levels Gradient Modifier component",
  44. "Gradient Generator is pinned to the Levels Gradient Modifier successfully",
  45. "Gradient Generator is cleared from the Levels Gradient Modifier successfully",
  46. "Entity has a Posterize Gradient Modifier component",
  47. "Gradient Generator is pinned to the Posterize Gradient Modifier successfully",
  48. "Gradient Generator is cleared from the Posterize Gradient Modifier successfully",
  49. "Entity has a Smooth-Step Gradient Modifier component",
  50. "Gradient Generator is pinned to the Smooth-Step Gradient Modifier successfully",
  51. "Gradient Generator is cleared from the Smooth-Step Gradient Modifier successfully",
  52. "Entity has a Threshold Gradient Modifier component",
  53. "Gradient Generator is pinned to the Threshold Gradient Modifier successfully",
  54. "Gradient Generator is cleared from the Threshold Gradient Modifier successfully",
  55. ]
  56. unexpected_lines = [
  57. "Failed to pin Gradient Generator to the Dither Gradient Modifier",
  58. "Failed to clear Gradient Generator from the Dither Gradient Modifier",
  59. "Failed to pin Gradient Generator to the Invert Gradient Modifier",
  60. "Failed to clear Gradient Generator from the Invert Gradient Modifier",
  61. "Failed to pin Gradient Generator to the Levels Gradient Modifier",
  62. "Failed to clear Gradient Generator from the Levels Gradient Modifier",
  63. "Failed to pin Gradient Generator to the Posterize Gradient Modifier",
  64. "Failed to clear Gradient Generator from the Posterize Gradient Modifier",
  65. "Failed to pin Gradient Generator to the Smooth-Step Gradient Modifier",
  66. "Failed to clear Gradient Generator from the Smooth-Step Gradient Modifier",
  67. "Failed to pin Gradient Generator to the Threshold Gradient Modifier",
  68. "Failed to clear Gradient Generator from the Threshold Gradient Modifier",
  69. ]
  70. hydra.launch_and_validate_results(
  71. request,
  72. test_directory,
  73. editor,
  74. "GradientSampling_GradientReferencesAddRemoveSuccessfully.py",
  75. expected_lines,
  76. unexpected_lines,
  77. cfg_args=[level]
  78. )