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