Skip to content

Commit 4061c55

Browse files
committed
add unit test
1 parent ff228c6 commit 4061c55

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Assets/FbxExporters/Editor/UnitTests/ConvertToModelTest.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,5 +233,28 @@ public void MapNameToSourceTest()
233233
Assert.AreSame(capsule3, dictionaryBroken[capsule.name]);
234234
Assert.AreSame(sphere3, dictionaryBroken[sphere.name]);
235235
}
236+
237+
[Test]
238+
public void TestInstanceNameMatchesFilename()
239+
{
240+
// create a cube, export it to random filename
241+
// make sure instance name gets updated when converting to prefab
242+
243+
// Get a random directory.
244+
var path = GetRandomFileNamePath(extName: ".fbx");
245+
246+
// Create a cube.
247+
var cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
248+
249+
// Convert it to a prefab -- but keep the cube.
250+
var cubePrefabInstance = ConvertToModel.Convert(cube,
251+
fbxFullPath: path);
252+
253+
Assert.That (cube);
254+
Assert.That (cubePrefabInstance);
255+
Assert.AreSame (cube, cubePrefabInstance);
256+
257+
Assert.AreEqual (Path.GetFileNameWithoutExtension (path), cube.name);
258+
}
236259
}
237260
}

0 commit comments

Comments
 (0)