@@ -213,5 +213,56 @@ public void TestFindPreferredProgram()
213
213
Assert . AreEqual ( preferred , - 1 ) ;
214
214
}
215
215
216
+ [ Test ]
217
+ public void TestGetDCCOptions ( )
218
+ {
219
+ //Our.exe file
220
+ string executableName = "/maya.exe" ;
221
+
222
+ //Our folder names
223
+ string firstSubFolder = "/maya 3000" ;
224
+ string secondSubFolder = "/maya 3001" ;
225
+
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 ( firstPath . FullName + 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
+ }
265
+ }
266
+
216
267
}
217
268
}
0 commit comments