modular-avatar/UnitTests~/BlendshapeSyncTests/BlendshapeSyncIntegrationTest.cs
bd_ ddbc3b164b
chore: restructure repository to put package at top-level (#477)
* chore: rearrange package structure to have the package at the root

* ci: update CI workflows

* ci: fixing workflow bugs

* ci: recurse building .zip package

* ci: more fixes

* ci: add back in the nadena.dev VPM repo

* ci: fix tests
2023-10-08 15:39:57 +09:00

41 lines
1.6 KiB
C#

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