* X11Structs.cs: Add a few ToString() overrides.
[mono.git] / mono / tests / marshal7.cs
index db8e8c8b796ab8f5d91658a1ddf47eff2287ef44..9e91e65443d756639427f96e733ef630f5da1d58 100644 (file)
@@ -23,6 +23,34 @@ public class Test
                public int              c;
        }
 
+       [StructLayout (LayoutKind.Sequential)]
+       public class TestStruct4
+       {
+               [MarshalAs (UnmanagedType.Interface)]
+               object itf;
+       }
+
+       [StructLayout (LayoutKind.Sequential)]
+       public class TestStruct5
+       {
+               [MarshalAs (UnmanagedType.IUnknown)]
+               object itf;
+       }
+
+       [StructLayout (LayoutKind.Sequential)]
+       public class TestStruct6
+       {
+               [MarshalAs (UnmanagedType.IDispatch)]
+               object itf;
+       }
+
+       [StructLayout (LayoutKind.Sequential)]
+       public class TestStruct7
+       {
+               [MarshalAs (UnmanagedType.Struct)]
+               object itf;
+       }
+
        public unsafe static int Main () 
        {
                ///
@@ -99,6 +127,17 @@ public class Test
                        return 9;
                }
 
+               // test size of structs with objects
+               if (Marshal.SizeOf (typeof (TestStruct4)) != IntPtr.Size)
+                       return 10;
+               if (Marshal.SizeOf (typeof (TestStruct5)) != IntPtr.Size)
+                       return 11;
+               if (Marshal.SizeOf (typeof (TestStruct6)) != IntPtr.Size)
+                       return 12;
+               // a VARIANT is 
+               if (Marshal.SizeOf (typeof (TestStruct7)) != 16)
+                       return 13;
+
                return 0;
        }
 }