Merge pull request #1936 from esdrubal/DotNetRelativeOrAbsolute
[mono.git] / mcs / class / System / Test / System.ComponentModel / PropertyDescriptorTests.cs
index 4309d15db09e4b9534f197070c23a64b52683a1f..f81baa6a984c5408debfe0a6da673e2dc2191bce 100644 (file)
 using System;
 using System.Collections;
 using System.ComponentModel;
+using DescriptionAttribute = System.ComponentModel.DescriptionAttribute;
 using System.ComponentModel.Design;
-using System.Drawing.Design;
 using System.Globalization;
 using System.Reflection;
 using System.Runtime.InteropServices;
-
+#if !MOBILE
+using System.Drawing.Design;
+#endif
 using NUnit.Framework;
 
 namespace MonoTests.System.ComponentModel
@@ -370,9 +372,7 @@ namespace MonoTests.System.ComponentModel
 
                class DisplayName_test
                {
-#if NET_2_0
                        [DisplayName ("An explicit displayname")]
-#endif
                        public bool Explicit {
                                get { return false; }
                        }
@@ -398,7 +398,11 @@ namespace MonoTests.System.ComponentModel
                                get { return null; }
                        }
 
-                       [TypeConverter("System.ComponentModel.CharConverter, " + Consts.AssemblySystem)]
+#if MOBILE
+                       [TypeConverter("System.ComponentModel.CharConverter, System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
+#else
+                       [TypeConverter("System.ComponentModel.CharConverter, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
+#endif
                        public virtual Version WithConverterNamedAssmQuald {
                                get { return null; }
                        }
@@ -724,11 +728,7 @@ namespace MonoTests.System.ComponentModel
                        PropertyDescriptor p = TypeDescriptor.GetProperties (typeof (CanResetNoSetter_test))["Prop"];
                        CanResetNoSetter_test test = new CanResetNoSetter_test ();
 
-#if NET_2_0
                        Assert.IsFalse (p.CanResetValue (test), "1");
-#else
-                       Assert.IsTrue (p.CanResetValue (test), "1");
-#endif
                        Assert.AreEqual (5, test.Prop, "2");
                        p.ResetValue (test);
                        Assert.AreEqual (10, test.Prop, "3");
@@ -781,29 +781,10 @@ namespace MonoTests.System.ComponentModel
                        PropertyDescriptor p1 = TypeDescriptor.GetProperties (typeof (DisplayName_test)) ["Explicit"];
                        PropertyDescriptor p2 = TypeDescriptor.GetProperties (typeof (DisplayName_test)) ["Implicit"];
 
-#if NET_2_0
                        Assert.AreEqual ("An explicit displayname", p1.DisplayName, "#1");
-#else
-                       Assert.AreEqual ("Explicit", p1.DisplayName, "#1");
-#endif
                        Assert.AreEqual ("Implicit", p2.DisplayName, "#2");
                }
 
-               [Test]
-               public void GetEditorTest ()
-               {
-                       PropertyDescriptorCollection col;
-                       PropertyDescriptor pd;
-                       UITypeEditor ed;
-
-                       col = TypeDescriptor.GetProperties (typeof (GetEditor_test));
-                       pd = col [0];
-                       ed = pd.GetEditor (typeof (UITypeEditor)) as UITypeEditor;
-
-                       Assert.IsNotNull (ed, "#01");
-                       Assert.AreEqual (ed.GetType ().Name, "UIEditor", "#02");
-               }
-
                [Test]
                public void AddValueChanged ()
                {
@@ -867,7 +848,6 @@ namespace MonoTests.System.ComponentModel
                        }
                }
 
-#if NET_2_0
                [Test]
                public void GetInvocationTarget_Instance_Null ()
                {
@@ -976,7 +956,6 @@ namespace MonoTests.System.ComponentModel
                        Assert.AreEqual (handlerC, handler.GetInvocationList () [1], "#I4");
                        Assert.IsNull (pd.GetValueChangedHandler (compB), "#I5");
                }
-#endif
 
                [Test]
                public void RemoveValueChanged ()
@@ -1074,7 +1053,7 @@ namespace MonoTests.System.ComponentModel
                                        return attr;
                        return null;
                }
-
+#if !MOBILE
                class GetEditor_test 
                {
                        [Editor (typeof (UIEditor), typeof (UITypeEditor))]
@@ -1085,9 +1064,24 @@ namespace MonoTests.System.ComponentModel
                }
 
                class UIEditor : UITypeEditor
+               {               
+               }
+
+               [Test]
+               public void GetEditorTest ()
                {
+                       PropertyDescriptorCollection col;
+                       PropertyDescriptor pd;
+                       UITypeEditor ed;
                        
+                       col = TypeDescriptor.GetProperties (typeof (GetEditor_test));
+                       pd = col [0];
+                       ed = pd.GetEditor (typeof (UITypeEditor)) as UITypeEditor;
+                       
+                       Assert.IsNotNull (ed, "#01");
+                       Assert.AreEqual (ed.GetType ().Name, "UIEditor", "#02");
                }
+#endif
 
                class MockPropertyDescriptor : PropertyDescriptor
                {
@@ -1146,7 +1140,6 @@ namespace MonoTests.System.ComponentModel
                                base.OnValueChanged (component, e);
                        }
 
-#if NET_2_0
                        public new object GetInvocationTarget (Type type, object instance)
                        {
                                return base.GetInvocationTarget (type, instance);
@@ -1156,7 +1149,6 @@ namespace MonoTests.System.ComponentModel
                        {
                                return base.GetValueChangedHandler (component);
                        }
-#endif
                }
 
                [AttributeUsage (AttributeTargets.Field | AttributeTargets.Property)]