예제 #1
0
        public void AnimCurveNodeTest_ConnectToChannel_AddsSrcConnection()
        {
            // given:
            var acn = new AnimCurveNode("acn");
            var ac  = new AnimCurve("ac");

            acn.AddChannel <float>("channel1", 0.0f);

            // require:
            Assert.AreEqual(2, CountProperties(acn));
            Assert.AreEqual(1, acn.GetChannelsCount());
            Assert.AreEqual(0, acn.GetCurveCount(0));

            // when:
            acn.ConnectToChannel(ac, 0U);

            // then:
            Assert.AreEqual(2, CountProperties(acn));
            Assert.AreEqual(1, acn.GetChannelsCount());
            Assert.AreEqual(1, acn.GetCurveCount(0));
            Assert.AreEqual(1, ac.GetDstPropertyCount());
            Assert.AreEqual("channel1", ac.GetDstProperty(0).GetName());
            var prop = acn.GetFirstProperty();

            Assert.True(prop.IsValid());
            prop = acn.GetNextProperty(prop);
            Assert.True(prop.IsValid());
            Assert.AreEqual(1, prop.GetSrcObjectCount());
            Assert.AreSame(ac, prop.GetSrcObject(0));
        }