暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

TestPlatform.cs 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. namespace UnityEngine.TestTools
  3. {
  4. /// <summary>
  5. /// A flag indicating the targeted test platforms.
  6. /// </summary>
  7. [Flags]
  8. [Serializable]
  9. public enum TestPlatform : byte
  10. {
  11. /// <summary>
  12. /// Both platforms.
  13. /// </summary>
  14. All = 0xFF,
  15. /// <summary>
  16. /// The EditMode test platform.
  17. /// </summary>
  18. EditMode = 1 << 1,
  19. /// <summary>
  20. /// The PlayMode test platform.
  21. /// </summary>
  22. PlayMode = 1 << 2
  23. }
  24. internal static class TestPlatformEnumExtensions
  25. {
  26. public static bool IsFlagIncluded(this TestPlatform flags, TestPlatform flag)
  27. {
  28. return (flags & flag) == flag;
  29. }
  30. public static TestPlatform MergeFlags(this TestPlatform[] flags)
  31. {
  32. TestPlatform mergedFlag = default;
  33. foreach (var flag in flags)
  34. {
  35. mergedFlag |= flag;
  36. }
  37. return mergedFlag;
  38. }
  39. }
  40. }