TextureLoadTests.cs 1012 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using NUnit.Framework;
  2. using UnityEngine;
  3. using UnityEngine.Profiling;
  4. using Unity.PlasticSCM.Editor.UI;
  5. namespace Unity.PlasticSCM.Tests.Editor.UI
  6. {
  7. [TestFixture]
  8. internal class TextureLoadTests
  9. {
  10. // NOTE(rafa): thes are no real test just use cases to verify in the profiler what happens when load more than once the same texture.
  11. [Test]
  12. public void OneLoad_Reference()
  13. {
  14. Profiler.BeginSample("TextureLoadTest - One load");
  15. var icon = Images.GetPlasticIcon();
  16. Profiler.EndSample();
  17. Assert.NotNull(icon);
  18. }
  19. [Test]
  20. public void OneHundredLoads_Reference()
  21. {
  22. var icons = new Texture[100];
  23. Profiler.BeginSample("TextureLoadTest - One hundred loads");
  24. for (int i = 0; i < 100; i++)
  25. icons[i] = Images.GetPlasticIcon();
  26. Profiler.EndSample();
  27. CollectionAssert.AllItemsAreNotNull(icons);
  28. }
  29. }
  30. }