Esempio n. 1
0
 public void TestBasicProperties()
 {
     TestsObject.AssertEqual(TestFloat, 42.0f, "TestFloat");
     TestsObject.AssertEqual(TestDouble, 108.0, "TestDouble");
     TestsObject.AssertEqual(TestBool, false, "TestBool");
     TestsObject.AssertEqual(TestSByte, 43, "TestSByte");
     TestsObject.AssertEqual(TestInt16, 44, "TestInt16");
     TestsObject.AssertEqual(TestInt, 42, "TestInt");
     TestsObject.AssertEqual(TestInt64, 4815162342108, "TestInt64");
     TestsObject.AssertEqual(TestByte, 43, "TestByte");
     TestsObject.AssertEqual(TestUInt16, 44, "TestUInt16");
     TestsObject.AssertEqual(TestUInt32, 0xc001beef, "TestUInt32");
     TestsObject.AssertEqual(TestUInt64, 0xdeadbeefdeadbeef, "TestUInt64");
     TestsObject.AssertEqual(TestEnum, PixelFormat.A8R8G8B8, "TestEnum");
     TestsObject.AssertEqual(TestEnumCpp, ControllerHand.Special7, "TestEnumCpp");
     TestsObject.AssertEqual(TestText.ToString(), "Bork bork bork", "TestText");
     TestFloat   = -42.0f;
     TestDouble  = -108.0;
     TestInt     = -42;
     TestInt64   = -4815162342108;
     TestEnum    = PixelFormat.BC4;
     TestEnumCpp = ControllerHand.AnyHand;
     TestsObject.AssertEqual(TestFloat, -42.0f, "TestFloat-Write");
     TestsObject.AssertEqual(TestDouble, -108.0, "TestDouble-Write");
     TestsObject.AssertEqual(TestInt, -42, "TestInt-Write");
     TestsObject.AssertEqual(TestInt64, -4815162342108, "TestInt64-Write");
     TestsObject.AssertEqual(TestEnum, PixelFormat.BC4, "TestEnum-Write");
     TestsObject.AssertEqual(TestEnumCpp, ControllerHand.AnyHand, "TestEnumCpp-Write");
     TestsObject.AssertEqual(TestPropertyInitializer, 5, "TestPropertyInitializer");
     TestsObject.AssertEqual(TestGetOnlyPropertyInitializer, true, "TestGetOnlyPropertyInitializer");
 }
Esempio n. 2
0
        public void TestStructConst()
        {
            var expected = new TestStructConst {
                ActualValue = 7, Foo = null
            };

            TestStructConstProp = expected;
            TestsObject.AssertEqual(TestStructConstProp, expected, "TestStructConstProp");
        }
Esempio n. 3
0
 public void ManagedServerFunction(bool valid, string str, MonoTestsStruct strukt)
 {
     TestsObject.AssertEqual(valid, true, "valid");
     TestsObject.AssertEqual(str, "Foo", "str");
     TestsObject.AssertEqual(strukt.TestStructFloat, 108.0f, "strukt.TestStructFloat");
     TestsObject.AssertEqual(strukt.TestStructInt32, 24601, "strukt.TestStructInt32");
     TestsObject.AssertEqual(strukt.TestSubStruct.TestBool1, false, "strukt.TestSubStruct.TestBool1");
     TestsObject.AssertEqual(strukt.TestSubStruct.TestBool2, true, "strukt.TestSubStruct.TestBool2");
 }
Esempio n. 4
0
        protected override void TestOverridableParams(string str, MonoTestsStruct strukt)
        {
            TestsObject.AssertEqual(str, "Foo", "str");
            TestsObject.AssertEqual(strukt.TestStructFloat, 22.0f, "strukt.TestStructFloat");
            TestsObject.AssertEqual(strukt.TestStructInt32, 42, "strukt.TestStructInt32");
            TestsObject.AssertEqual(strukt.TestStructWeakObject.IsValid(), false, "strukt.TestStructWeakObject.IsValid()");

            TestsObject.AssertEqual(strukt.TestSubStruct.TestBool1, false, "strukt.TestSubStruct.TestBool1");
            TestsObject.AssertEqual(strukt.TestSubStruct.TestBool2, true, "strukt.TestSubStruct.TestBool2");
        }
Esempio n. 5
0
        public IList <Core.Object> ManagedUFunctionArrayTest(IList <Core.Object> param)
        {
            TestsObject.AssertEqual(param.Count, 2, "ManagedUFunctionArrayTest param.Count");
            TestsObject.AssertEqual(param[0], TestsObject, "ManagedUFunctionArrayTest param[0]");
            TestsObject.AssertEqual(param[1], this, "ManagedUFunctionArrayTest param[1]");

            IList <Core.Object> toReturn = new List <Core.Object>();

            toReturn.Add(TestsObject.TestSubObject);
            return(toReturn);
        }
Esempio n. 6
0
        public void TestUserStructWeakObjectProperty()
        {
            UserWeakRefStruct expected = new UserWeakRefStruct()
            {
                WeakRef1 = TestsObject,
                WeakRef2 = this,
            };

            TestWeakRefStruct = expected;
            TestsObject.AssertEqual(TestWeakRefStruct, expected, "TestWeakRefStruct");
        }
Esempio n. 7
0
        public void ManagedUFunctionOutParamTest(ref string x, ref int y, out IList <Core.Object> z)
        {
            TestsObject.AssertEqual("Fahrenheit", x, "x");
            TestsObject.AssertEqual(451, y, "y");

            x = "Catch";
            y = 22;

            z = new List <Core.Object>();
            z.Add(this);
            z.Add(TestsObject.TestSubObject);
        }
