示例#1
0
        public void PrimitiveTypes()
        {
            // Pointer that would come from Blender/Python
            var ptr = Mocks.GetNativeTestPrimitivesPtr();

            // Convert to a C# representation only parsing out primitives
            var result = rna.Transcribe <Primitives>(ptr);

            Assert.AreEqual(0.14f, result.myFloat);
            Assert.AreEqual(14, result.myInt);
            Assert.AreEqual(17, result.myShort);
        }
示例#2
0
        public void ValueTypeStruct()
        {
            var ptr = Mocks.GetNativeTestPrimitivesPtr();

            // Same source type but converted to one with a nested struct
            // that should fit a sequence of values.
            var result = rna.Transcribe <Primitives_WithNestedStruct>(ptr);

            Assert.AreEqual(15, result.flag);

            // float x, y, z -> represented as Vector3 struct
            Assert.AreEqual(1f, result.position.x);
            Assert.AreEqual(0, result.position.y);
            Assert.AreEqual(-1f, result.position.z);
        }