您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

37 行
1.2 KiB

using System.Collections;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.TestTools;
using UnityEngine.TestTools.Graphics;
using UnityEngine.SceneManagement;
public class ShaderGraphGraphicsTests
{
[UnityTest, Category("ShaderGraph")]
[PrebuildSetup("SetupGraphicsTestCases")]
[UseGraphicsTestCases]
public IEnumerator Run(GraphicsTestCase testCase)
{
SceneManager.LoadScene(testCase.ScenePath);
// Always wait one frame for scene load
yield return null;
var camera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>();
var settings = Object.FindObjectOfType<ShaderGraphGraphicsTestSettings>();
Assert.IsNotNull(settings, "Invalid test scene, couldn't find PostProcessingGraphicsTestSettings");
for (int i = 0; i < settings.WaitFrames; i++)
yield return null;
ImageAssert.AreEqual(testCase.ReferenceImage, camera, settings.ImageComparisonSettings);
}
#if UNITY_EDITOR
[TearDown]
public void DumpImagesInEditor()
{
UnityEditor.TestTools.Graphics.ResultsUtility.ExtractImagesFromTestProperties(TestContext.CurrentContext.Test);
}
#endif
}