@@ -216,27 +216,38 @@ public void TestFindPreferredProgram()
216
216
[ Test ]
217
217
public void TestGetDCCOptions ( )
218
218
{
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" ) ;
223
226
using ( FileStream s = firstExe . Create ( ) ) { }
224
227
228
+ //Add the paths which will be copied to DCCOptionPaths
225
229
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" ) ;
228
234
235
+ //Add the names which will be copied to DCCOptionNames
229
236
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" ) ;
231
241
232
242
ExportSettings . instance . SetDCCOptionNames ( testNameList ) ;
233
243
ExportSettings . instance . SetDCCOptionPaths ( testPathList ) ;
234
244
235
245
GUIContent [ ] options = ExportSettings . GetDCCOptions ( ) ;
236
- Debug . Log ( options . Length ) ;
237
246
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 ) ;
240
251
}
241
252
242
253
}
0 commit comments