using System.Collections; using NUnit.Framework; using UnityEngine; using UnityEngine.TestTools; using UnityEngine.TestTools.Graphics; using UnityEngine.SceneManagement; using UnityEngine.Events; public class HDRP_GraphicTestRunner { [UnityTest, Category("HDRP Graphic Tests")] [PrebuildSetup("SetupGraphicsTestCases")] [UseGraphicsTestCases] public IEnumerator Run(GraphicsTestCase testCase) { SceneManager.LoadScene(testCase.ScenePath); // Arbitrary wait for 5 frames for the scene to load, and other stuff to happen (like Realtime GI to appear ...) for (int i=0 ; i<5 ; ++i) yield return null; // Load the test settings var settings = GameObject.FindObjectOfType(); var camera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent(); if (camera == null) camera = GameObject.FindObjectOfType(); if (camera == null) { Assert.Fail("Missing camera for graphic tests."); } Time.captureFramerate = settings.captureFramerate; if (settings.doBeforeTest != null) { settings.doBeforeTest.Invoke(); // Wait again one frame, to be sure. yield return null; } for (int i=0 ; i