Skip to content

Commit 19abb90

Browse files
author
AJubrey
committed
[ADDED] some bad paths / names
[FIXED] cleanup so we get rid of everything at once at the end [REMOVED] thevariables for the path names, we never reference them again
1 parent 05519ee commit 19abb90

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

Assets/FbxExporters/Editor/UnitTests/FbxExportSettingsTest.cs

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -216,27 +216,38 @@ public void TestFindPreferredProgram()
216216
[Test]
217217
public void TestGetDCCOptions()
218218
{
219-
string projectPath = Application.dataPath;
220-
var firstPath = Directory.CreateDirectory(projectPath + "/GetDCCOptionsTestFolder/3ds max 3000");
221-
var secondPath = Directory.CreateDirectory(projectPath + "/GetDCCOptionsTestFolder/3ds max 3001");
222-
FileInfo firstExe = new FileInfo(projectPath + "/GetDCCOptionsTestFolder/3ds max 3000/3dsmax.exe");
219+
//Make a folder structure to mimic an 'autodesk' type hierarchy
220+
string testFolder = Application.dataPath + "/GetGetDCCOptionsTestFolder";
221+
Directory.CreateDirectory(testFolder + "/3ds max 3000");
222+
Directory.CreateDirectory(testFolder + "/3ds max 3001");
223+
224+
//Create any files we need within the folders
225+
FileInfo firstExe = new FileInfo(testFolder + "/3ds max 3000/3dsmax.exe");
223226
using (FileStream s = firstExe.Create()) {}
224227

228+
//Add the paths which will be copied to DCCOptionPaths
225229
List<string> testPathList = new List<string>();
226-
testPathList.Add(projectPath + "/GetDCCOptionsTestFolder/3ds max 3001"); //bogus path which should be removed
227-
testPathList.Add(projectPath + "/GetDCCOptionsTestFolder/3ds max 3000");
230+
testPathList.Add(testFolder + "/3ds Max 3000/3dsmax.exe"); //this path is valid!
231+
testPathList.Add(testFolder + "/3ds Max 3001/3dsmax.exe");
232+
testPathList.Add(null);
233+
testPathList.Add("cookies/milk/foo/bar");
228234

235+
//Add the names which will be copied to DCCOptionNames
229236
List<string> testNameList = new List<string>();
230-
testNameList.Add("3ds max 3001");
237+
testNameList.Add("3dsmax 3000");
238+
testNameList.Add("3dsmax 3001");
239+
testNameList.Add(null);
240+
testNameList.Add("Cookies & Milk");
231241

232242
ExportSettings.instance.SetDCCOptionNames(testNameList);
233243
ExportSettings.instance.SetDCCOptionPaths(testPathList);
234244

235245
GUIContent[] options = ExportSettings.GetDCCOptions();
236-
Debug.Log(options.Length);
237246

238-
firstPath.Delete(true);
239-
secondPath.Delete(true);
247+
//We expect 1, as the others are purposefully bogus
248+
Assert.AreEqual(options.Length, 1);
249+
250+
Directory.Delete(testFolder, true);
240251
}
241252

242253
}

0 commit comments

Comments
 (0)