modular-avatar/UnitTests~/Animation/BaseLayerReferenceCorrection/BaseLayerReferenceCorrectionTest.cs
kaikoga efa263b551
chore: Fix non-VRChat support (for MA 1.10.5) (#1324)
* feat: add version defines for VRCSDK

* chore: early return if VRCSDK project but not VRChat avatar
2024-10-27 10:06:35 -07:00

33 lines
969 B
C#

#if MA_VRCSDK3_AVATARS
using System.Linq;
using nadena.dev.ndmf;
using NUnit.Framework;
using UnityEditor.Animations;
using VRC.SDK3.Avatars.Components;
namespace modular_avatar_tests
{
public class BaseLayerReferenceCorrectionTest : TestBase
{
[Test]
public void whenBaseAnimatorLayersAreDeleted_layerCrossRefsAreCorrected()
{
var avatar = CreatePrefab("BaseLayerReferenceCorrection.prefab");
AvatarProcessor.ProcessAvatar(avatar);
var fx = findFxLayer(avatar, "test");
var state = fx.stateMachine.defaultState;
var alc = state.behaviours[0] as VRCAnimatorLayerControl;
Assert.NotNull(alc);
var desiredIndex = ((AnimatorController)FindFxController(avatar).animatorController)
.layers.TakeWhile(l => l.name != "l1").Count();
Assert.AreEqual(desiredIndex, alc.layer);
}
}
}
#endif