Skip to content

Commit 2a126f4

Browse files
committed
code review fixes
1 parent 24f110b commit 2a126f4

File tree

5 files changed

+27
-2264
lines changed

5 files changed

+27
-2264
lines changed

Assets/FbxExporters/Editor/FbxPrefabAutoUpdater.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System;
66
using FbxExporters.Editor;
77

8-
98
namespace FbxExporters
109
{
1110
/// <summary>

Assets/FbxExporters/Editor/UnitTests/ExportTimelineClipTest.cs

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,34 @@ namespace FbxExporters.UnitTests
1111
{
1212
public class ExportTimelineClipTest : ExporterTestBase
1313
{
14+
private static string m_testScenePath = "Scene/TestScene.unity";
15+
1416
[SetUp]
15-
public void Init()
17+
public override void Init()
1618
{
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);
1823
}
1924

2025
[Test]
2126
public void ExportSingleTimelineClipTest()
2227
{
2328
GameObject myCube = GameObject.Find("CubeSpecial");
24-
string folderPath = Application.dataPath + "/UnitTest/";
29+
string folderPath = GetRandomFileNamePath(extName: "");
2530

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) {
3134
AnimationTrack at = output.sourceObject as AnimationTrack;
3235

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+
}
4042
}
4143
}
4244
}
@@ -46,19 +48,13 @@ public void ExportAllTimelineClipTest()
4648
{
4749
GameObject myCube = GameObject.Find("CubeSpecial");
4850
Selection.objects = new UnityEngine.GameObject[] { myCube };
49-
string folderPath = Application.dataPath + "/UnitTest/";
50-
Debug.Log(folderPath);
51+
string folderPath = GetRandomFileNamePath(extName: "");
52+
5153
foreach(GameObject obj in Selection.objects)
5254
{
5355
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"));
5557
}
5658
}
57-
58-
[TearDown]
59-
public void StopTest()
60-
{
61-
62-
}
6359
}
6460
}

Assets/FbxExporters/Editor/UnitTests/ExporterTestBase.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ void DeleteOnNextUpdate()
194194
[TearDown]
195195
public virtual void Term ()
196196
{
197+
// Put back the initial setting for the auto-updater toggle
198+
FbxExporters.EditorTools.ExportSettings.instance.autoUpdaterEnabled = isAutoUpdaterOn;
199+
197200
if (string.IsNullOrEmpty(_testDirectory)) {
198201
return;
199202
}
@@ -204,19 +207,12 @@ public virtual void Term ()
204207
}
205208

206209
[SetUp]
207-
public virtual void InitializeAutoUpdater()
210+
public virtual void Init()
208211
{
209212
isAutoUpdaterOn = FbxExporters.EditorTools.ExportSettings.instance.autoUpdaterEnabled;
210213
FbxExporters.EditorTools.ExportSettings.instance.autoUpdaterEnabled = true;
211214
}
212215

213-
[TearDown]
214-
public virtual void ResetAutoUpdater()
215-
{
216-
// Put back the initial setting for the auto-updater toggle
217-
FbxExporters.EditorTools.ExportSettings.instance.autoUpdaterEnabled = isAutoUpdaterOn;
218-
}
219-
220216
/// <summary>
221217
/// Exports the Objects in selected.
222218
/// </summary>

Assets/TestScene.unity.meta renamed to Assets/FbxExporters/Editor/UnitTests/Scene.meta

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)