Skip to content

Commit 7cf8d6e

Browse files
committed
find file relative to unit tests folder
1 parent a941ba7 commit 7cf8d6e

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

Assets/FbxExporters/Editor/UnitTests/ExporterTestBase.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,5 +261,21 @@ public static void AssertSameHierarchy (
261261
AssertSameHierarchy (expectedChild.gameObject, actualChild.gameObject);
262262
}
263263
}
264+
265+
/// <summary>
266+
/// Given the path to a file, find the file relative to
267+
/// the UnitTests folder.
268+
/// </summary>
269+
/// <returns>The path in unit tests.</returns>
270+
/// <param name="partialPath">Partial path.</param>
271+
protected static string FindPathInUnitTests(string partialPath){
272+
foreach (var dir in Directory.GetDirectories(Application.dataPath, "UnitTests", SearchOption.AllDirectories)) {
273+
var fullPath = Path.Combine (dir, partialPath);
274+
if (File.Exists (fullPath)) {
275+
return FbxExporters.EditorTools.ExportSettings.ConvertToAssetRelativePath (fullPath);
276+
}
277+
}
278+
return null;
279+
}
264280
}
265281
}

Assets/FbxExporters/Editor/UnitTests/FbxAnimationTest.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static IEnumerable TestCases4 {
6363

6464
public static IEnumerable SkinnedMeshTestCases {
6565
get {
66-
yield return "FbxExporters/Editor/UnitTests/Models/DefaultMale/Male_DyingHitFromBack_Blend_T3_Cut01_James.fbx";
66+
yield return "Models/DefaultMale/Male_DyingHitFromBack_Blend_T3_Cut01_James.fbx";
6767
}
6868
}
6969
}
@@ -309,6 +309,9 @@ private AnimationClip GetClipFromFbx(string path){
309309
[Test, TestCaseSource (typeof (AnimationTestDataClass), "SkinnedMeshTestCases")]
310310
public void LegacySkinnedMeshAnimTest (string fbxPath)
311311
{
312+
fbxPath = FindPathInUnitTests (fbxPath);
313+
Assert.That (fbxPath, Is.Not.Null);
314+
312315
// add fbx to scene
313316
GameObject originalFbxObj = AssetDatabase.LoadMainAssetAtPath("Assets/" + fbxPath) as GameObject;
314317
Assert.IsNotNull (originalFbxObj);

0 commit comments

Comments
 (0)