Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Wilkens <robwilkens@robwilkens-HP-Pavilion-g6-Notebook-PC.(none)>2012-05-29 06:22:40 +0400
committerRobert Wilkens <robwilkens@robwilkens-HP-Pavilion-g6-Notebook-PC.(none)>2012-05-29 06:22:40 +0400
commit30885fd4d7dc943a9392783b8a771c5dfa46bffb (patch)
tree80477a19e2a9ebe8ee1bb4ee1d52a9bdf36f80be /mcs/class/Managed.Windows.Forms/Test
parent410fbd4e879073bac22520616c44969c105d71d9 (diff)
This addresses bug 2234 - important please verify
https://bugzilla.xamarin.com/show_bug.cgi?id=2234 It includes unit tests. The point of this is essentially to replicate a behavior of the Microsoft .NET Platform where exceptions are eaten in the ComboBox under certain conditions (In the SelectedIndexChanged handler).
Diffstat (limited to 'mcs/class/Managed.Windows.Forms/Test')
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ComboBoxTest.cs49
1 files changed, 49 insertions, 0 deletions
diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ComboBoxTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ComboBoxTest.cs
index 8b0389c1563..63c2b410d8f 100644
--- a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ComboBoxTest.cs
+++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ComboBoxTest.cs
@@ -847,6 +847,48 @@ namespace MonoTests.System.Windows.Forms
ComboBox cmbbox = new ComboBox ();
cmbbox.SelectedIndex = -2;
}
+
+ //Bug 2234 (Xamarin) : Test 1
+ [Test]
+ public void VerifyNoExceptions2234()
+ {
+ Form form = new Form ();
+ ComboBox cmb = new ComboBox();
+ form.Controls.Add (cmb);
+ form.Show ();
+ eventFired=false; //for sanity
+
+ //Primary failure: if exception is raised when
+ // DataSource changes. We should "eat" the exception
+ // under this circumstance before it gets here.
+ cmb.SelectedIndexChanged += new EventHandler(GenericHandlerWithException);
+ cmb.DataSource=new string[]{"One","Two","Three"};
+ if (!eventFired){
+ //secondary failure: The event was never fired
+ throw new Exception("Secondary Test Failure (2234:1)");
+ }
+ form.Dispose();
+ }
+
+ //Bug 2234 (Xamarin) : Test 2
+ [Test]
+ [ExpectedException (typeof (Exception))]
+ public void VerifyException2234()
+ {
+ Form form = new Form ();
+ ComboBox cmb = new ComboBox();
+ form.Controls.Add (cmb);
+ form.Show ();
+ eventFired=false; //for sanity
+ cmb.SelectedIndexChanged += new EventHandler(GenericHandlerWithException);
+ cmb.DataSource=new string[]{"One","Two","Three"};
+
+ //Here's where Exception Should raise, see Expected
+ cmb.SelectedIndex=2;
+
+ form.Dispose();
+ }
+
//
// Events
@@ -864,6 +906,13 @@ namespace MonoTests.System.Windows.Forms
eventFired = true;
}
+ private void GenericHandlerWithException (object sender, EventArgs e)
+ {
+ eventFired = true;
+ throw new Exception("Crash!");
+ }
+
+
[Ignore ("Bugs in X11 prevent this test to run properly")]
public void DrawItemEventTest ()
{