Esempio n. 8
0
        public void TestWeakObjectProperty()
        {
            TestsObject.AssertEqual(TestWeakObject.Object, this, "TestWeakObject.Object");

            TestWeakObject = TestsObject;
            TestsObject.AssertEqual(TestWeakObject.Object, TestsObject, "TestWeakObject.Object");

            // Weakrefs can be set null as a shorthand for invalidation, but we still expect the getter to return an object.
            TestWeakObject = null;
            TestsObject.AssertNotNull(TestWeakObject, "TestWeakObject");
            TestsObject.AssertReturn(TestWeakObject.IsValid(), false, "TestWeakObject.IsValid");
        }
Esempio n. 9
0
        public void TestFixedArrays()
        {
            TestsObject.AssertEqual(TestFixedIntArray.Length, 5, "TestFixedIntArray.Length");
            for (int i = 0; i < TestFixedIntArray.Length; ++i)
            {
                TestFixedIntArray[i] = i * i;
                TestsObject.AssertEqual(TestFixedIntArray[i], i * i, "TestFixedIntArray[i]");
            }

            TestsObject.AssertEqual(TestFixedObjectArray.Length, 3, "TestFixedObjectArray.Length");
            TestFixedObjectArray[0] = this;
            TestsObject.AssertEqual(TestFixedObjectArray[0], this, "TestFixedObjectArray[0]");
            TestFixedObjectArray[1] = null;
            TestsObject.AssertEqual(TestFixedObjectArray[1], null, "TestFixedObjectArray[1]");
            TestFixedObjectArray[2] = TestsObject;
            TestsObject.AssertEqual(TestFixedObjectArray[2], TestsObject, "TestFixedObjectArray[2]");
        }
Esempio n. 10
0
        public void TestRPC()
        {
            MonoTestsStruct testStruct = new MonoTestsStruct
            {
                TestStructFloat = 108.0f,
                TestStructInt32 = 24601,
                TestSubStruct   = new MonoTestsSubStruct {
                    TestBool1 = false, TestBool2 = true
                },
            };

            ManagedServerFunction(true, "Foo", testStruct);
            string RPCFailReason = UnrealInterop.RPCGetLastFailedReason();

            TestsObject.AssertNull(RPCFailReason, "RPCFailReason");

            ManagedServerFunction(false, "Bar", testStruct);
            RPCFailReason = UnrealInterop.RPCGetLastFailedReason();
            TestsObject.AssertEqual(RPCFailReason, "ManagedServerFunction_Validate", "RPCFailReason");

            UnrealInterop.RPCResetLastFailedReason();
        }
Esempio n. 11
0
        public void TestStructProperties()
        {
            TestsObject.AssertEqual(TestVector3, new OpenTK.Vector3(42.0f, 42.0f, 42.0f), "TestVector");
            TestsObject.AssertEqual(TestName, new Name("Meef"), "TestName");
            TestsObject.AssertEqual(TestRotator, new Rotator(42.0f, 42.0f, 42.0f), "TestRotator");
            TestsObject.AssertEqual(TestColor, new Color(42, 42, 42, 42), "TestColor");
            TestsObject.AssertEqual(TestString, "Meef", "TestString");
            MonoTestsStruct testValue = new MonoTestsStruct
            {
                TestStructFloat      = 42.0f,
                TestStructInt32      = -42,
                TestStructWeakObject = TestsObject,
                TestSubStruct        = new MonoTestsSubStruct
                {
                    TestBool1 = true,
                    TestBool2 = false,
                },
            };

            TestsObject.AssertEqual(TestStruct, testValue, "TestStruct");
            TestString = "Foo";
            TestsObject.AssertEqual(TestString, "Foo", "TestString-Write");
        }
Esempio n. 12
0
        public void TestUserStructs()
        {
            TestUserStruct expected = new TestUserStruct
            {
                Sub = new TestUserSubStruct
                {
                    Foo = this,
                    Bar = typeof(UnrealEngine.Engine.Actor),
                },
                BlittableSub = new TestUserSubStructBlittable
                {
                    X = 22,
                    Y = 42.0f,
                    Z = true,
                },
            };

            TestUserStruct = expected;
            TestsObject.AssertEqual(TestUserStruct, expected, "TestUserStruct");

            // Verify the generated IUnrealArrayMarshaler, too.
            TestUserStructArray.Add(expected);
            MonoTestsObject.TestArray(new TestUserStruct[] { expected }, new ReadOnlyCollection <TestUserStruct>(TestUserStructArray), "TestUserStructArray", null);
        }
Esempio n. 13
0
        public void TestUserEnums()
        {
            string enumName = GetTestUserEnumByName(2);

            TestsObject.AssertEqual(enumName, "C", "TestUserEnum.C");
        }
Esempio n. 14
0
 protected override float TestOverridableFloatReturn(float X, float Y)
 {
     TestsObject.AssertEqual(Y, 42.0f, "Y");
     return(X);
 }
Esempio n. 15
0
 public int ManagedUFunction(int X, int Y, string Z)
 {
     TestsObject.AssertEqual(Y, 108, "Y");
     TestsObject.AssertEqual(Z, "Apepe", "Z");
     return(X);
 }
Esempio n. 16
0
 public SubclassOf <UnrealEngine.Engine.Actor> ManagedUFunctionSubclassOfTest(SubclassOf <UnrealEngine.Engine.Actor> param)
 {
     TestsObject.AssertEqual(param, typeof(UnrealEngine.Engine.Light), "ManagedUFunctionSubclassOfTest.param");
     return(param);
 }
Esempio n. 17
0
 public void TestSubclassOfProperties()
 {
     TestsObject.AssertEqual(TestSubclassOf, typeof(UnrealEngine.Engine.Light), "TestSubclassOf.Class");
 }