Unit test for bug #821.
[mono.git] / mcs / class / Managed.Windows.Forms / Test / System.Windows.Forms / StatusBarPanelTest.cs
index 85e154c0d6fd2dff90ef8a73f572ed38271b46de..6dc94fe37ad3ca40eee12efe996e27b966b2915b 100644 (file)
@@ -13,7 +13,7 @@ using System.Runtime.Remoting;
 namespace MonoTests.System.Windows.Forms
 {
        [TestFixture]
-       public class StatusBarPanelTest 
+       public class StatusBarPanelTest : TestHelper 
        {
                [Test]
                public void MinimumWidth1 ()
@@ -56,7 +56,11 @@ namespace MonoTests.System.Windows.Forms
                }
                
                [Test]
+#if NET_2_0
+               [ExpectedException (typeof (ArgumentOutOfRangeException))]
+#else
                [ExpectedException(typeof(ArgumentException))]
+#endif
                public void MinimumWidth4 ()
                {
                        StatusBarPanel p = new StatusBarPanel ();
@@ -99,5 +103,53 @@ namespace MonoTests.System.Windows.Forms
                        
                }
                
+               [Test] // bug 82487
+               public void IconWidth ()
+               {
+                       using (Form f = new Form ()) {
+                               StatusBar _statusBar;
+                               StatusBarPanel _myComputerPanel;
+                               
+                               _statusBar = new StatusBar ();
+                               _statusBar.ShowPanels = true;
+                               //Controls.Add (_statusBar);
+                               
+                               _myComputerPanel = new StatusBarPanel ();
+                               _myComputerPanel.AutoSize = StatusBarPanelAutoSize.Contents;
+                               _myComputerPanel.Text = "My Computer";
+                               _statusBar.Panels.Add (_myComputerPanel);
+
+                               int width = _myComputerPanel.Width;
+                               
+                               _myComputerPanel.Icon = f.Icon;
+                               
+                               Assert.AreEqual (width + 21, _myComputerPanel.Width, "#01");
+                       }
+               }
+#if NET_2_0
+               [Test]
+               public void TagTest ()
+               {
+                       StatusBarPanel p = new StatusBarPanel ();
+                       
+                       Assert.AreEqual (null, p.Tag, "#1");
+                       p.Tag = "a";
+                       Assert.AreEqual ("a", p.Tag, "#2");
+                       p.Tag = null;
+                       Assert.AreEqual (null, p.Tag, "#3");
+               }
+               
+               [Test]
+               public void NameTest ()
+               {
+                       StatusBarPanel p = new StatusBarPanel ();
+                       Assert.AreEqual ("", p.Name, "#1");
+                       p.Name = "a";
+                       Assert.AreEqual ("a", p.Name, "#2");
+                       p.Name = null;
+                       Assert.AreEqual ("", p.Name, "#3");
+               }
+#endif 
+               
        }
 }