* Test/System.Windows.Forms/TestHelper.cs: Inconsistent eol fixes and
[mono.git] / mcs / class / Managed.Windows.Forms / Test / System.Windows.Forms / ListViewTest.cs
index 23200e58d504959970ce1f9d1bc2a19766c9dd63..53571cd0f29c9bb08909bbca3cc0f15bd5d8ea7e 100644 (file)
@@ -18,7 +18,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Windows.Forms
 {
        [TestFixture]
-       public class ListViewTest
+       public class ListViewTest : TestHelper
        {
                [Test]
                public void ListViewPropertyTest ()
@@ -77,6 +77,7 @@ namespace MonoTests.System.Windows.Forms
                        myform.Dispose ();
                }
 
+               // Hey
                [Test]
                public void BeginEndUpdateTest ()
                {
@@ -194,7 +195,8 @@ namespace MonoTests.System.Windows.Forms
                        Assert.IsNull(lv.StateImageList, "#B3");
                }
 
-               [Test]
+               // Hey
+               //[Test]
                public void EnsureVisibleTest ()
                {
                        Form myform = new Form ();
@@ -499,6 +501,41 @@ namespace MonoTests.System.Windows.Forms
                        }
                }
 
+               [Test]
+               public void FindNearestItem_Exceptions ()
+               {
+                       ListView lvw = new ListView ();
+                       lvw.Items.Add ("A");
+                       lvw.Items.Add ("B");
+
+                       lvw.View = View.Details;
+                       try {
+                               lvw.FindNearestItem (SearchDirectionHint.Down, 0, 0);
+                               Assert.Fail ("#A1");
+                       } catch (InvalidOperationException) {
+                       }
+
+                       lvw.View = View.List;
+                       try {
+                               lvw.FindNearestItem (SearchDirectionHint.Down, 0, 0);
+                               Assert.Fail ("#A2");
+                       } catch (InvalidOperationException) {
+                       }
+
+                       lvw.View = View.Tile;
+                       try {
+                               lvw.FindNearestItem (SearchDirectionHint.Down, 0, 0);
+                               Assert.Fail ("#A3");
+                       } catch (InvalidOperationException) {
+                       }
+
+                       lvw.View = View.LargeIcon;
+                       try {
+                               lvw.FindNearestItem ((SearchDirectionHint)666, 0, 0);
+                       } catch (ArgumentOutOfRangeException) {
+                       }
+               }
+
                [Test]
                public void FocusedItem ()
                {
@@ -2022,5 +2059,26 @@ namespace MonoTests.System.Windows.Forms
                                        return String.Compare (item_x.Text, item_y.Text);
                        }
                }
+
+               [Test]
+               public void MethodIsInputChar ()
+               {
+                       // Basically, show that this method always returns true
+                       InputCharControl m = new InputCharControl ();
+                       bool result = true;
+
+                       for (int i = 0; i < 256; i++)
+                               result &= m.PublicIsInputChar ((char)i);
+
+                       Assert.AreEqual (true, result, "I1");
+               }
+
+               private class InputCharControl : ListView
+               {
+                       public bool PublicIsInputChar (char charCode)
+                       {
+                               return base.IsInputChar (charCode);
+                       }
+               }
        }
 }