예제 #1
0
        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}");
        }
예제 #2
0
        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);
        }
예제 #3
0
파일: BaseTests.cs 프로젝트: Reflex21/Moba
        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}");
        }
예제 #4
0
        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;
        }
예제 #5
0
        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());
        }
예제 #6
0
        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}");
        }
예제 #8
0
파일: BaseTests.cs 프로젝트: Reflex21/Moba
 public virtual void Setup()
 {
     // m_PrevTextureMemory = Texture.totalTextureMemory;
     m_PrevRTHandlesCount = RTUtils.GetHandleCount();
 }
예제 #9
0
 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");
 }