Rasagar/Library/PackageCache/com.unity.render-pipelines.universal/Tests/Runtime/LightTests.cs
2024-08-26 23:07:20 +03:00

38 lines
1.3 KiB
C#

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);
}
}
}