@@ -11,32 +11,34 @@ namespace FbxExporters.UnitTests
11
11
{
12
12
public class ExportTimelineClipTest : ExporterTestBase
13
13
{
14
+ private static string m_testScenePath = "Scene/TestScene.unity" ;
15
+
14
16
[ SetUp ]
15
- public void Init ( )
17
+ public override void Init ( )
16
18
{
17
- EditorSceneManager . OpenScene ( "Assets/FBXExporters/Editor/UnitTests/Scene/TestScene.unity" ) ;
19
+ base . Init ( ) ;
20
+ string testScenePath = FindPathInUnitTests ( m_testScenePath ) ;
21
+ Assert . That ( testScenePath , Is . Not . Null ) ;
22
+ EditorSceneManager . OpenScene ( "Assets/" + testScenePath ) ;
18
23
}
19
24
20
25
[ Test ]
21
26
public void ExportSingleTimelineClipTest ( )
22
27
{
23
28
GameObject myCube = GameObject . Find ( "CubeSpecial" ) ;
24
- string folderPath = Application . dataPath + "/UnitTest/" ;
29
+ string folderPath = GetRandomFileNamePath ( extName : "" ) ;
25
30
26
- PlayableDirector pd = myCube . GetComponent < PlayableDirector > ( ) ;
27
- if ( pd != null )
28
- {
29
- foreach ( PlayableBinding output in pd . playableAsset . outputs )
30
- {
31
+ PlayableDirector pd = myCube . GetComponent < PlayableDirector > ( ) ;
32
+ if ( pd != null ) {
33
+ foreach ( PlayableBinding output in pd . playableAsset . outputs ) {
31
34
AnimationTrack at = output . sourceObject as AnimationTrack ;
32
35
33
- GameObject atObject = pd . GetGenericBinding ( output . sourceObject ) as GameObject ;
34
- // One file by animation clip
35
- foreach ( TimelineClip timeLineClip in at . GetClips ( ) )
36
- {
37
- ModelExporter . ExportSingleTimelineClip ( timeLineClip , folderPath , atObject ) ;
38
- FileAssert . Exists ( folderPath + atObject . name + "@Recorded.fbx" ) ;
39
- }
36
+ GameObject atObject = pd . GetGenericBinding ( output . sourceObject ) as GameObject ;
37
+ // One file by animation clip
38
+ foreach ( TimelineClip timeLineClip in at . GetClips ( ) ) {
39
+ ModelExporter . ExportSingleTimelineClip ( timeLineClip , folderPath , atObject ) ;
40
+ FileAssert . Exists ( string . Format ( "{0}/{1}@{2}.fbx" , folderPath , atObject . name , "Recorded.fbx" ) ) ;
41
+ }
40
42
}
41
43
}
42
44
}
@@ -46,19 +48,13 @@ public void ExportAllTimelineClipTest()
46
48
{
47
49
GameObject myCube = GameObject . Find ( "CubeSpecial" ) ;
48
50
Selection . objects = new UnityEngine . GameObject [ ] { myCube } ;
49
- string folderPath = Application . dataPath + "/UnitTest/" ;
50
- Debug . Log ( folderPath ) ;
51
+ string folderPath = GetRandomFileNamePath ( extName : "" ) ;
52
+
51
53
foreach ( GameObject obj in Selection . objects )
52
54
{
53
55
ModelExporter . ExportAllTimelineClips ( obj , folderPath ) ;
54
- FileAssert . Exists ( folderPath + obj . name + "@ Recorded.fbx") ;
56
+ FileAssert . Exists ( string . Format ( "{0}/{1}@{2}.fbx" , folderPath , obj . name , " Recorded.fbx") ) ;
55
57
}
56
58
}
57
-
58
- [ TearDown ]
59
- public void StopTest ( )
60
- {
61
-
62
- }
63
59
}
64
60
}
0 commit comments