Firstborn/Library/PackageCache/com.unity.terrain-tools@4.0.5/Tests/Editor/BaseTests.cs
Schaken-Mods 4ff395c862 Finished the NPC Creator tool
Finished the NPC Creator tool
2023-04-27 18:37:28 -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}");
}
}
}