test_ImageGradient.py 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. # Bail on the test if ly_test_tools doesn't exist.
  13. pytest.importorskip('ly_test_tools')
  14. import ly_test_tools.environment.file_system as file_system
  15. import automatedtesting_shared.hydra_test_utils as hydra
  16. test_directory = os.path.join(os.path.dirname(__file__), 'EditorScripts')
  17. @pytest.mark.parametrize('project', ['AutomatedTesting'])
  18. @pytest.mark.parametrize('level', ['tmp_level'])
  19. @pytest.mark.usefixtures("automatic_process_killer")
  20. @pytest.mark.parametrize("launcher_platform", ['windows_editor'])
  21. class TestImageGradientRequiresShape(object):
  22. @pytest.fixture(autouse=True)
  23. def setup_teardown(self, request, workspace, project, level):
  24. def teardown():
  25. file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", level)], True, True)
  26. request.addfinalizer(teardown)
  27. @pytest.mark.test_case_id('C2707570')
  28. @pytest.mark.SUITE_periodic
  29. def test_ImageGradient_RequiresShape(self, request, editor, level, launcher_platform):
  30. cfg_args = [level]
  31. expected_lines = [
  32. "Image Gradient component was added to entity, but the component is disabled",
  33. "Gradient Transform Modifier component was added to entity, but the component is disabled",
  34. "Image Gradient component is not active without a Shape component on the Entity",
  35. "Box Shape component was added to entity",
  36. "Image Gradient component is active now that the Entity has a Shape",
  37. "ImageGradientRequiresShape: result=SUCCESS"
  38. ]
  39. hydra.launch_and_validate_results(request, test_directory, editor,
  40. 'ImageGradient_RequiresShape.py',
  41. expected_lines=expected_lines, cfg_args=cfg_args)
  42. @pytest.mark.test_case_id("C3829430")
  43. @pytest.mark.SUITE_periodic
  44. def test_ImageGradient_ProcessedImageAssignedSuccessfully(self, request, editor, level, launcher_platform):
  45. expected_lines = [
  46. "Image Gradient Entity created",
  47. "Entity has a Image Gradient component",
  48. "Entity has a Gradient Transform Modifier component",
  49. "Entity has a Box Shape component",
  50. "lumberyard_gsi.png was found in the workspace",
  51. "Entity Configuration|Image Asset: SUCCESS",
  52. "ImageGradient_ProcessedImageAssignedSucessfully: result=SUCCESS",
  53. ]
  54. hydra.launch_and_validate_results(
  55. request,
  56. test_directory,
  57. editor,
  58. "ImageGradient_ProcessedImageAssignedSuccessfully.py",
  59. expected_lines,
  60. cfg_args=[level]
  61. )