This commit is contained in:
2024-09-20 20:30:10 +02:00
commit 4fabf1a6fd
29169 changed files with 1706941 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
using System;
using NUnit.Framework;
using UnityEngine.Rendering;
class DebugMangerTests
{
[Test]
public void WindowStateCallbackIsTriggerred()
{
bool called = false;
Action<DebugManager.UIMode, bool> action = (mode, open) =>
{
Assert.AreEqual(DebugManager.UIMode.EditorMode, mode);
Assert.AreEqual(true, open);
called = true;
};
DebugManager.windowStateChanged += action;
DebugManager.instance.displayEditorUI = true;
Assert.AreEqual(true, called);
DebugManager.windowStateChanged -= action;
DebugManager.instance.displayEditorUI = false;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3a191d0939f271d4b9b583b27f1ecd2d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,23 @@
using UnityEngine;
using UnityEngine.TestTools;
using NUnit.Framework;
using System.Collections;
class RuntimeExampleTest
{
[Test]
public void PlayModeSampleTestSimplePasses()
{
// Use the Assert class to test conditions.
}
// A UnityTest behaves like a coroutine in PlayMode
// and allows you to yield null to skip a frame in EditMode
[UnityTest]
public IEnumerator PlayModeSampleTestWithEnumeratorPasses()
{
// Use the Assert class to test conditions.
// yield to skip a frame
yield return null;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4a99028421222694897393dabe2744fb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,82 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.TestTools;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using NUnit.Framework;
namespace UnityEngine.Rendering.Tests
{
class RuntimeProfilerTestBase
{
protected const int k_NumWarmupFrames = 10;
protected const int k_NumFramesToRender = 30;
protected DebugFrameTiming m_DebugFrameTiming;
protected GameObject m_ToCleanup;
[SetUp]
public void Setup()
{
if (!FrameTimingManager.IsFeatureEnabled())
Assert.Ignore("Frame timing stats are disabled in Player Settings, skipping test.");
if (Application.isBatchMode)
Assert.Ignore("Frame timing tests are not supported in batch mode, skipping test.");
// HACK #1 - really shouldn't have to do this here, but previous tests are leaking gameobjects
var objects = GameObject.FindObjectsOfType<GameObject>();
foreach (var o in objects)
{
// HACK #2 - must not destroy DebugUpdater, which happens to have an EventSystem.
if (o.GetComponent<EventSystem>() == null)
CoreUtils.Destroy(o);
}
m_DebugFrameTiming = new DebugFrameTiming();
}
[TearDown]
public void TearDown()
{
if (m_ToCleanup != null)
CoreUtils.Destroy(m_ToCleanup);
}
protected IEnumerator Warmup()
{
for (int i = 0; i < k_NumWarmupFrames; i++)
yield return null;
m_DebugFrameTiming.Reset();
}
}
// [UnityPlatform(exclude = new RuntimePlatform[] { RuntimePlatform.LinuxPlayer, RuntimePlatform.LinuxEditor })] // Disabled on Linux (case 1370861)
// class RuntimeProfilerTests : RuntimeProfilerTestBase
// {
// [UnityTest]
// public IEnumerator RuntimeProfilerGivesNonZeroOutput()
// {
// yield return Warmup();
// m_ToCleanup = new GameObject();
// var camera = m_ToCleanup.AddComponent<Camera>();
// for (int i = 0; i < k_NumFramesToRender; i++)
// {
// m_DebugFrameTiming.UpdateFrameTiming();
// camera.Render();
// yield return null;
// }
// Assert.True(
// m_DebugFrameTiming.m_BottleneckHistory.Histogram.Balanced > 0 ||
// m_DebugFrameTiming.m_BottleneckHistory.Histogram.CPU > 0 ||
// m_DebugFrameTiming.m_BottleneckHistory.Histogram.GPU > 0 ||
// m_DebugFrameTiming.m_BottleneckHistory.Histogram.PresentLimited > 0);
// }
// }
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 40a73c4a33c05924f813df35844d8c71
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
{
"name": "Unity.RenderPipelines.Core.Runtime.Tests",
"references": [
"GUID:df380645f10b7bc4b97d4f5eb6303d95",
"GUID:27619889b8ba8c24980f49ee34dbb44a",
"GUID:0acc523941302664db1f4e527237feb3"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": true,
"overrideReferences": true,
"precompiledReferences": [
"nunit.framework.dll"
],
"autoReferenced": false,
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": []
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: bf043f86dbf1bda4398ec83eebe40b8c
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: