Author: calberto
Date: 2008-01-26 03:11:42 -0500 (Sat, 26 Jan 2008)
New Revision: 93979

Modified:
   trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListControlTest.cs
Log:
2008-01-26  Carlos Alberto Cortez <[EMAIL PROTECTED]>

        * ListControlTest.cs: Add SelectedValue2 test - for #324286.



Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2008-01-26 08:08:56 UTC (rev 93978)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2008-01-26 08:11:42 UTC (rev 93979)
@@ -1,3 +1,7 @@
+2008-01-26  Carlos Alberto Cortez <[EMAIL PROTECTED]>
+
+       * ListControlTest.cs: Add SelectedValue2 test - for #324286.
+
 2008-01-24  Jonathan Pobst  <[EMAIL PROTECTED]>
 
        * TableLayoutTest.cs: Add tests for bug #354672.

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListControlTest.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListControlTest.cs
  2008-01-26 08:08:56 UTC (rev 93978)
+++ 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ListControlTest.cs
  2008-01-26 08:11:42 UTC (rev 93979)
@@ -290,6 +290,39 @@
                        f.Dispose ();
                }
 
+               [Test]
+               public void SelectedValue2 ()
+               {
+                       Form f = new Form ();
+                       f.ShowInTaskbar = false;
+                       ListControlChild child = new ListControlChild ();
+
+                       ArrayList list = new ArrayList ();
+                       list.Add (new MockItem ("A", 0));
+                       list.Add (new MockItem ("B", 1));
+                       list.Add (new MockItem ("C", 2));
+                       child.DataSource = list;
+                       child.ValueMember = "Text";
+
+                       MockItem item = new MockItem (String.Empty, 0);
+                       child.DataBindings.Add ("SelectedValue", item, "Text");
+
+                       Assert.AreEqual (-1, child.SelectedIndex, "#A1");
+
+                       f.Controls.Add (child);
+                       Assert.AreEqual (-1, child.SelectedIndex, "#B1");
+
+                       // When the form is shown, normally the SelectedIndex 
is the
+                       // CurrencyManager.Position (0 in this case), but it 
should remain as -1
+                       // since SelectedValue is bound to a String.Empty 
value. See #324286
+                       f.Show ();
+                       CurrencyManager manager = 
(CurrencyManager)f.BindingContext [list];
+                       Assert.AreEqual (-1, child.SelectedIndex, "#C1");
+                       Assert.AreEqual (0, manager.Position, "#C2");
+
+                       f.Dispose ();
+               }
+
 #if NET_2_0
                [Test] // bug #81771
                public void DataSource_BindingList1 ()

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

Reply via email to