@@ -13,8 +13,24 @@ public static IEnumerable TestCases
13
13
{
14
14
get
15
15
{
16
- yield return new TestCaseData ( new float [ ] { 1f , 20f , 30f } , new float [ ] { 0f , 0.5f , 1f } , "m_Weight" ) . Returns ( 1 ) ;
17
- yield return new TestCaseData ( new float [ ] { 2 , 9 , 33 } , new float [ ] { 0.1f , 0.67f , 0.2f } , "m_Sources.Array.data[0].weight" ) . Returns ( 1 ) ;
16
+ /* Test Weight */
17
+ yield return new TestCaseData ( typeof ( RotationConstraint ) , new float [ ] { 1f , 20f , 30f } , new float [ ] { 0f , 0.5f , 1f } , "m_Weight" ) . Returns ( 1 ) ;
18
+ yield return new TestCaseData ( typeof ( RotationConstraint ) , new float [ ] { 2 , 9 , 33 } , new float [ ] { 0.1f , 0.67f , 0.2f } , "m_Sources.Array.data[0].weight" ) . Returns ( 1 ) ;
19
+
20
+ /* Test Aim */
21
+ yield return new TestCaseData ( typeof ( AimConstraint ) , new float [ ] { 1f , 30f , 10f } , new float [ ] { 10f , 180f , 10f } , "m_AimVector.x" ) . Returns ( 1 ) ;
22
+ yield return new TestCaseData ( typeof ( AimConstraint ) , new float [ ] { 1f , 30f , 10f } , new float [ ] { 90f , 45f , 60f } , "m_AimVector.y" ) . Returns ( 1 ) ;
23
+ yield return new TestCaseData ( typeof ( AimConstraint ) , new float [ ] { 1f , 30f , 10f } , new float [ ] { 10f , 180f , 10f } , "m_AimVector.z" ) . Returns ( 1 ) ;
24
+
25
+ yield return new TestCaseData ( typeof ( AimConstraint ) , new float [ ] { 1f , 2f , 4f } , new float [ ] { 100f , 80f , 19f } , "m_UpVector.x" ) . Returns ( 1 ) ;
26
+ yield return new TestCaseData ( typeof ( AimConstraint ) , new float [ ] { 1f , 2f , 4f } , new float [ ] { 4f , 154f , 454f } , "m_UpVector.y" ) . Returns ( 1 ) ;
27
+ yield return new TestCaseData ( typeof ( AimConstraint ) , new float [ ] { 1f , 2f , 4f } , new float [ ] { 8f , 14f , 6f } , "m_UpVector.z" ) . Returns ( 1 ) ;
28
+
29
+ yield return new TestCaseData ( typeof ( AimConstraint ) , new float [ ] { 2f , 30f , 77f } , new float [ ] { 29.3f , 322f , - 190f } , "m_WorldUpVector.x" ) . Returns ( 1 ) ;
30
+ yield return new TestCaseData ( typeof ( AimConstraint ) , new float [ ] { 2f , 30f , 77f } , new float [ ] { 145f , 180f , 40f } , "m_WorldUpVector.y" ) . Returns ( 1 ) ;
31
+ yield return new TestCaseData ( typeof ( AimConstraint ) , new float [ ] { 2f , 30f , 77f } , new float [ ] { 10f , 180f , 10f } , "m_WorldUpVector.z" ) . Returns ( 1 ) ;
32
+ }
33
+ }
18
34
}
19
35
}
20
36
}
@@ -188,14 +204,14 @@ public void TestAimConstraintExport()
188
204
}
189
205
190
206
[ Test , TestCaseSource ( typeof ( ConstraintAnimationTestDataClass ) , "TestCases" ) ]
191
- public int TestWeightAnimation ( float [ ] keyTimes , float [ ] keyValues , string propertyName )
207
+ public int TestConstraintAnimation ( System . Type componentType , float [ ] keyTimes , float [ ] keyValues , string propertyName )
192
208
{
193
209
var go = new GameObject ( "root" ) ;
194
210
var source = new GameObject ( "source" ) ;
195
211
196
212
source . transform . parent = go . transform ;
197
213
198
- var constraint = go . AddComponent < RotationConstraint > ( ) ;
214
+ var constraint = go . AddComponent ( componentType ) as IConstraint ;
199
215
Assert . That ( constraint , Is . Not . Null ) ;
200
216
201
217
var cSource = new ConstraintSource ( ) ;
@@ -207,12 +223,12 @@ public int TestWeightAnimation(float[] keyTimes, float[] keyValues, string prope
207
223
var keyData = new FbxAnimationTest . PropertyKeyData
208
224
{
209
225
targetObject = go ,
210
- componentType = typeof ( RotationConstraint ) ,
226
+ componentType = componentType ,
211
227
propertyName = propertyName ,
212
228
keyTimes = keyTimes ,
213
229
keyFloatValues = keyValues
214
230
} ;
215
- var tester = new FbxAnimationTest . AnimTester { keyData = keyData , testName = "ConstraintWeightAnim_ " + propertyName , path = GetRandomFbxFilePath ( ) } ;
231
+ var tester = new FbxAnimationTest . AnimTester { keyData = keyData , testName = "ConstraintAnim_ " + propertyName , path = GetRandomFbxFilePath ( ) } ;
216
232
217
233
return tester . DoIt ( ) ;
218
234
}
0 commit comments