FbxCollectionTest.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // ***********************************************************************
  2. // Copyright (c) 2017 Unity Technologies. All rights reserved.
  3. //
  4. // Licensed under the ##LICENSENAME##.
  5. // See LICENSE.md file in the project root for full license information.
  6. // ***********************************************************************
  7. using NUnit.Framework;
  8. using System.Collections;
  9. using Autodesk.Fbx;
  10. namespace Autodesk.Fbx.UnitTests
  11. {
  12. public class FbxCollectionTest : Base<FbxCollection>
  13. {
  14. public static void GenericTests<T>(T fbxCollection, FbxManager manager) where T : FbxCollection
  15. {
  16. // TODO: FbxScene has a member count of 3 instead of one (even after clearing), is this normal?
  17. int initialMemberCount = fbxCollection.GetMemberCount ();
  18. // test AddMember
  19. FbxObject obj = FbxObject.Create (manager, "");
  20. bool result = fbxCollection.AddMember (obj);
  21. Assert.IsTrue (result);
  22. Assert.AreEqual(initialMemberCount+1, fbxCollection.GetMemberCount());
  23. // test Clear
  24. fbxCollection.Clear ();
  25. Assert.AreEqual (initialMemberCount, fbxCollection.GetMemberCount());
  26. // test GetAnimLayerMember()
  27. fbxCollection.AddMember(FbxAnimLayer.Create(manager, "animLayer"));
  28. var animLayer = fbxCollection.GetAnimLayerMember ();
  29. Assert.IsInstanceOf<FbxAnimLayer> (animLayer);
  30. var animLayer2 = fbxCollection.GetAnimLayerMember (0);
  31. Assert.AreEqual (animLayer, animLayer2);
  32. // check invalid
  33. Assert.IsNull(fbxCollection.GetAnimLayerMember (1));
  34. Assert.IsNull(fbxCollection.GetAnimLayerMember (-1));
  35. }
  36. [Test]
  37. public void TestBasics ()
  38. {
  39. GenericTests (CreateObject ("fbx collection"), Manager);
  40. }
  41. }
  42. }