public void Cleanup() { SceneView.duringSceneGui -= OnSceneGUI; Selection.activeObject = null; if (onPaintHistory != null) { onPaintHistory.Clear(); } // delete test resources commonUIInstance?.brushMaskFilterStack?.Clear(true); PaintContext.ApplyDelayedActions(); // apply before destroying terrain and terrainData if (terrainObj != null) { UnityEngine.Object.DestroyImmediate(terrainObj.terrainData); UnityEngine.Object.DestroyImmediate(terrainObj.gameObject); } // 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}"); }
public void RTHandle_Release_New() { var handle = RTUtils.GetNewHandle(descriptor); Assert.True(RTUtils.GetHandleCount() == m_PrevRTHandleCount + 1); RTUtils.Release(handle); Assert.True(RTUtils.GetHandleCount() == m_PrevRTHandleCount); }
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}"); }
public void SetUp() { EditorWindow.GetWindow <SceneView>().Focus(); m_PrevTextureMemory = Texture.totalTextureMemory; m_PrevRTHandlesCount = RTUtils.GetHandleCount(); // Enables the core brush playback on OnSceneGUI SceneView.duringSceneGui -= OnSceneGUI; SceneView.duringSceneGui += OnSceneGUI; }
public void RTHandle_Scope_Cleanup() { var handle = RTUtils.GetTempHandle(descriptorRW); Assert.True(m_PrevRTHandleCount + 1 == RTUtils.GetHandleCount()); using (handle.Scoped()) { // keep empty } Assert.True(m_PrevRTHandleCount == RTUtils.GetHandleCount()); }
public void RTHandle_Count_Is_Correct() { var handles = new RTHandle[10]; for (int i = 0; i < handles.Length; ++i) { handles[i] = RTUtils.GetTempHandle(descriptor); } Assert.True(RTUtils.GetHandleCount() == m_PrevRTHandleCount + handles.Length); for (int i = 0; i < handles.Length; ++i) { RTUtils.Release(handles[i]); } }
public void Cleanup() { // delete test resources defaultBrushUiGroupMock?.brushMaskFilterStack?.Clear(true); PaintContext.ApplyDelayedActions(); if (terrainObj != null) { UnityEngine.Object.DestroyImmediate(terrainObj.terrainData); UnityEngine.Object.DestroyImmediate(terrainObj.gameObject); } // 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}"); }
public virtual void Setup() { // m_PrevTextureMemory = Texture.totalTextureMemory; m_PrevRTHandlesCount = RTUtils.GetHandleCount(); }
public void Cleanup() { Assert.True(m_PrevTextureMemory == Texture.totalTextureMemory, "Test was torn down with leaked texture memory"); Assert.True(RTUtils.GetHandleCount() == m_PrevRTHandleCount, "Test was torn down with leaked RTHandle memory"); }
public void Setup() { m_PrevTextureMemory = Texture.totalTextureMemory; m_PrevRTHandlesCount = RTUtils.GetHandleCount(); defaultBrushUiGroupMock = new DefaultBrushUIGroupMock("PaintHeight"); }