1
1
using UnityEngine ;
2
2
using UnityEditor ;
3
3
using NUnit . Framework ;
4
+ using System . Collections . Generic ;
4
5
5
6
namespace FbxExporters . UnitTests
6
7
{
8
+ public class MyKeyComparer : IComparer < Keyframe >
9
+ {
10
+ public int Compare ( Keyframe a , Keyframe b )
11
+ {
12
+ Debug . Log ( string . Format ( "a.value: {0}, b.value: {1}, a.time: {2}, b.time: {3}" , a . value , b . value , a . time , b . time ) ) ;
13
+ return a . time == b . time && a . value == b . value ? 0 : 1 ;
14
+ }
15
+ }
16
+
7
17
public class FbxCameraTest : ExporterTestBase
8
18
{
9
19
@@ -15,6 +25,7 @@ public void AnimationWithCameraFOVTest()
15
25
go . name = "originalCamera" ;
16
26
Camera camera = go . AddComponent ( typeof ( Camera ) ) as Camera ;
17
27
Animation anim = go . AddComponent ( typeof ( Animation ) ) as Animation ;
28
+
18
29
Keyframe [ ] keys = new Keyframe [ 3 ] ;
19
30
keys [ 0 ] = new Keyframe ( 0.0f , 1f ) ;
20
31
keys [ 1 ] = new Keyframe ( 1.0f , 2f ) ;
@@ -64,11 +75,8 @@ public void AnimationWithCameraFOVTest()
64
75
65
76
Assert . That ( exportedCurve . keys . Length , Is . EqualTo ( keys . Length ) ) ;
66
77
67
- for ( int i = 0 ; i < exportedCurve . keys . Length ; i ++ )
68
- {
69
- Assert . That ( exportedCurve . keys [ i ] . time == keys [ i ] . time ) ;
70
- Assert . That ( exportedCurve . keys [ i ] . value == keys [ i ] . value ) ;
71
- }
78
+ //check imported animation against original
79
+ Assert . That ( exportedCurve . keys , Is . EqualTo ( keys ) . Using < Keyframe > ( new MyKeyComparer ( ) ) , string . Format ( "key doesn't match" ) ) ;
72
80
}
73
81
74
82
}
0 commit comments