From e1a583942c6a1554aa91132b07a69c6535327b3a Mon Sep 17 00:00:00 2001 From: sin Date: Mon, 17 Nov 2025 22:04:54 +0900 Subject: [PATCH] always test memory allocation --- .../Runtime/UTSGraphicsTestSettings.cs | 7 ------ .../Runtime/UTSGraphicsTests.cs | 22 +++++-------------- 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/com.unity.toon-graphics-test/Runtime/UTSGraphicsTestSettings.cs b/com.unity.toon-graphics-test/Runtime/UTSGraphicsTestSettings.cs index 98e5b3395..7c25e7bc4 100644 --- a/com.unity.toon-graphics-test/Runtime/UTSGraphicsTestSettings.cs +++ b/com.unity.toon-graphics-test/Runtime/UTSGraphicsTestSettings.cs @@ -4,13 +4,6 @@ namespace Unity.ToonShader.GraphicsTest { public class UTSGraphicsTestSettings : MonoBehaviour { public UTSGraphicsTestSettingsSO SO; - -#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX - public bool CheckMemoryAllocation = false; -#else - public bool CheckMemoryAllocation = true; -#endif //#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX - } } \ No newline at end of file diff --git a/com.unity.toon-graphics-test/Runtime/UTSGraphicsTests.cs b/com.unity.toon-graphics-test/Runtime/UTSGraphicsTests.cs index 32c5f3b73..eef268e07 100644 --- a/com.unity.toon-graphics-test/Runtime/UTSGraphicsTests.cs +++ b/com.unity.toon-graphics-test/Runtime/UTSGraphicsTests.cs @@ -96,29 +96,19 @@ internal static IEnumerator RunInternal(GraphicsTestCase testCase, bool isXR = f waitFrames = 1; } - for (int i = 0; i < waitFrames; i++) yield return new WaitForEndOfFrame(); ImageAssert.AreEqual(testCase.ReferenceImage, mainCamera, imageComparisonSettings, testCase.ReferenceImagePathLog); - // Does it allocate memory when it renders what's on the main camera? - bool allocatesMemory = false; - - if (settings == null || settings.CheckMemoryAllocation) - { - try - { - ImageAssert.AllocatesMemory(mainCamera, imageComparisonSettings); - } - catch (AssertionException) - { - allocatesMemory = true; - } - if (allocatesMemory) - Assert.Fail("Allocated memory when rendering what is on main camera"); + //test if we are allocating memory when it renders what's on the main camera + try { + ImageAssert.AllocatesMemory(mainCamera, imageComparisonSettings); + } catch (AssertionException) { + Assert.Fail("Allocated memory when rendering what is on main camera"); } + } }