Author: jpobst
Date: 2007-05-01 16:20:25 -0400 (Tue, 01 May 2007)
New Revision: 76548
Modified:
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/TreeNodeCollectionTest.cs
Log:
2007-05-01 Frederik Carlier <[EMAIL PROTECTED]>
* TreeNodeCollection.cs: Fix ContainsKey and IndexOfKey methods to use
count instead of Nodes.Length. [Fixes bug #81448]
2007-05-01 Frederik Carlier <[EMAIL PROTECTED]>
* TreeNodeCollectionTest.cs: Add Unit tests for ContainsKey and
IndexOfKey methods.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-05-01 20:16:18 UTC (rev 76547)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-05-01 20:20:25 UTC (rev 76548)
@@ -1,3 +1,8 @@
+2007-05-01 Frederik Carlier <[EMAIL PROTECTED]>
+
+ * TreeNodeCollection.cs: Fix ContainsKey and IndexOfKey methods to use
+ count instead of Nodes.Length. [Fixes bug #81448]
+
2007-05-01 Jonathan Pobst <[EMAIL PROTECTED]>
* ComboBox.cs: Fix paramName sent to ArgumentOutOfRangeException's.
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs
2007-05-01 20:16:18 UTC (rev 76547)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNodeCollection.cs
2007-05-01 20:20:25 UTC (rev 76548)
@@ -204,7 +204,7 @@
#if NET_2_0
public bool ContainsKey (string key)
{
- for (int i = 0; i < nodes.Length; i++) {
+ for (int i = 0; i < count; i++) {
if (string.Compare (nodes [i].Name, key, true,
CultureInfo.InvariantCulture) == 0)
return true;
}
@@ -230,7 +230,7 @@
#if NET_2_0
public int IndexOfKey (string key)
{
- for (int i = 0; i < nodes.Length; i++) {
+ for (int i = 0; i < count; i++) {
if (string.Compare (nodes [i].Name, key, true,
CultureInfo.InvariantCulture) == 0)
return i;
}
Modified:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
2007-05-01 20:16:18 UTC (rev 76547)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
2007-05-01 20:20:25 UTC (rev 76548)
@@ -1,3 +1,8 @@
+2007-05-01 Frederik Carlier <[EMAIL PROTECTED]>
+
+ * TreeNodeCollectionTest.cs: Add Unit tests for ContainsKey and
+ IndexOfKey methods.
+
2007-04-30 Gert Driesen <[EMAIL PROTECTED]>
* DataGridViewColumnTest.cs: Added test for bug #81464, improved
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
2007-05-01 20:16:18 UTC (rev 76547)
+++
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/TreeNodeCollectionTest.cs
2007-05-01 20:20:25 UTC (rev 76548)
@@ -294,5 +294,41 @@
Assert.IsNull (ex.ParamName, "#D4");
}
}
+
+#if NET_2_0
+ [Test]
+ public void ContainsKey ()
+ {
+ TreeView tv = new TreeView ();
+
+ for (int i = 0; i < 10; i++) {
+ TreeNode node = new TreeNode ();
+ node.Name = i.ToString ();
+ tv.Nodes.Add (node);
+ }
+
+ for (int i = 0; i < 10; i++)
+ Assert.IsTrue (tv.Nodes.ContainsKey (i.ToString
()), "#CK1");
+
+ Assert.AreEqual (false, tv.Nodes.ContainsKey ("42"),
"#CK2");
+ }
+
+ [Test]
+ public void IndexOfKey ()
+ {
+ TreeView tv = new TreeView ();
+
+ for (int i = 0; i < 10; i++) {
+ TreeNode node = new TreeNode ();
+ node.Name = i.ToString ();
+ tv.Nodes.Add (node);
+ }
+
+ for (int i = 0; i < 10; i++)
+ Assert.AreEqual (tv.Nodes.IndexOfKey
(i.ToString ()), i, "#KI1");
+
+ Assert.AreEqual (-1, tv.Nodes.IndexOfKey ("42"),
"#KI2");
+ }
+#endif
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches