scene_settings_tests.py 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. """
  2. Copyright (c) Contributors to the Open 3D Engine Project.
  3. For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. SPDX-License-Identifier: Apache-2.0 OR MIT
  5. """
  6. import os
  7. import pytest
  8. import shutil
  9. import ly_test_tools.environment.file_system as file_system
  10. from ly_test_tools.o3de.editor_test import EditorTestSuite, EditorSingleTest
  11. import tempfile
  12. def cleanup_test_files(workspace, test_file_names):
  13. for test_file_name in test_file_names:
  14. file_system.delete([os.path.join(workspace.paths.engine_root(), "AutomatedTesting", test_file_name)],
  15. True, True)
  16. file_system.delete([os.path.join(workspace.paths.engine_root(), "AutomatedTesting", test_file_name +".assetinfo")],
  17. True, True)
  18. def setup_test_files(workspace, test_file_names):
  19. cleanup_test_files(workspace, test_file_names)
  20. for test_file_name in test_file_names:
  21. test_file_source = os.path.join(os.path.dirname(os.path.abspath(__file__)), test_file_name)
  22. test_file_destination = os.path.join(workspace.paths.engine_root(), "AutomatedTesting", test_file_name)
  23. shutil.copyfile(test_file_source, test_file_destination)
  24. @pytest.mark.SUITE_periodic
  25. @pytest.mark.parametrize("launcher_platform", ['windows_editor'])
  26. @pytest.mark.parametrize("project", ["AutomatedTesting"])
  27. class TestAutomation(EditorTestSuite):
  28. global_extra_cmdline_args = []
  29. class scene_settings_tests_in_editor(EditorSingleTest):
  30. @classmethod
  31. def setup(self, instance, request, workspace):
  32. self.test_file_names = ["auto_test_fbx.fbx"]
  33. setup_test_files(workspace, self.test_file_names)
  34. @classmethod
  35. def teardown(self, instance, request, workspace, editor_test_results):
  36. cleanup_test_files(workspace, self.test_file_names)
  37. from .tests import scene_settings_tests_in_editor as test_module
  38. class scene_settings_clear_unsaved_changes(EditorSingleTest):
  39. @classmethod
  40. def setup(self, instance, request, workspace):
  41. self.test_file_names = ["auto_test_fbx.fbx"]
  42. setup_test_files(workspace, self.test_file_names)
  43. @classmethod
  44. def teardown(self, instance, request, workspace, editor_test_results):
  45. cleanup_test_files(workspace, self.test_file_names)
  46. from .tests import scene_settings_clear_unsaved_changes as test_module
  47. class scene_settings_max_prefab_groups_is_one(EditorSingleTest):
  48. @classmethod
  49. def setup(self, instance, request, workspace):
  50. self.test_file_names = ["auto_test_fbx.fbx"]
  51. setup_test_files(workspace, self.test_file_names)
  52. @classmethod
  53. def teardown(self, instance, request, workspace, editor_test_results):
  54. cleanup_test_files(workspace, self.test_file_names)
  55. from .tests import scene_settings_max_prefab_groups_is_one as test_module
  56. class scene_settings_tests_readonly_rule(EditorSingleTest):
  57. @classmethod
  58. def setup(self, instance, request, workspace):
  59. self.test_file_names = ["auto_test_fbx.fbx"]
  60. setup_test_files(workspace, self.test_file_names)
  61. @classmethod
  62. def teardown(self, instance, request, workspace, editor_test_results):
  63. cleanup_test_files(workspace, self.test_file_names)
  64. from .tests import scene_settings_readonly_rule_test as test_module
  65. class scene_settings_procedural_mesh_groups_test(EditorSingleTest):
  66. @classmethod
  67. def setup(self, instance, request, workspace):
  68. self.test_file_names = ["auto_test_fbx.fbx"]
  69. setup_test_files(workspace, self.test_file_names)
  70. @classmethod
  71. def teardown(self, instance, request, workspace, editor_test_results):
  72. cleanup_test_files(workspace, self.test_file_names)
  73. from .tests import scene_settings_procedural_mesh_groups_test as test_module
  74. class scene_settings_manifest_vector_widget_tests_in_editor(EditorSingleTest):
  75. @classmethod
  76. def setup(self, instance, request, workspace):
  77. self.test_file_names = ["Jack_Death_Fall_Back_ZUp.fbx", "Jack_Death_Fall_Back_ZUp.fbx.assetinfo"]
  78. setup_test_files(workspace, self.test_file_names)
  79. @classmethod
  80. def teardown(self, instance, request, workspace, editor_test_results):
  81. cleanup_test_files(workspace, self.test_file_names)
  82. from .tests import scene_settings_manifest_vector_widget_tests_in_editor as test_module