UnityGame/Library/PackageCache/com.unity.render-pipelines.universal/Tests/Runtime/LightTests.cs

38 lines
1.3 KiB
C#
Raw Permalink Normal View History

2024-10-27 10:53:47 +03:00
using NUnit.Framework;
namespace UnityEngine.Rendering.Universal.Tests
{
[TestFixture]
class LightTests
{
[Test]
public void TestMainLightRenderingLayerMaskSyncWithUniversalLightAndShadowLayers()
{
var lightObject = new GameObject("Light");
var light = lightObject.AddComponent<Light>();
var lightData = light.GetUniversalAdditionalLightData();
lightData.renderingLayers = (1 << 1);
lightData.shadowRenderingLayers = (1 << 2);
lightData.customShadowLayers = false;
Assert.AreEqual(light.renderingLayerMask, lightData.renderingLayers);
lightData.customShadowLayers = true;
Assert.AreEqual(light.renderingLayerMask, lightData.shadowRenderingLayers);
lightData.customShadowLayers = false;
lightData.renderingLayers = (1 << 3);
lightData.shadowRenderingLayers = (1 << 4);
Assert.AreEqual(light.renderingLayerMask, lightData.renderingLayers);
lightData.customShadowLayers = true;
lightData.renderingLayers = (1 << 5);
lightData.shadowRenderingLayers = (1 << 6);
Assert.AreEqual(light.renderingLayerMask, lightData.shadowRenderingLayers);
Object.DestroyImmediate(lightObject);
}
}
}