Merge pull request #948 from ermshiperete/bug-xamarin-2394
[mono.git] / mcs / class / Managed.Windows.Forms / Test / System.Windows.Forms / DataGridViewTest.cs
index 0bfdbf3f6b100b40d12e6c605d216fc91f9a640c..666bd7a6fecc52a679e6f7c0b43dc86512b32f24 100644 (file)
@@ -23,8 +23,6 @@
 //     Pedro Martínez Juliá <pedromj@gmail.com>
 //     Daniel Nauck    (dna(at)mono-project(dot)de)
 //     Ivan N. Zlatev  <contact@i-nz.net>
-
-
 #if NET_2_0
 
 using System;
@@ -2464,6 +2462,29 @@ namespace MonoTests.System.Windows.Forms
                        }
                }
 
+               private class MyDataGridView: DataGridView
+               {
+                       public void SetCurrentCell ()
+                       {
+                               CurrentCell = Rows [1].Cells [1];
+                       }
+               }
+
+               [Test]
+               public void TestDisposeWhenInEditMode_Xamarin19567 ()
+               {
+                       var dgv = new MyDataGridView ();
+                       dgv.EditMode = DataGridViewEditMode.EditOnEnter;
+                       dgv.Columns.Add ("TestColumn", "Test column");
+                       dgv.Columns.Add ("Column2", "Second column");
+                       dgv.Rows.Add ();
+                       dgv.Rows.Add ();
+                       dgv.SetCurrentCell ();
+
+                       // The Dispose() call will fail if #19567 is not fixed
+                       dgv.Dispose ();
+               }
+
                [Test] // Xamarin bug 3125
                public void TestRemoveBug3125 ()
                {