File size: 1,284 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
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;

namespace UnityEngine.UI.Tests
{
    // Hook into the graphic callback so we can do our check.
    public class ImageHook : Image
    {
        public bool isGeometryUpdated;
        public bool isLayoutRebuild;
        public bool isMaterialRebuilt;
        public Rect cachedClipRect;

        public void ResetTest()
        {
            isGeometryUpdated = false;
            isLayoutRebuild = false;
            isMaterialRebuilt = false;
        }

        public override void SetLayoutDirty()
        {
            base.SetLayoutDirty();
            isLayoutRebuild = true;
        }

        public override void SetMaterialDirty()
        {
            base.SetMaterialDirty();
            isMaterialRebuilt = true;
        }

        protected override void UpdateGeometry()
        {
            base.UpdateGeometry();
            isGeometryUpdated = true;
        }

        public override void SetClipRect(Rect clipRect, bool validRect)
        {
            cachedClipRect = clipRect;
            if (validRect)
                canvasRenderer.EnableRectClipping(clipRect);
            else
                canvasRenderer.DisableRectClipping();
        }
    }
}