Skip to content

Commit 005b489

Browse files
authored
Merge pull request #403 from Unity-Technologies/UNI-47629-fix-integration-unit-tests
Uni 47629 fix integration unit tests
2 parents 4a81b68 + 74041b8 commit 005b489

File tree

3 files changed

+5
-39
lines changed

3 files changed

+5
-39
lines changed

Assets/com.unity.formats.fbx.tests/FbxExportSettingsTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ private void TestLocations(Dictionary<string,List<string>> data)
482482
ExportSettings.instance.ClearDCCOptions();
483483

484484
GUIContent[] options = ExportSettings.GetDCCOptions();
485-
Assert.AreEqual(options.Length, expectedResult);
485+
Assert.AreEqual(expectedResult, options.Length);
486486

487487
if (data.ContainsKey("expected3DApp"))
488488
{

Packages/com.unity.formats.fbx/Editor/Scripts/FbxExportSettings.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,13 @@ private static string GetMayaLocationFromEnvironmentVariable(string env)
283283
/// </summary>
284284
private static HashSet<string> GetCustomVendorLocations()
285285
{
286-
HashSet<string> result = new HashSet<string>();
286+
HashSet<string> result = null;
287287

288288
var environmentVariable = Environment.GetEnvironmentVariable("UNITY_3DAPP_VENDOR_LOCATIONS");
289289

290290
if (!string.IsNullOrEmpty(environmentVariable))
291291
{
292+
result = new HashSet<string>();
292293
string[] locations = environmentVariable.Split(';');
293294
foreach (var location in locations)
294295
{
@@ -298,8 +299,6 @@ private static HashSet<string> GetCustomVendorLocations()
298299
}
299300
}
300301
}
301-
302-
303302
return result;
304303
}
305304

@@ -347,7 +346,7 @@ public static string[] DCCVendorLocations
347346
{
348347
HashSet<string> result = GetCustomVendorLocations();
349348

350-
if (result == null || result.Count < 1)
349+
if (result == null)
351350
{
352351
result = GetDefaultVendorLocations();
353352
}

Packages/com.unity.formats.fbx/Editor/Scripts/InstallIntegration.cs

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ public class MayaIntegration : DCCIntegration
9696
private string MODULE_FILENAME { get { return "UnityFbxForMaya"; } }
9797

9898
private const string PACKAGE_NAME = "com.unity.formats.fbx";
99-
private const string VERSION_FILENAME = "README.txt";
10099
private const string VERSION_FIELD = "VERSION";
101100
private const string VERSION_TAG = "{Version}";
102101
private const string PROJECT_TAG = "{UnityProject}";
@@ -155,7 +154,6 @@ protected string MAYA_CONFIG_COMMAND { get {
155154
private string MAYA_CLOSE_COMMAND { get {
156155
return string.Format("scriptJob -idleEvent quit;");
157156
}}
158-
private static Char[] FIELD_SEPARATORS = new Char[] {':'};
159157

160158
protected static string GetUserFolder()
161159
{
@@ -221,38 +219,7 @@ private static string GetUserStartupScriptPath(){
221219

222220
public static string GetPackageVersion()
223221
{
224-
string result = null;
225-
226-
try {
227-
string FileName = System.IO.Path.Combine(GetPackagePath(), VERSION_FILENAME);
228-
229-
System.IO.StreamReader sr = new System.IO.StreamReader(FileName);
230-
231-
// Read the first line of text
232-
string line = sr.ReadLine();
233-
234-
// Continue to read until you reach end of file
235-
while (line != null)
236-
{
237-
if (line.StartsWith(VERSION_FIELD, StringComparison.CurrentCulture))
238-
{
239-
string[] fields = line.Split(FIELD_SEPARATORS);
240-
241-
if (fields.Length>1)
242-
{
243-
result = fields[1];
244-
}
245-
break;
246-
}
247-
line = sr.ReadLine();
248-
}
249-
}
250-
catch(Exception e)
251-
{
252-
Debug.LogError(string.Format("Exception failed to read file containing package version ({0})", e.Message));
253-
}
254-
255-
return result;
222+
return ModelExporter.GetVersionFromReadme();
256223
}
257224

258225
private static List<string> ParseTemplateFile(string FileName, Dictionary<string,string> Tokens )

0 commit comments

Comments
 (0)