ZMWSLI0-SL2021-GR11/Projekt/MWSProjekt/Library/PackageCache/com.unity.ugui@1.0.0/Tests/Runtime/Image/TestableImage.cs

29 lines
788 B
C#
Raw Normal View History

2021-07-05 21:20:56 +02:00
using NUnit.Framework;
using UnityEngine.UI;
using System.Reflection;
public class TestableImage : Image
{
public bool isOnPopulateMeshCalled = false;
public bool isGeometryUpdated = false;
// Hook into the mesh generation so we can do our check.
protected override void OnPopulateMesh(VertexHelper toFill)
{
base.OnPopulateMesh(toFill);
Assert.That(toFill.currentVertCount, Is.GreaterThan(0), "Expected the mesh to be filled but it was not. Should not have a mesh with zero vertices.");
isOnPopulateMeshCalled = true;
}
protected override void UpdateGeometry()
{
base.UpdateGeometry();
isGeometryUpdated = true;
}
public void GenerateImageData(VertexHelper vh)
{
OnPopulateMesh(vh);
}
}