123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- // ***********************************************************************
- // Copyright (c) 2017 Unity Technologies. All rights reserved.
- //
- // Licensed under the ##LICENSENAME##.
- // See LICENSE.md file in the project root for full license information.
- // ***********************************************************************
- using NUnit.Framework;
- using Autodesk.Fbx;
- using System.Collections.Generic;
- namespace Autodesk.Fbx.UnitTests
- {
- public class FbxBindingTableTest : Base<FbxBindingTable>
- {
- #if ENABLE_COVERAGE_TEST
- [Test]
- public override void TestCoverage() {
- // This test is also responsible for FbxBindingTableBase and FbxBindingTableEntry
- base.TestCoverage();
- CoverageTester.TestCoverage(typeof(FbxBindingTableBase), this.GetType());
- CoverageTester.TestCoverage(typeof(FbxBindingTableEntry), this.GetType());
- CoverageTester.TestCoverage(typeof(FbxEntryView), this.GetType());
- CoverageTester.TestCoverage(typeof(FbxPropertyEntryView), this.GetType());
- CoverageTester.TestCoverage(typeof(FbxSemanticEntryView), this.GetType());
- }
- #endif
- [Test]
- public void TestBasics() {
- var table = FbxBindingTable.Create(Manager, "table");
- // Call the getters, make sure they get.
- GetSetProperty(table.DescAbsoluteURL, "file:///dev/null");
- GetSetProperty(table.DescRelativeURL, "shader.glsl");
- GetSetProperty(table.DescTAG, "user");
- // Test dispose.
- var entry = table.AddNewEntry();
- DisposeTester.TestDispose(entry);
- // Test the views.
- entry = table.AddNewEntry();
- var propertyView = new FbxPropertyEntryView(entry, false);
- Assert.IsFalse(propertyView.IsValid());
- DisposeTester.TestDispose(propertyView);
- propertyView = new FbxPropertyEntryView(entry, true, true);
- Assert.IsTrue(propertyView.IsValid());
- Assert.AreEqual("FbxPropertyEntry", propertyView.EntryType());
- propertyView.SetProperty("property");
- Assert.AreEqual("property", propertyView.GetProperty());
- var semanticView = new FbxSemanticEntryView(entry, false);
- Assert.IsFalse(semanticView.IsValid());
- DisposeTester.TestDispose(semanticView);
- semanticView = new FbxSemanticEntryView(entry, false, true);
- Assert.IsTrue(semanticView.IsValid());
- Assert.AreEqual("FbxSemanticEntry", semanticView.EntryType());
- semanticView.SetSemantic("semantic");
- Assert.AreEqual("semantic", semanticView.GetSemantic());
- Assert.AreEqual(0, semanticView.GetIndex());
- Assert.AreEqual("semantic", semanticView.GetSemantic(false));
- }
- void GetSetProperty(FbxPropertyString prop, string value) {
- prop.Set(value);
- Assert.AreEqual(value, prop.Get());
- }
- }
- }
|