Skip to content

Commit c2e8eb9

Browse files
svc-reach-platform-supportEvergreen
authored andcommitted
[Port] [6000.2] UUM-116018 : Fix GRDLightMaps test
1 parent 94f291f commit c2e8eb9

File tree

5 files changed

+52
-1
lines changed

5 files changed

+52
-1
lines changed

Tests/SRPTests/Projects/BatchRendererGroup_URP/Assets/SampleScenes/BRGGameObjects/GRDLightMaps.unity

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,8 @@ MonoBehaviour:
320320
ImageResolution: 0
321321
ActiveImageTests: 1
322322
ActivePixelTests: 7
323-
WaitFrames: 30
323+
Wait: 1
324+
WaitFrames: 2
324325
--- !u!1660057539 &9223372036854775807
325326
SceneRoots:
326327
m_ObjectHideFlags: 0

Tests/SRPTests/Projects/BatchRendererGroup_URP/Assets/Tests/Runtime/GraphicsTestSettingsCustom.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
public class GraphicsTestSettingsCustom : GraphicsTestSettings
77
{
8+
public bool Wait = false;
89
public int WaitFrames = 2;
910

1011
public GraphicsTestSettingsCustom()

Tests/SRPTests/Projects/BatchRendererGroup_URP/Assets/Tests/Runtime/GraphicsTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ public IEnumerator Run(GraphicsTestCase testCase)
5959

6060
yield return null;
6161

62+
// Add a maximum amount of wait frames to avoid infinite loop
63+
int maxWaitFrames = 300;
64+
while (settings.Wait && maxWaitFrames > 0)
65+
{
66+
maxWaitFrames--;
67+
yield return new WaitForEndOfFrame();
68+
}
69+
6270
int waitFrames = settings.WaitFrames;
6371

6472
if (settings.ImageComparisonSettings.UseBackBuffer && settings.WaitFrames < 1)
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using UnityEngine;
2+
using UnityEngine.SceneManagement;
3+
4+
public class SwitchScene : MonoBehaviour
5+
{
6+
public float delayInSeconds = 1.0f;
7+
public string sceneToLoad;
8+
public string sceneToUnload;
9+
10+
private float m_StartTime;
11+
private bool m_SceneSwitched = false;
12+
13+
void Start()
14+
{
15+
m_StartTime = Time.time;
16+
m_SceneSwitched = false;
17+
}
18+
19+
// Update is called once per frame
20+
void Update()
21+
{
22+
if ((Time.time - m_StartTime) > delayInSeconds && !m_SceneSwitched)
23+
{
24+
m_SceneSwitched = true;
25+
26+
var loadHandle = SceneManager.LoadSceneAsync(sceneToLoad, LoadSceneMode.Additive);
27+
loadHandle.completed += operation =>
28+
{
29+
var unloadHandle = SceneManager.UnloadSceneAsync(SceneManager.GetSceneByName(sceneToUnload), UnloadSceneOptions.UnloadAllEmbeddedSceneObjects);
30+
unloadHandle.completed += operation => {
31+
// Unblock the waiting so we can take a screenshot
32+
var settings = Object.FindObjectOfType<GraphicsTestSettingsCustom>();
33+
if (settings)
34+
settings.Wait = false;
35+
};
36+
};
37+
}
38+
}
39+
}

Tests/SRPTests/Projects/BatchRendererGroup_URP/Assets/Tests/Runtime/SwitchScene.cs.meta

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)