Author: gert
Date: 2008-01-03 13:53:19 -0500 (Thu, 03 Jan 2008)
New Revision: 92200

Modified:
   trunk/mcs/class/System/System.ComponentModel/ChangeLog
   trunk/mcs/class/System/System.ComponentModel/Component.cs
   trunk/mcs/class/System/Test/System.ComponentModel/ChangeLog
   trunk/mcs/class/System/Test/System.ComponentModel/TypeDescriptorTests.cs
Log:
* Component.cs: Moved Site property before Container to match MS. This
allows a unit test for ordered result of TypeDescriptor.GetProperties
to pass.
* TypeDescriptorProperties.cs: added test for order of 
PropertyDescriptor instances returned by GetProperties.


Modified: trunk/mcs/class/System/System.ComponentModel/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.ComponentModel/ChangeLog      2008-01-03 
18:41:29 UTC (rev 92199)
+++ trunk/mcs/class/System/System.ComponentModel/ChangeLog      2008-01-03 
18:53:19 UTC (rev 92200)
@@ -1,3 +1,9 @@
+2008-01-03  Gert Driesen  <[EMAIL PROTECTED]>
+
+       * Component.cs: Moved Site property before Container to match MS. This
+       allows a unit test for ordered result of TypeDescriptor.GetProperties
+       to pass.
+
 2008-01-03  Vladimir Krasnov  <[EMAIL PROTECTED]>
 
        * TypeDescriptor.cs: fixed properties order in returning collections

Modified: trunk/mcs/class/System/System.ComponentModel/Component.cs
===================================================================
--- trunk/mcs/class/System/System.ComponentModel/Component.cs   2008-01-03 
18:41:29 UTC (rev 92199)
+++ trunk/mcs/class/System/System.ComponentModel/Component.cs   2008-01-03 
18:53:19 UTC (rev 92200)
@@ -60,6 +60,13 @@
 #endif
 
                [Browsable (false), DesignerSerializationVisibility 
(DesignerSerializationVisibility.Hidden)]
+               public virtual ISite Site
+               {
+                       get { return mySite; }
+                       set { mySite = value; }
+               }
+
+               [Browsable (false), DesignerSerializationVisibility 
(DesignerSerializationVisibility.Hidden)]
                public IContainer Container {
                        get {
                                if (mySite == null)
@@ -92,12 +99,6 @@
                        }
                }
 
-               [Browsable (false), DesignerSerializationVisibility 
(DesignerSerializationVisibility.Hidden)]
-               public virtual ISite Site {
-                       get { return mySite; }
-                       set { mySite = value; }
-               }
-
                ~Component()
                {
                        Dispose (false);

Modified: trunk/mcs/class/System/Test/System.ComponentModel/ChangeLog
===================================================================
--- trunk/mcs/class/System/Test/System.ComponentModel/ChangeLog 2008-01-03 
18:41:29 UTC (rev 92199)
+++ trunk/mcs/class/System/Test/System.ComponentModel/ChangeLog 2008-01-03 
18:53:19 UTC (rev 92200)
@@ -1,3 +1,8 @@
+2008-01-03  Gert Driesen  <[EMAIL PROTECTED]>
+
+       * TypeDescriptorProperties.cs: added test for order of
+       PropertyDescriptor instances returned by GetProperties.
+
 2007-12-25  Vladimir Krasnov  <[EMAIL PROTECTED]>
 
        * PropertyDescriptorCollectionTests.cs: added test for Find method

Modified: 
trunk/mcs/class/System/Test/System.ComponentModel/TypeDescriptorTests.cs
===================================================================
--- trunk/mcs/class/System/Test/System.ComponentModel/TypeDescriptorTests.cs    
2008-01-03 18:41:29 UTC (rev 92199)
+++ trunk/mcs/class/System/Test/System.ComponentModel/TypeDescriptorTests.cs    
2008-01-03 18:53:19 UTC (rev 92200)
@@ -226,6 +226,30 @@
                        get { return prop; }
                        set { prop = value; }
                }
+
+               public string Name {
+                       get { return null; }
+               }
+
+               public string Address {
+                       get { return null; }
+               }
+
+               public string Country {
+                       get { return null; }
+               }
+
+               private string HairColor {
+                       get { return null; }
+               }
+
+               protected int Weight {
+                       get { return 5; }
+               }
+
+               internal int Height {
+                       get { return 0; }
+               }
        }
 
        [DescriptionAttribute ("my test derived component")]
@@ -761,6 +785,25 @@
                        Assert.IsNull (col.Find ("AnotherProperty", true), 
"#B2");
                }
 
+               [Test]
+#if ONLY_1_1
+               [NUnit.Framework.Category ("NotDotNet")] // .NET 1.x (or csc 
1.x) does not retain the original order
+#endif
+               public void GetProperties_Order ()
+               {
+                       MyComponent com = new MyComponent (new MyContainer ());
+
+                       PropertyDescriptorCollection col = 
TypeDescriptor.GetProperties (com);
+                       Assert.AreEqual (7, col.Count, "#1");
+                       Assert.AreEqual ("TestProperty", col [0].Name, "#2");
+                       Assert.AreEqual ("AnotherProperty", col [1].Name, "#3");
+                       Assert.AreEqual ("Name", col [2].Name, "#4");
+                       Assert.AreEqual ("Address", col [3].Name, "#5");
+                       Assert.AreEqual ("Country", col [4].Name, "#6");
+                       Assert.AreEqual ("Site", col [5].Name, "#7");
+                       Assert.AreEqual ("Container", col [6].Name, "#8");
+               }
+
                [TypeConverter (typeof (TestConverter))]
                class TestConverterClass {
                }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to