A game about forced loneliness, made by TACStudios
1using NUnit.Framework;
2using UnityEngine.UI;
3using System.Reflection;
4
5public class TestableImage : Image
6{
7 public bool isOnPopulateMeshCalled = false;
8 public bool isGeometryUpdated = false;
9
10 // Hook into the mesh generation so we can do our check.
11 protected override void OnPopulateMesh(VertexHelper toFill)
12 {
13 base.OnPopulateMesh(toFill);
14 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.");
15 isOnPopulateMeshCalled = true;
16 }
17
18 protected override void UpdateGeometry()
19 {
20 base.UpdateGeometry();
21 isGeometryUpdated = true;
22 }
23
24 public void GenerateImageData(VertexHelper vh)
25 {
26 OnPopulateMesh(vh);
27 }
28}