A game about forced loneliness, made by TACStudios
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 63 lines 2.4 kB view raw
1using System; 2using NUnit.Framework; 3using NUnit.Framework.Interfaces; 4using NUnit.Framework.Internal; 5 6namespace UnityEditor.TestTools 7{ 8 /// <summary> 9 /// Ignore attributes dedicated to Asset Import Pipeline backend version handling. 10 /// </summary> 11 internal static class AssetPipelineIgnore 12 { 13 internal enum AssetPipelineBackend 14 { 15 V1, 16 V2 17 } 18 19 /// <summary> 20 /// Ignore the test when running with the legacy Asset Import Pipeline V1 backend. 21 /// </summary> 22 internal class IgnoreInV1 : AssetPipelineIgnoreAttribute 23 { 24 public IgnoreInV1(string ignoreReason) : base(AssetPipelineBackend.V1, ignoreReason) {} 25 } 26 27 /// <summary> 28 /// Ignore the test when running with the latest Asset Import Pipeline V2 backend. 29 /// </summary> 30 internal class IgnoreInV2 : AssetPipelineIgnoreAttribute 31 { 32 public IgnoreInV2(string ignoreReason) : base(AssetPipelineBackend.V2, ignoreReason) {} 33 } 34 35 [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)] 36 internal class AssetPipelineIgnoreAttribute : NUnitAttribute, IApplyToTest 37 { 38 private readonly string m_IgnoreReason; 39 private readonly AssetPipelineBackend m_IgnoredBackend; 40 private static readonly AssetPipelineBackend k_ActiveBackend = AssetDatabase.IsV2Enabled() 41 ? AssetPipelineBackend.V2 42 : AssetPipelineBackend.V1; 43 44 private static string ActiveBackendName = Enum.GetName(typeof(AssetPipelineBackend), k_ActiveBackend); 45 46 public AssetPipelineIgnoreAttribute(AssetPipelineBackend backend, string ignoreReason) 47 { 48 m_IgnoredBackend = backend; 49 m_IgnoreReason = ignoreReason; 50 } 51 52 public void ApplyToTest(Test test) 53 { 54 if (k_ActiveBackend == m_IgnoredBackend) 55 { 56 test.RunState = RunState.Ignored; 57 var skipReason = string.Format("Not supported by asset pipeline {0} backend {1}", ActiveBackendName, m_IgnoreReason); 58 test.Properties.Add(PropertyNames.SkipReason, skipReason); 59 } 60 } 61 } 62 } 63}