modular-avatar/UnitTests~/BlendshapeSyncTests/BlendshapeSyncIntegrationTest.cs
kaikoga 3667dc319a
chore: Wrap VRC dependencies and VRCAvatarDescriptors (#504)
* add version defines

* refactor: prefer BuildContext.ctor() overload taking GameObject

* wrap unit tests entirely with MA_VRCSDK3_AVATARS

* wrap unit tests smart with MA_VRCSDK3_AVATARS

* wrap runtime entirely with MA_VRCSDK3_AVATARS

* wrap VRC.SDKBase.IEditorOnly with MA_VRCSDK3_AVATARS

* wrap editor entirely with MA_VRCSDK3_AVATARS

* fix AvatarObjectReference.Get(Component)

* wrap editor smart with MA_VRCSDK3_AVATARS

* wrap BuildContext smart with MA_VRCSDK3_AVATARS

* wrap PluginDefinition smart with MA_VRCSDK3_AVATARS

* style: move conditional compiles one step outside
2023-11-10 15:37:56 +09:00

45 lines
1.6 KiB
C#

#if MA_VRCSDK3_AVATARS
using System.Collections.Immutable;
using System.Linq;
using modular_avatar_tests;
using nadena.dev.modular_avatar.animation;
using nadena.dev.ndmf;
using NUnit.Framework;
using UnityEditor;
namespace modular_avatar_tests
{
public class BlendshapeSyncIntegrationTest : TestBase
{
[Test]
public void IntegrationTest_BlendshapeSync()
{
var root = CreatePrefab("BlendshapeSyncIntegrationTest.prefab");
AvatarProcessor.ProcessAvatar(root);
var clip = findFxClip(root, "Base Layer");
var bindings = AnimationUtility.GetCurveBindings(clip)
.Select(binding =>
{
var constantKey = AnimationUtility.GetEditorCurve(clip, binding).keys[0].value;
return (binding.path, binding.propertyName, constantKey);
}).ToImmutableHashSet();
Assert.True(bindings.Contains(("BaseMesh", "blendShape.shape_0", 0.1f)));
Assert.True(bindings.Contains(("BaseMesh", "blendShape.shape_0_local", 0.3f)));
Assert.True(bindings.Contains(("BaseMesh", "blendShape.shape_1", 0.2f)));
Assert.True(bindings.Contains(("BaseMesh", "blendShape.missing_mesh_shape", 0.4f)));
Assert.True(bindings.Contains(("BaseMesh", "blendShape.missing_mesh_shape_2", 0.5f)));
Assert.True(bindings.Contains(("SyncedMesh", "blendShape.shape_0_local", 0.1f)));
Assert.True(bindings.Contains(("SyncedMesh", "blendShape.shape_1", 0.2f)));
Assert.AreEqual(bindings.Count, 7);
}
}
}
#endif