Skip to content

Commit 581bcd3

Browse files
author
AJubrey
committed
[CHANGED] test file names to Maya just in case it would cause some issue on mac
[ADDED] a try/finally so that the folder definitely gets deleted afterward [ADDED] variable names so I can't mess up any strings! [FIXED] issue where we were printing the name with an extra slash [ADDED] an extra test of the remaining files name
1 parent 19abb90 commit 581bcd3

File tree

1 file changed

+44
-30
lines changed

1 file changed

+44
-30
lines changed

Assets/FbxExporters/Editor/UnitTests/FbxExportSettingsTest.cs

Lines changed: 44 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -216,38 +216,52 @@ public void TestFindPreferredProgram()
216216
[Test]
217217
public void TestGetDCCOptions()
218218
{
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");
226-
using (FileStream s = firstExe.Create()) {}
227-
228-
//Add the paths which will be copied to DCCOptionPaths
229-
List<string> testPathList = new List<string>();
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");
234-
235-
//Add the names which will be copied to DCCOptionNames
236-
List<string> testNameList = new List<string>();
237-
testNameList.Add("3dsmax 3000");
238-
testNameList.Add("3dsmax 3001");
239-
testNameList.Add(null);
240-
testNameList.Add("Cookies & Milk");
219+
//Our.exe file
220+
string executableName = "/maya.exe";
241221

242-
ExportSettings.instance.SetDCCOptionNames(testNameList);
243-
ExportSettings.instance.SetDCCOptionPaths(testPathList);
222+
//Our folder names
223+
string firstSubFolder = "/maya 3000";
224+
string secondSubFolder = "/maya 3001";
244225

245-
GUIContent[] options = ExportSettings.GetDCCOptions();
246-
247-
//We expect 1, as the others are purposefully bogus
248-
Assert.AreEqual(options.Length, 1);
249-
250-
Directory.Delete(testFolder, true);
226+
//Make a folder structure to mimic an 'autodesk' type hierarchy
227+
string testFolder = Path.GetRandomFileName();
228+
var firstPath = Directory.CreateDirectory(testFolder + firstSubFolder);
229+
var secondPath = Directory.CreateDirectory(testFolder + secondSubFolder);
230+
231+
try
232+
{
233+
//Create any files we need within the folders
234+
FileInfo firstExe = new FileInfo(testFolder + firstSubFolder + executableName);
235+
using (FileStream s = firstExe.Create()) { }
236+
237+
//Add the paths which will be copied to DCCOptionPaths
238+
List<string> testPathList = new List<string>();
239+
testPathList.Add((firstPath.FullName + executableName)); //this path is valid!
240+
testPathList.Add(secondPath.FullName + executableName);
241+
testPathList.Add(null);
242+
testPathList.Add("cookies/milk/foo/bar");
243+
244+
//Add the names which will be copied to DCCOptionNames
245+
List<string> testNameList = new List<string>();
246+
testNameList.Add(firstSubFolder.TrimStart('/'));
247+
testNameList.Add(secondSubFolder.TrimStart('/'));
248+
testNameList.Add(null);
249+
testNameList.Add("Cookies & Milk");
250+
251+
ExportSettings.instance.SetDCCOptionNames(testNameList);
252+
ExportSettings.instance.SetDCCOptionPaths(testPathList);
253+
254+
GUIContent[] options = ExportSettings.GetDCCOptions();
255+
256+
//We expect 1, as the others are purposefully bogus
257+
Assert.AreEqual(options.Length, 1);
258+
259+
Assert.IsTrue(options[0].text == "maya 3000");
260+
}
261+
finally
262+
{
263+
Directory.Delete(testFolder, true);
264+
}
251265
}
252266

253267
}

0 commit comments

Comments
 (0)