Skip to content

Commit 8637acd

Browse files
author
AJubrey
committed
[ADDED] a negative test
1 parent da9b5e7 commit 8637acd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Assets/FbxExporters/Editor/UnitTests/ConvertToModelTest.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,22 @@ public void MapNameToSourceTest()
209209

210210
var dictionary = ConvertToModel.MapNameToSourceRecursive(cube, cube2);
211211

212+
//Create a broken hierarchy, one that is missing a primitive
213+
var cube3 = GameObject.CreatePrimitive(PrimitiveType.Cube);
214+
var capsule3 = GameObject.CreatePrimitive(PrimitiveType.Capsule);
215+
var sphere3 = GameObject.CreatePrimitive(PrimitiveType.Sphere);
216+
217+
var dictionaryBroken = ConvertToModel.MapNameToSourceRecursive(cube, cube3);
218+
212219
//We expect these to pass because we've given it an identical game object, as it would have after a normal export.
213220
Assert.AreSame(capsule2, dictionary[capsule.name]);
214221
Assert.AreSame(sphere2, dictionary[sphere.name]);
215222
Assert.AreEqual(quad2, dictionary[quad.name]);
216223

217224
//the dictionary size should be equal to the amount of children + the parent
218225
Assert.True(dictionary.Count == cube.transform.childCount + 1);
226+
227+
Assert.AreNotSame(quad, dictionaryBroken[quad.name]);
219228
}
220229
}
221230
}

0 commit comments

Comments
 (0)