modular-avatar/UnitTests~/Animation/PlayAudio/PlayAudioRemapping.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
1.1 KiB
C#

#if MA_VRCSDK3_AVATARS_3_5_2_OR_NEWER
using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework;
using UnityEditor.Animations;
using VRC.SDK3.Avatars.Components;
namespace modular_avatar_tests
{
public class PlayAudioRemapping : TestBase
{
[Test]
public void PlayAudioBehaviorsAreRemappedToCorrectPaths()
{
var prefab = CreatePrefab("PlayAudioRemapping.prefab");
AvatarProcessor.ProcessAvatar(prefab);
var fx = FindFxController(prefab);
var ac = (AnimatorController)fx.animatorController;
var layer = ac.layers[0];
var state = layer.stateMachine.states[0].state;
var playAudio = (VRCAnimatorPlayAudio) state.behaviours[0];
Assert.AreEqual("New Parent/Bone Proxy/Audio Source", playAudio.SourcePath);
var subState = layer.stateMachine.stateMachines[0].stateMachine.states[0].state;
var playAudio2 = (VRCAnimatorPlayAudio) subState.behaviours[0];
Assert.AreEqual("New Parent/Bone Proxy/Audio Source", playAudio2.SourcePath);
}
}
}
#endif