Author: toshok
Date: 2007-05-03 17:25:18 -0400 (Thu, 03 May 2007)
New Revision: 76650
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CurrencyManager.cs
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataBindingTests.cs
Log:
2007-05-03 Chris Toshok <[EMAIL PROTECTED]>
* CurrencyManager.cs (CurrencyManager.ListChangeHandler): in the
2.0 block, pass listposition + 1 to ChangeRecordState when a row
was added before the current listposition. Fixes the
TestInsertRowBeforeCurrent unit test.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-05-03 21:12:55 UTC (rev 76649)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-05-03 21:25:18 UTC (rev 76650)
@@ -1,3 +1,10 @@
+2007-05-03 Chris Toshok <[EMAIL PROTECTED]>
+
+ * CurrencyManager.cs (CurrencyManager.ListChangeHandler): in the
+ 2.0 block, pass listposition + 1 to ChangeRecordState when a row
+ was added before the current listposition. Fixes the
+ TestInsertRowBeforeCurrent unit test.
+
2007-05-03 Jonathan Pobst <[EMAIL PROTECTED]>
* Application.cs: Add RaiseIdle.
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CurrencyManager.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CurrencyManager.cs
2007-05-03 21:12:55 UTC (rev 76649)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/CurrencyManager.cs
2007-05-03 21:25:18 UTC (rev 76650)
@@ -329,7 +329,7 @@
if (listposition >= list.Count)
listposition = list.Count - 1;
- if (listposition != -1)
+ if (old_index != -1 && listposition != -1)
OnCurrentChanged (EventArgs.Empty);
if (firePositionChanged)
@@ -415,12 +415,16 @@
ChangeRecordState (e.NewIndex,
false, false, true,
false);
+#if ONLY_1_1
+ UpdateIsBinding ();
+#else
OnItemChanged (new ItemChangedEventArgs
(-1));
+#endif
}
else {
#if NET_2_0
if (e.NewIndex <= listposition) {
- ChangeRecordState (listposition,
+ ChangeRecordState (listposition
+ 1,
false,
false, false, false);
OnItemChanged (new
ItemChangedEventArgs (-1));
OnPositionChanged
(EventArgs.Empty);
Modified:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataBindingTests.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataBindingTests.cs
2007-05-03 21:12:55 UTC (rev 76649)
+++
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataBindingTests.cs
2007-05-03 21:25:18 UTC (rev 76650)
@@ -462,11 +462,6 @@
[Test]
public void TestInsertRowBeforeCurrent ()
{
-#if NET_2_0
- if (TestHelper.RunningOnUnix) {
- Assert.Ignore ("Fails with 2.0 profile");
- }
-#endif
Control c = new Control ();
c.CreateControl ();
Binding binding;
@@ -963,6 +958,49 @@
Assert.AreEqual (2, cm.Count, "5");
}
+ [Test]
+ public void CancelAddNew ()
+ {
+ if (TestHelper.RunningOnUnix) {
+ Assert.Ignore ("Fails at the moment");
+ }
+
+ Control c = new Control ();
+ c.CreateControl ();
+ Binding binding;
+ CurrencyManager cm;
+
+ DataSet dataSet1 = new DataSet();
+ dataSet1.Tables.Add();
+ dataSet1.Tables[0].Columns.Add();
+
+ c.BindingContext = new BindingContext ();
+ cm = (CurrencyManager) c.BindingContext[dataSet1,
dataSet1.Tables[0].TableName];
+ binding = c.DataBindings.Add ("Text",
dataSet1.Tables[0], dataSet1.Tables[0].Columns[0].ColumnName);
+
+ HookupCurrencyManager (cm);
+#if WITH_BINDINGS
+ HookupBinding (binding);
+#endif
+ event_log = "";
+ event_num = 0;
+
+ cm.AddNew ();
+
+ cm.CancelCurrentEdit ();
+
+ Console.WriteLine (event_log);
+
+ Assert.AreEqual (
+#if NET_2_0
+ "0: PositionChanged (to 0)\n1:
CurrentChanged\n2: CurrentItemChanged\n3: ItemChanged (index = -1)\n4:
ItemChanged (index = -1)\n5: PositionChanged (to -1)\n6: ItemChanged (index =
-1)\n7: PositionChanged (to -1)\n8: CurrentChanged\n9: CurrentItemChanged\n10:
ItemChanged (index = -1)\n11: ItemChanged (index = -1)\n",
+#else
+ "0: PositionChanged (to 0)\n1:
CurrentChanged\n2: ItemChanged (index = -1)\n3: ItemChanged (index = -1)\n4:
CurrentChanged\n5: PositionChanged (to -1)\n6: ItemChanged (index = -1)\n7:
ItemChanged (index = -1)\n8: ItemChanged (index = -1)\n",
+#endif
+ event_log, "1");
+
+ }
+
}
[TestFixture]
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches