Author: gert
Date: 2006-11-13 09:11:38 -0500 (Mon, 13 Nov 2006)
New Revision: 67755

Modified:
   trunk/mcs/class/Managed.Windows.Forms/SWF.csproj
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs
   trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlEventTest.cs
   
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TreeNodeCollectionTest.cs
Log:
* ControlEventTest.cs: Added tests for Invalidated event.
* TreeNodeCollectionTest.cs: Added IList indexer tests.
* TreeNodeCollection.cs: Avoid duplicating indexer code.


Modified: trunk/mcs/class/Managed.Windows.Forms/SWF.csproj
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/SWF.csproj    2006-11-13 13:45:18 UTC 
(rev 67754)
+++ trunk/mcs/class/Managed.Windows.Forms/SWF.csproj    2006-11-13 14:11:38 UTC 
(rev 67755)
@@ -209,6 +209,16 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = 
"System.Windows.Forms.Design\ToolStripItemDesignerAvailability.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = 
"System.Windows.Forms.Design\ToolStripItemDesignerAvailabilityAttribute.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = 
"System.Windows.Forms.Design\WindowsFormsComponentEditor.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
@@ -2569,11 +2579,6 @@
                     BuildAction = "Compile"
                 />
                 <File
-                    RelPath = "System.Windows.Forms\PropertyGridEntry.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
                     RelPath = "System.Windows.Forms\PropertyGridTextBox.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
@@ -2719,6 +2724,11 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "System.Windows.Forms\RootGridEntry.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "System.Windows.Forms\RowStyle.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
@@ -2939,6 +2949,11 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "System.Windows.Forms\StatusStrip.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "System.Windows.Forms\StructFormat.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
@@ -3214,6 +3229,11 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "System.Windows.Forms\ToolStripDropDown.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = 
"System.Windows.Forms\ToolStripDropDownCloseReason.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
@@ -3309,6 +3329,11 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "System.Windows.Forms\ToolStripItemEventType.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = 
"System.Windows.Forms\ToolStripItemImageRenderEventArgs.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
@@ -3374,6 +3399,11 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "System.Windows.Forms\ToolStripMenuTracker.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "System.Windows.Forms\ToolStripPanel.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
@@ -3439,6 +3469,11 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "System.Windows.Forms\ToolStripStatusLabel.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = 
"System.Windows.Forms\ToolStripStatusLabelBorderSides.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
@@ -3999,6 +4034,11 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = 
"System.Windows.Forms.VisualStyles\VisualStyleState.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "resources\System.Windows.Forms.resources"
                     BuildAction = "EmbeddedResource"
                 />

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-11-13 13:45:18 UTC (rev 67754)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-11-13 14:11:38 UTC (rev 67755)
@@ -1,3 +1,7 @@
+2006-11-13  Gert Driesen  <[EMAIL PROTECTED]>
+
+       * TreeNodeCollection.cs: Avoid duplicating indexer code.
+
 2006-11-12  Gert Driesen  <[EMAIL PROTECTED]>
 
        * ColorDialog.cs: Reset size of dialog between calls to ShowDialog.

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs
    2006-11-13 13:45:18 UTC (rev 67754)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs
    2006-11-13 14:11:38 UTC (rev 67755)
@@ -72,16 +72,12 @@
 
                object IList.this [int index] {
                        get {
-                               if (index < 0 || index >= Count)
-                                       throw new ArgumentOutOfRangeException 
("index");
-                               return nodes [index];
+                               return this [index];
                        }
                        set {
-                               if (index < 0 || index >= Count)
-                                       throw new ArgumentOutOfRangeException 
("index");
-                               TreeNode node = (TreeNode) value;
-                               SetupNode (node);
-                               nodes [index] = node;
+                               if (!(value is TreeNode))
+                                       throw new ArgumentException ("value");
+                               this [index] = (TreeNode) value;
                        }
                }
 

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2006-11-13 13:45:18 UTC (rev 67754)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2006-11-13 14:11:38 UTC (rev 67755)
@@ -1,3 +1,8 @@
+2006-11-13  Gert Driesen  <[EMAIL PROTECTED]>
+
+       * ControlEventTest.cs: Added tests for Invalidated event.
+       * TreeNodeCollectionTest.cs: Added IList indexer tests.
+
 2006-11-12  Gert Driesen  <[EMAIL PROTECTED]>
 
        * TextBoxTest.cs: Added (NotWorking) test for bug #79909.

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlEventTest.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlEventTest.cs
 2006-11-13 13:45:18 UTC (rev 67754)
+++ 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ControlEventTest.cs
 2006-11-13 14:11:38 UTC (rev 67755)
@@ -296,4 +296,79 @@
                        Assert.AreEqual (true, eventhandled, "#F2");
                }
        }
+
+       [TestFixture]
+       public class ControlRefresh
+       {
+               [SetUp]
+               public void SetUp ()
+               {
+                       invalidated = 0;
+               }
+
+               [Test]
+               public void HandleNotCreated ()
+               {
+                       Control c = new Control ();
+                       c.Invalidated += new InvalidateEventHandler 
(Control_Invalidated);
+
+                       c.Visible = true;
+                       c.Refresh ();
+                       Assert.AreEqual (0, invalidated, "#1");
+
+                       c.Visible = false;
+                       c.Refresh ();
+                       Assert.AreEqual (0, invalidated, "#2");
+               }
+
+               [Test]
+               [Category ("NotWorking")]
+               public void Visible ()
+               {
+                       Control c = new Control ();
+                       c.Invalidated += new InvalidateEventHandler 
(Control_Invalidated);
+                       c.Visible = true;
+
+                       Form form = new Form ();
+                       form.ShowInTaskbar = false;
+                       form.Controls.Add (c);
+
+                       form.Show ();
+                       Assert.AreEqual (0, invalidated, "#1");
+
+                       c.Refresh ();
+                       Assert.AreEqual (1, invalidated, "#2");
+
+                       form.Refresh ();
+                       Assert.AreEqual (1, invalidated, "#3");
+               }
+
+               [Test]
+               public void NotVisible ()
+               {
+                       Control c = new Control ();
+                       c.Invalidated += new InvalidateEventHandler 
(Control_Invalidated);
+                       c.Visible = false;
+
+                       Form form = new Form ();
+                       form.ShowInTaskbar = false;
+                       form.Controls.Add (c);
+
+                       form.Show ();
+                       Assert.AreEqual (0, invalidated, "#1");
+
+                       c.Refresh ();
+                       Assert.AreEqual (0, invalidated, "#2");
+
+                       form.Refresh ();
+                       Assert.AreEqual (0, invalidated, "#3");
+               }
+
+               private void Control_Invalidated (object sender, 
InvalidateEventArgs e)
+               {
+                       invalidated++;
+               }
+
+               private int invalidated;
+       }
 }

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TreeNodeCollectionTest.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TreeNodeCollectionTest.cs
   2006-11-13 13:45:18 UTC (rev 67754)
+++ 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TreeNodeCollectionTest.cs
   2006-11-13 14:11:38 UTC (rev 67755)
@@ -111,5 +111,85 @@
                        enumerator.MoveNext ();
                        Assert.IsNull (enumerator.Current, "#B2");
                }
+
+               [Test]
+               public void IList_Indexer_Get ()
+               {
+                       TreeView tv = new TreeView ();
+                       TreeNode nodeA = tv.Nodes.Add ("A");
+                       TreeNode nodeB = tv.Nodes.Add ("B");
+                       TreeNode nodeC = tv.Nodes.Add ("C");
+
+                       IList list = (IList) tv.Nodes;
+
+                       Assert.AreSame (nodeA, list [0], "#A1");
+                       Assert.AreSame (nodeB, list [1], "#A2");
+                       Assert.AreSame (nodeC, list [2], "#A3");
+
+                       try {
+                               object item = list [3];
+                               Assert.Fail ("#B1: " + item);
+                       } catch (ArgumentOutOfRangeException ex) {
+                               Assert.AreEqual (typeof 
(ArgumentOutOfRangeException), ex.GetType (), "#B2");
+                               Assert.IsNull (ex.ActualValue, "#B3");
+                               Assert.IsNull (ex.InnerException, "#B4");
+                               Assert.AreEqual ("index", ex.ParamName, "#B5");
+                       }
+
+                       try {
+                               object item = list [-1];
+                               Assert.Fail ("#C1: " + item);
+                       } catch (ArgumentOutOfRangeException ex) {
+                               Assert.AreEqual (typeof 
(ArgumentOutOfRangeException), ex.GetType (), "#C2");
+                               Assert.IsNull (ex.ActualValue, "#C3");
+                               Assert.IsNull (ex.InnerException, "#C4");
+                               Assert.AreEqual ("index", ex.ParamName, "#C5");
+                       }
+               }
+
+               [Test]
+               public void IList_Indexer_Set ()
+               {
+                       TreeView tv = new TreeView ();
+                       TreeNode nodeA = tv.Nodes.Add ("A");
+
+                       IList list = (IList) tv.Nodes;
+                       TreeNode nodeB = new TreeNode ("B");
+                       list [0] = nodeB;
+                       Assert.AreSame (nodeB, list [0], "#A1");
+
+                       try {
+                               list [1] = nodeA;
+                               Assert.Fail ("#B1");
+                       } catch (ArgumentOutOfRangeException ex) {
+                               Assert.AreEqual (typeof 
(ArgumentOutOfRangeException), ex.GetType (), "#B2");
+                               Assert.IsNull (ex.ActualValue, "#B3");
+                               Assert.IsNull (ex.InnerException, "#B4");
+#if NET_2_0
+                               Assert.AreEqual ("index", ex.ParamName, "#B5");
+#endif
+                       }
+
+                       try {
+                               list [-1] = nodeA;
+                               Assert.Fail ("#C1");
+                       } catch (ArgumentOutOfRangeException ex) {
+                               Assert.AreEqual (typeof 
(ArgumentOutOfRangeException), ex.GetType (), "#C2");
+                               Assert.IsNull (ex.ActualValue, "#C3");
+                               Assert.IsNull (ex.InnerException, "#C4");
+#if NET_2_0
+                               Assert.AreEqual ("index", ex.ParamName, "#C5");
+#endif
+                       }
+
+                       try {
+                               list [0] = "whatever";
+                               Assert.Fail ("#D1");
+                       } catch (ArgumentException ex) {
+                               Assert.AreEqual (typeof (ArgumentException), 
ex.GetType (), "#D2");
+                               Assert.IsNull (ex.InnerException, "#D3");
+                               Assert.IsNull (ex.ParamName, "#D4");
+                       }
+               }
        }
 }

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

Reply via email to