Firstborn/Library/PackageCache/com.unity.terrain-tools@4.0.3/Tests/Editor/BaseTests.cs
Schaken-Mods b486678290 Library -Artifacts
Library -Artifacts
2023-03-28 12:24:16 -05:00

27 lines
1.1 KiB
C#

using NUnit.Framework;
namespace UnityEditor.TerrainTools
{
public class BaseTests
{
// private ulong m_PrevTextureMemory; // TODO
private int m_PrevRTHandlesCount;
[SetUp]
public virtual void Setup()
{
// m_PrevTextureMemory = Texture.totalTextureMemory;
m_PrevRTHandlesCount = RTUtils.GetHandleCount();
}
[TearDown]
public virtual void Teardown()
{
// check Texture memory and RTHandle count
// var currentTextureMemory = Texture.totalTextureMemory;
// Assert.True(m_PrevTextureMemory == currentTextureMemory, $"Texture memory leak. Was {m_PrevTextureMemory} but is now {currentTextureMemory}. Diff = {currentTextureMemory - m_PrevTextureMemory}");
var currentRTHandlesCount = RTUtils.GetHandleCount();
Assert.True(m_PrevRTHandlesCount == RTUtils.GetHandleCount(), $"RTHandle leak. Was {m_PrevRTHandlesCount} but is now {currentRTHandlesCount}. Diff = {currentRTHandlesCount - m_PrevRTHandlesCount}");
}
}
}