Example #1
0
        // public static void complex_ptr_in()
        // {
        // }

        // public static void complex_ptr_in_own()
        // {
        // }

        public static void complex_out()
        {
            var  complex = new Dummy.StructComplex();
            var  t       = new Dummy.TestObject();
            bool r       = t.StructComplexOut(out complex);

            Test.Assert(r, "Function returned false");
            checkStructComplex(complex);
        }
Example #2
0
        internal static Dummy.StructComplex structComplexWithValues()
        {
            var complex = new Dummy.StructComplex();

            complex.Farray = new Eina.Array <int>();
            complex.Farray.Push(0x0);
            complex.Farray.Push(0x2A);
            complex.Farray.Push(0x42);

            complex.Finarray = new Eina.Inarray <int>();
            complex.Finarray.Push(0x0);
            complex.Finarray.Push(0x2A);
            complex.Finarray.Push(0x42);


            complex.Flist = new Eina.List <string>();
            complex.Flist.Append("0x0");
            complex.Flist.Append("0x2A");
            complex.Flist.Append("0x42");

            complex.Finlist = new Eina.Inlist <int>();
            complex.Finlist.Append(0x0);
            complex.Finlist.Append(0x2A);
            complex.Finlist.Append(0x42);

            complex.Fhash       = new Eina.Hash <string, string>();
            complex.Fhash["aa"] = "aaa";
            complex.Fhash["bb"] = "bbb";
            complex.Fhash["cc"] = "ccc";

            complex.Fiterator = complex.Farray.GetIterator();

            complex.Fany_value = new Eina.Value(Eina.ValueType.Double);
            complex.Fany_value.Set(-9007199254740992.0);

            complex.Fany_value_ptr = new Eina.Value(Eina.ValueType.String);
            complex.Fany_value_ptr.Set("abc");

            complex.Fbinbuf = new Eina.Binbuf();
            complex.Fbinbuf.Append(126);

            complex.Fslice.Length = 1;
            complex.Fslice.Mem    = Eina.MemoryNative.Alloc(1);
            Marshal.WriteByte(complex.Fslice.Mem, 125);

            complex.Fobj = new Dummy.Numberwrapper();
            complex.Fobj.SetNumber(42);

            return(complex);
        }
Example #3
0
        internal static void checkZeroedStructComplex(Dummy.StructComplex complex)
        {
            Test.Assert(complex.Farray == null);
            Test.Assert(complex.Flist == null);
            Test.Assert(complex.Fhash == null);
            Test.Assert(complex.Fiterator == null);
            Test.Assert(complex.Fany_value == null);
            Test.Assert(complex.Fany_value_ref == null);
            Test.Assert(complex.Fbinbuf == null);

            Test.Assert(complex.Fslice.Length == 0);
            Test.Assert(complex.Fslice.Mem == IntPtr.Zero);

            Test.Assert(complex.Fobj == null);
        }
Example #4
0
        public static void event_with_struct_complex_payload()
        {
            var obj = new Dummy.TestObject();

            Dummy.StructComplex received_struct = default(Dummy.StructComplex);

            obj.EvtWithStructComplexEvent += (object sender, Dummy.TestObjectEvtWithStructComplexEventArgs e) => {
                received_struct = e.arg;
            };

            Dummy.StructComplex sent_struct = StructHelpers.structComplexWithValues();

            obj.EmitEventWithStructComplex(sent_struct);

            Test.AssertEquals(sent_struct.Fobj, received_struct.Fobj);
        }
Example #5
0
        internal static void checkStructComplex(Dummy.StructComplex complex)
        {
            Test.Assert(complex.Farray.ToArray().SequenceEqual(base_seq_int));

            Test.Assert(complex.Finarray.ToArray().SequenceEqual(base_seq_int));

            Test.Assert(complex.Flist.ToArray().SequenceEqual(base_seq_str));

            Test.Assert(complex.Finlist.ToArray().SequenceEqual(base_seq_int));

            Test.Assert(complex.Fhash["aa"] == "aaa");
            Test.Assert(complex.Fhash["bb"] == "bbb");
            Test.Assert(complex.Fhash["cc"] == "ccc");

            int idx = 0;

            foreach (int e in complex.Fiterator)
            {
                Test.Assert(e == base_seq_int[idx]);
                ++idx;
            }

            double double_val = 0;

            Test.Assert(complex.Fany_value.Get(out double_val));
            Test.Assert(double_val == -9007199254740992.0);

            string str_val = null;

            Test.Assert(complex.Fany_value_ptr.Get(out str_val));
            Test.Assert(str_val == "abc");

            Test.Assert(complex.Fbinbuf.Length == 1);
            Test.Assert(complex.Fbinbuf.GetBytes()[0] == 126);

            Test.Assert(complex.Fslice.Length == 1);
            Test.Assert(complex.Fslice.GetBytes()[0] == 125);

            Test.Assert(complex.Fobj != null);
            Test.Assert(complex.Fobj.GetNumber() == 42);
        }
Example #6
0
        private static void complex_default_instantiation()
        {
            var complex = new Dummy.StructComplex();

            checkZeroedStructComplex(complex);
        }