namespace MonoTests.System.Windows.Forms
{
[TestFixture]
- public class ComboBoxTest
+ public class ComboBoxTest : TestHelper
{
private CultureInfo _originalCulture;
[SetUp]
- public void SetUp ()
+ protected override void SetUp ()
{
_originalCulture = Thread.CurrentThread.CurrentCulture;
+ base.SetUp ();
}
[TearDown]
- public void TearDown ()
+ protected override void TearDown ()
{
Thread.CurrentThread.CurrentCulture = _originalCulture;
+ base.TearDown ();
}
[Test] // bug #331144
try {
cmbbox.DropDownWidth = 0;
Assert.Fail ("#B1");
+ }
#if NET_2_0
- } catch (ArgumentOutOfRangeException ex) {
+ catch (ArgumentOutOfRangeException ex) {
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#B2");
Assert.IsNotNull (ex.Message, "#B3");
Assert.IsNotNull (ex.ParamName, "#B4");
Assert.IsNull (ex.InnerException, "#B6");
}
#else
- } catch (ArgumentException ex) {
+ catch (ArgumentException ex) {
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
Assert.IsNotNull (ex.Message, "#B3");
Assert.IsNull (ex.ParamName, "#B4");
try {
cmbbox.ItemHeight = 0;
Assert.Fail ("#B1");
+ }
#if NET_2_0
- } catch (ArgumentOutOfRangeException ex) {
+ catch (ArgumentOutOfRangeException ex) {
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#B2");
Assert.IsNotNull (ex.Message, "#B3");
Assert.IsNotNull (ex.ParamName, "#B4");
Assert.IsNull (ex.InnerException, "#B6");
}
#else
- } catch (ArgumentException ex) {
+ catch (ArgumentException ex) {
Assert.AreEqual (typeof (ArgumentException), ex.GetType (), "#B2");
Assert.IsNotNull (ex.Message, "#B3");
Assert.IsNull (ex.ParamName, "#B4");
}
}
#endif
+
+ private struct ComboVal
+ {
+ public string text;
+
+ public ComboVal (string t)
+ {
+ text = t;
+ }
+
+ public override string ToString ()
+ {
+ return text;
+ }
+ }
+
+ [Test]
+ public void SortTest ()
+ {
+ // Test sorting of objects with no IComparer
+ // should not crash
+
+ ComboBox cmb = new ComboBox ();
+ cmb.Items.Add (new ComboVal ("B"));
+ cmb.Items.Add (new ComboVal ("A"));
+ cmb.Sorted = true;
+ }
}
[TestFixture]
- public class ComboBoxObjectCollectionTest
+ public class ComboBoxObjectCollectionTest : TestHelper
{
[Test]
public void ComboBoxObjectCollectionPropertyTest ()
}
}
[TestFixture]
- public class ComboBoxTests
+ public class ComboBoxTests : TestHelper
{
ComboBox comboBox;
bool textChanged, layoutUpdated;
[SetUp]
- public void SetUp ()
- {
+ protected override void SetUp () {
comboBox = new ComboBox ();
textChanged = false;
layoutUpdated = false;
comboBox.TextChanged += new EventHandler (textChangedEventHandler);
comboBox.Layout += new LayoutEventHandler (layoutEventHandler);
+ base.SetUp ();
}
private void textChangedEventHandler (object sender, EventArgs e)
}
}
}
-}
+}
\ No newline at end of file