-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add missing blendshape/RC tests (#1293)
- Loading branch information
1 parent
55ab65e
commit 8bf1d29
Showing
4 changed files
with
870 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.