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

IPrebuildSceneSetup.cs 2.3KB

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