Ejemplo n.º 1
0
        public void FbxObject_TypedGetSrcObjectCount_GetsCountOfObjectsOfThatType()
        {
            // given:
            var obj   = new FbxObject("asdf");
            var mesh1 = new FbxMesh("mesh1");
            var mesh2 = new FbxMesh("mesh2");
            var node  = new FbxNode("node");
            var mesh3 = new FbxMesh("mesh3");
            var light = new FbxLight("light");

            obj.ConnectSrcObject(mesh1);
            obj.ConnectSrcObject(mesh2);
            obj.ConnectSrcObject(node);
            obj.ConnectSrcObject(mesh3);
            obj.ConnectSrcObject(light);

            // require:
            Assert.AreEqual(5, obj.GetSrcObjectCount());
            Assert.AreSame(mesh1, obj.GetSrcObject(0));
            Assert.AreSame(mesh2, obj.GetSrcObject(1));
            Assert.AreSame(node, obj.GetSrcObject(2));
            Assert.AreSame(mesh3, obj.GetSrcObject(3));
            Assert.AreSame(light, obj.GetSrcObject(4));

            // then:
            Assert.AreEqual(3, obj.GetSrcObjectCount <FbxMesh>());
            Assert.AreEqual(1, obj.GetSrcObjectCount <FbxNode>());
            Assert.AreEqual(1, obj.GetSrcObjectCount <FbxLight>());
            Assert.AreEqual(4, obj.GetSrcObjectCount <FbxNodeAttribute>());
        }
Ejemplo n.º 2
0
        public void FbxObject_TypedDisconnectAllSrcObjectWithInheritance_DisconnectsAllSrcObjectOfThatType()
        {
            // given:
            var obj   = new FbxObject("asdf");
            var mesh1 = new FbxMesh("mesh1");
            var node  = new FbxNode("node");
            var light = new FbxLight("light");

            obj.ConnectSrcObject(mesh1);
            obj.ConnectSrcObject(node);
            obj.ConnectSrcObject(light);

            // require:
            Assert.AreEqual(3, obj.GetSrcObjectCount());
            Assert.AreSame(mesh1, obj.GetSrcObject(0));
            Assert.AreSame(node, obj.GetSrcObject(1));
            Assert.AreSame(light, obj.GetSrcObject(2));

            Assert.AreEqual(1, obj.GetSrcObjectCount <FbxMesh>());
            Assert.AreEqual(1, obj.GetSrcObjectCount <FbxNode>());
            Assert.AreEqual(1, obj.GetSrcObjectCount <FbxLight>());
            Assert.AreEqual(2, obj.GetSrcObjectCount <FbxNodeAttribute>());

            Assert.AreEqual(1, mesh1.GetDstObjectCount());
            Assert.AreEqual(1, node.GetDstObjectCount());
            Assert.AreEqual(1, light.GetDstObjectCount());

            // when:
            var ret = obj.DisconnectAllSrcObject <FbxNodeAttribute>();

            // then:
            Assert.True(ret);
            Assert.AreEqual(1, obj.GetSrcObjectCount());
            Assert.AreSame(node, obj.GetSrcObject());
            Assert.AreSame(node, obj.GetSrcObject(0));

            Assert.AreEqual(0, obj.GetSrcObjectCount <FbxMesh>());
            Assert.AreEqual(0, obj.GetSrcObjectCount <FbxLight>());
            Assert.AreEqual(0, obj.GetSrcObjectCount <FbxNodeAttribute>());

            Assert.AreEqual(1, obj.GetSrcObjectCount <FbxNode>());
            Assert.AreSame(node, obj.GetSrcObject <FbxNode>());
            Assert.AreSame(node, obj.GetSrcObject <FbxNode>(0));

            Assert.AreEqual(0, mesh1.GetDstObjectCount());
            Assert.AreEqual(1, node.GetDstObjectCount());
            Assert.AreEqual(0, light.GetDstObjectCount());
        }
Ejemplo n.º 3
0
        public void FbxObject_TypedDisconnectAllSrcObject_DisconnectsAllSrcObjectOfThatType()
        {
            // given:
            var obj   = new FbxObject("asdf");
            var mesh1 = new FbxMesh("mesh1");
            var node  = new FbxNode("node");
            var mesh2 = new FbxMesh("mesh2");

            obj.ConnectSrcObject(mesh1);
            obj.ConnectSrcObject(node);
            obj.ConnectSrcObject(mesh2);

            // require:
            Assert.AreEqual(3, obj.GetSrcObjectCount());
            Assert.AreSame(mesh1, obj.GetSrcObject(0));
            Assert.AreSame(node, obj.GetSrcObject(1));
            Assert.AreSame(mesh2, obj.GetSrcObject(2));

            Assert.AreEqual(2, obj.GetSrcObjectCount <FbxMesh>());
            Assert.AreEqual(1, obj.GetSrcObjectCount <FbxNode>());

            Assert.AreEqual(1, mesh1.GetDstObjectCount());
            Assert.AreEqual(1, node.GetDstObjectCount());
            Assert.AreEqual(1, mesh2.GetDstObjectCount());

            // when:
            var ret = obj.DisconnectAllSrcObject <FbxMesh>();

            // then:
            Assert.True(ret);
            Assert.AreEqual(1, obj.GetSrcObjectCount());
            Assert.AreSame(node, obj.GetSrcObject());
            Assert.AreSame(node, obj.GetSrcObject(0));

            Assert.AreEqual(0, obj.GetSrcObjectCount <FbxMesh>());

            Assert.AreEqual(1, obj.GetSrcObjectCount <FbxNode>());
            Assert.AreSame(node, obj.GetSrcObject <FbxNode>());
            Assert.AreSame(node, obj.GetSrcObject <FbxNode>(0));

            Assert.AreEqual(0, mesh1.GetDstObjectCount());
            Assert.AreEqual(1, node.GetDstObjectCount());
            Assert.AreEqual(0, mesh2.GetDstObjectCount());
        }
Ejemplo n.º 4
0
        public void SrcObjectBothGetCollected()
        {
            // given
            var obj   = new FbxObject();
            var other = new FbxObject();

            obj.ConnectSrcObject(other);

            // when
            var result = collector.Collect(obj);

            // then
            Assert.NotNull(result);
            CollectionAssert.Contains(result, obj);
            CollectionAssert.Contains(result, other);
            Assert.AreEqual(2, result.Count);
        }