PlaymodeTestsControllerSettings.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Linq;
  3. using NUnit.Framework.Interfaces;
  4. using NUnit.Framework.Internal.Filters;
  5. using UnityEngine.SceneManagement;
  6. using UnityEngine.TestTools.TestRunner.GUI;
  7. namespace UnityEngine.TestTools.TestRunner
  8. {
  9. [Serializable]
  10. internal class PlaymodeTestsControllerSettings
  11. {
  12. [SerializeField]
  13. public RuntimeTestRunnerFilter[] filters;
  14. public bool sceneBased;
  15. public string originalScene;
  16. public string bootstrapScene;
  17. public static PlaymodeTestsControllerSettings CreateRunnerSettings(RuntimeTestRunnerFilter[] filters)
  18. {
  19. var settings = new PlaymodeTestsControllerSettings
  20. {
  21. filters = filters,
  22. sceneBased = false,
  23. originalScene = SceneManager.GetActiveScene().path,
  24. bootstrapScene = null
  25. };
  26. return settings;
  27. }
  28. internal ITestFilter BuildNUnitFilter()
  29. {
  30. return new OrFilter(filters.Select(f => f.BuildNUnitFilter()).ToArray());
  31. }
  32. }
  33. }