Skip to content

Commit

Permalink
test: add missing blendshape/RC tests (#1293)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdunderscore authored Oct 16, 2024
1 parent 55ab65e commit 8bf1d29
Show file tree
Hide file tree
Showing 4 changed files with 870 additions and 0 deletions.
61 changes: 61 additions & 0 deletions UnitTests~/ReactiveComponent/BlendshapeSyncTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using System.Linq;
using modular_avatar_tests;
using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework;
using UnityEngine;

namespace UnitTests.ReactiveComponent
{
public class BlendshapeSyncTest : TestBase
{
[Test]
public void blendshapeSync_propagatesThroughMeshes()
{
var root = CreatePrefab("BlendshapeSyncTest.prefab");

var analysis = new ReactiveObjectAnalyzer().Analyze(root);

var m1 = analysis.Shapes[new TargetProp()
{
TargetObject = root.transform.Find("m1").GetComponent<SkinnedMeshRenderer>(),
PropertyName = "blendShape.bottom"
}];
var m2 = analysis.Shapes[new TargetProp()
{
TargetObject = root.transform.Find("m2").GetComponent<SkinnedMeshRenderer>(),
PropertyName = "blendShape.bottom"
}];
var m3 = analysis.Shapes[new TargetProp()
{
TargetObject = root.transform.Find("m3").GetComponent<SkinnedMeshRenderer>(),
PropertyName = "blendShape.top"
}];

Assert.IsTrue(analysis.Shapes.ContainsKey(new TargetProp()
{
TargetObject = root.transform.Find("m1").GetComponent<SkinnedMeshRenderer>(),
PropertyName = "deletedShape.bottom"
}));

Assert.AreEqual(4, analysis.Shapes.Count);

foreach (var ag in m1.actionGroups)
{
ag.TargetProp = new TargetProp();
}

foreach (var ag in m2.actionGroups)
{
ag.TargetProp = new TargetProp();
}

foreach (var ag in m3.actionGroups)
{
ag.TargetProp = new TargetProp();
}

Assert.AreEqual(m2.actionGroups, m1.actionGroups);
Assert.AreEqual(m3.actionGroups, m1.actionGroups);
}
}
}
3 changes: 3 additions & 0 deletions UnitTests~/ReactiveComponent/BlendshapeSyncTest.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8bf1d29

Please sign in to comment.