A game about forced loneliness, made by TACStudios
at master 62 lines 2.3 kB view raw
1using System; 2 3namespace UnityEngine.TestTools 4{ 5 /// <summary> 6 /// Implement this interface if you want to define a set of actions to run as a pre-build step. 7 /// </summary> 8 public interface IPrebuildSetup 9 { 10 /// <summary> 11 /// Implement this method to call actions automatically before the build process. 12 /// </summary> 13 /// <example> 14 /// <code> 15 /// [TestFixture] 16 /// public class CreateSpriteTest : IPrebuildSetup 17 /// { 18 /// Texture2D m_Texture; 19 /// Sprite m_Sprite; 20 /// 21 /// public void Setup() 22 /// { 23 /// #if UNITY_EDITOR 24 /// var spritePath = "Assets/Resources/Circle.png"; 25 /// 26 /// var ti = UnityEditor.AssetImporter.GetAtPath(spritePath) as UnityEditor.TextureImporter; 27 /// 28 /// ti.textureCompression = UnityEditor.TextureImporterCompression.Uncompressed; 29 /// 30 /// ti.SaveAndReimport(); 31 /// #endif 32 /// } 33 /// 34 /// [SetUp] 35 /// public void SetUpTest() 36 /// { 37 /// m_Texture = Resources.Load&lt;Texture2D&gt;("Circle"); 38 /// } 39 /// 40 /// [Test] 41 /// public void WhenNullTextureIsPassed_CreateShouldReturnNullSprite() 42 /// { 43 /// // Check with Valid Texture. 44 /// 45 /// LogAssert.Expect(LogType.Log, "Circle Sprite Created"); 46 /// 47 /// Sprite.Create(m_Texture, new Rect(0, 0, m_Texture.width, m_Texture.height), new Vector2(0.5f, 0.5f)); 48 /// 49 /// Debug.Log("Circle Sprite Created"); 50 /// 51 /// // Check with NULL Texture. Should return NULL Sprite. 52 /// m_Sprite = Sprite.Create(null, new Rect(0, 0, m_Texture.width, m_Texture.height), new Vector2(0.5f, 0.5f)); 53 /// 54 /// Assert.That(m_Sprite, Is.Null, "Sprite created with null texture should be null"); 55 /// } 56 /// } 57 /// </code> 58 /// > **Tip**: Use `#if UNITY_EDITOR` if you want to access Editor only APIs, but the setup/cleanup is inside a **Play Mode** assembly. 59 /// </example> 60 void Setup(); 61 } 62}