Prechádzať zdrojové kódy

2007-03-28 Jonathan Pobst <[email protected]>

	* StatusStripTest.cs: Added.
	* ToolStripContainerTest.cs: Added.
	* ToolStripContentPanelTest.cs: Added.
	* ToolStripDropDownTest.cs: Added.
	* ToolStripManagerTest.cs: Added.
	* ToolStripOverflowButtonTest.cs: Added.
	* ToolStripOverflowTest.cs: Added.
	* ToolStripPanelTest.cs: Added.
	* ToolStripProgressBarTest.cs: Enable tests about MarqueeAnimationSpeed.
	* ToolStripStatusLabelTest.cs: Added.

2007-03-28  Jonathan Pobst  <[email protected]>

	* System.Windows.Forms_test.dll.sources: Add StatusStripTest.cs,
	ToolStripContainerTest.cs, ToolStripContentPanelTest.cs,
	ToolStripDropDownTest.cs, ToolStripManagerTest.cs, 
	ToolStripOverflowButtonTest.cs, ToolStripOverflowTest.cs
	ToolStripPanelTest.cs, ToolStripStatusLabelTest.cs.

svn path=/trunk/mcs/; revision=75090
Jonathan Pobst 19 rokov pred
rodič
commit
bf04fa3ec4

+ 8 - 0
mcs/class/Managed.Windows.Forms/ChangeLog

@@ -1,3 +1,11 @@
+2007-03-28  Jonathan Pobst  <[email protected]>
+
+	* System.Windows.Forms_test.dll.sources: Add StatusStripTest.cs,
+	ToolStripContainerTest.cs, ToolStripContentPanelTest.cs,
+	ToolStripDropDownTest.cs, ToolStripManagerTest.cs, 
+	ToolStripOverflowButtonTest.cs, ToolStripOverflowTest.cs
+	ToolStripPanelTest.cs, ToolStripStatusLabelTest.cs.
+
 2007-03-13  Gert Driesen  <[email protected]>
 
 	* System.Windows.Forms_test.dll.sources: Added ErrorProviderTest.cs.

+ 9 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms_test.dll.sources

@@ -96,6 +96,7 @@ System.Windows.Forms/SplitterTest.cs
 System.Windows.Forms/SplitContainerTests.cs
 System.Windows.Forms/StatusBarPanelTest.cs
 System.Windows.Forms/StatusBarTest.cs
+System.Windows.Forms/StatusStripTest.cs
 System.Windows.Forms/SystemInformationTest.cs
 System.Windows.Forms/TabControlTest.cs
 System.Windows.Forms/TestHelper.cs
@@ -106,12 +107,20 @@ System.Windows.Forms/ToolBarTest.cs
 System.Windows.Forms/ToolBarButtonTest.cs
 System.Windows.Forms/ToolStripButtonTest.cs
 System.Windows.Forms/ToolStripComboBoxTest.cs
+System.Windows.Forms/ToolStripContainerTest.cs
+System.Windows.Forms/ToolStripContentPanelTest.cs
 System.Windows.Forms/ToolStripControlHostTest.cs
+System.Windows.Forms/ToolStripDropDownTest.cs
 System.Windows.Forms/ToolStripItemTest.cs
 System.Windows.Forms/ToolStripLabelTest.cs
+System.Windows.Forms/ToolStripManagerTest.cs
 System.Windows.Forms/ToolStripMenuItemTest.cs
+System.Windows.Forms/ToolStripOverflowButtonTest.cs
+System.Windows.Forms/ToolStripOverflowTest.cs
+System.Windows.Forms/ToolStripPanelTest.cs
 System.Windows.Forms/ToolStripProgressBarTest.cs
 System.Windows.Forms/ToolStripSeparatorTest.cs
+System.Windows.Forms/ToolStripStatusLabelTest.cs
 System.Windows.Forms/ToolStripTest.cs
 System.Windows.Forms/ToolStripTextBoxTest.cs
 System.Windows.Forms/ToolTipTest.cs

+ 13 - 0
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog

@@ -1,3 +1,16 @@
+2007-03-28  Jonathan Pobst  <[email protected]>
+
+	* StatusStripTest.cs: Added.
+	* ToolStripContainerTest.cs: Added.
+	* ToolStripContentPanelTest.cs: Added.
+	* ToolStripDropDownTest.cs: Added.
+	* ToolStripManagerTest.cs: Added.
+	* ToolStripOverflowButtonTest.cs: Added.
+	* ToolStripOverflowTest.cs: Added.
+	* ToolStripPanelTest.cs: Added.
+	* ToolStripProgressBarTest.cs: Enable tests about MarqueeAnimationSpeed.
+	* ToolStripStatusLabelTest.cs: Added.
+
 2007-03-26  Carlos Alberto Cortez <[email protected]>
 
 	* ListViewItemTest.cs: Add tests for constructors taking

+ 206 - 0
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/StatusStripTest.cs

@@ -0,0 +1,206 @@
+//
+// StatusStripTests.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Novell, Inc.
+//
+// Authors:
+//	Jonathan Pobst ([email protected])
+//
+#if NET_2_0
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using System.Drawing;
+using System.Windows.Forms;
+using System.ComponentModel;
+
+namespace MonoTests.System.Windows.Forms
+{
+	[TestFixture]
+	public class StatusStripTests
+	{
+		[Test]
+		public void Constructor ()
+		{
+			StatusStrip ts = new StatusStrip ();
+
+			Assert.AreEqual (false, ts.CanOverflow, "A1");
+			Assert.AreEqual (new Rectangle (1, 0, 185, 22), ts.DisplayRectangle, "A2");
+			Assert.AreEqual (DockStyle.Bottom, ts.Dock, "A3");
+			Assert.AreEqual (ToolStripGripStyle.Hidden, ts.GripStyle, "A4");
+			Assert.AreEqual (ToolStripLayoutStyle.Table, ts.LayoutStyle, "A5");
+			Assert.AreEqual (new Padding (1, 0, 14, 0), ts.Padding, "A6");
+			Assert.AreEqual (false, ts.ShowItemToolTips, "A7");
+			Assert.AreEqual (new Rectangle (188, 0, 12, 22), ts.SizeGripBounds, "A8");
+			Assert.AreEqual (true, ts.SizingGrip, "A9");
+			Assert.AreEqual (true, ts.Stretch, "A10");
+		}
+
+		[Test]
+		public void ControlStyle ()
+		{
+			ExposeProtectedProperties epp = new ExposeProtectedProperties ();
+		
+			ControlStyles cs = ControlStyles.ContainerControl;
+			cs |= ControlStyles.UserPaint;
+			cs |= ControlStyles.ResizeRedraw;
+			cs |= ControlStyles.StandardClick;
+			cs |= ControlStyles.SupportsTransparentBackColor;
+			cs |= ControlStyles.StandardDoubleClick;
+			cs |= ControlStyles.AllPaintingInWmPaint;
+			cs |= ControlStyles.OptimizedDoubleBuffer;
+			cs |= ControlStyles.UseTextForAccessibility;
+
+			Assert.AreEqual (cs, epp.GetControlStyles (), "Styles");		
+		}
+
+		[Test]
+		public void ProtectedProperties ()
+		{
+			ExposeProtectedProperties epp = new ExposeProtectedProperties ();
+
+			Assert.AreEqual (DockStyle.Bottom, epp.DefaultDock, "C1");
+			Assert.AreEqual (new Padding (1, 0, 14, 0), epp.DefaultPadding, "C2");
+			Assert.AreEqual (false, epp.DefaultShowItemToolTips, "C3");
+			Assert.AreEqual (new Size (200, 22), epp.DefaultSize, "C4");
+		}
+
+		[Test]
+		public void PropertyCanOverflow ()
+		{
+			StatusStrip ts = new StatusStrip ();
+
+			ts.CanOverflow = true;
+			Assert.AreEqual (true, ts.CanOverflow, "B1");
+		}
+
+		[Test]
+		public void PropertyDock ()
+		{
+			StatusStrip ts = new StatusStrip ();
+			
+			ts.Dock = DockStyle.Top;
+			Assert.AreEqual (DockStyle.Top, ts.Dock, "B1");
+		}
+
+		[Test]
+		[ExpectedException (typeof (InvalidEnumArgumentException))]
+		public void PropertyDockIEAE ()
+		{
+			StatusStrip ts = new StatusStrip ();
+			ts.Dock = (DockStyle)42;
+		}
+
+		[Test]
+		public void PropertyGripStyle ()
+		{
+			StatusStrip ts = new StatusStrip ();
+
+			ts.GripStyle = ToolStripGripStyle.Visible;
+			Assert.AreEqual (ToolStripGripStyle.Visible, ts.GripStyle, "B1");
+		}
+
+		[Test]
+		[ExpectedException (typeof (InvalidEnumArgumentException))]
+		public void PropertyGripStyleIEAE ()
+		{
+			StatusStrip ts = new StatusStrip ();
+
+			ts.GripStyle = (ToolStripGripStyle) 42;
+		}
+
+		[Test]
+		public void PropertyLayoutStyle ()
+		{
+			StatusStrip ts = new StatusStrip ();
+
+			ts.LayoutStyle = ToolStripLayoutStyle.VerticalStackWithOverflow;
+			Assert.AreEqual (ToolStripLayoutStyle.VerticalStackWithOverflow, ts.LayoutStyle, "B1");
+		}
+
+		[Test]
+		[ExpectedException (typeof (InvalidEnumArgumentException))]
+		public void PropertyLayoutStyleIEAE ()
+		{
+			StatusStrip ts = new StatusStrip ();
+
+			ts.LayoutStyle = (ToolStripLayoutStyle) 42;
+		}
+
+		[Test]
+		public void PropertyPadding ()
+		{
+			StatusStrip ts = new StatusStrip ();
+
+			ts.Padding = new Padding (7);
+			Assert.AreEqual (new Padding (7), ts.Padding, "B1");
+		}
+
+		[Test]
+		public void PropertyShowItemToolTips ()
+		{
+			StatusStrip ts = new StatusStrip ();
+
+			ts.ShowItemToolTips = true;
+			Assert.AreEqual (true, ts.ShowItemToolTips, "B1");
+		}
+
+		[Test]
+		public void PropertySizingGrip ()
+		{
+			StatusStrip ts = new StatusStrip ();
+
+			ts.SizingGrip = false;
+			Assert.AreEqual (false, ts.SizingGrip, "B1");
+		}
+
+		[Test]
+		public void PropertyStretch ()
+		{
+			StatusStrip ts = new StatusStrip ();
+
+			ts.Stretch = false;
+			Assert.AreEqual (false, ts.Stretch, "B1");
+		}
+		
+		private class ExposeProtectedProperties : StatusStrip
+		{
+			public new DockStyle DefaultDock { get { return base.DefaultDock; } }
+			public new Padding DefaultPadding { get { return base.DefaultPadding; } }
+			public new bool DefaultShowItemToolTips { get { return base.DefaultShowItemToolTips; } }
+			public new Size DefaultSize { get { return base.DefaultSize; } }
+			
+			public ControlStyles GetControlStyles ()
+			{
+				ControlStyles retval = (ControlStyles) 0;
+				
+				foreach (ControlStyles cs in Enum.GetValues (typeof (ControlStyles)))
+					if (this.GetStyle (cs) == true)
+						retval |= cs;
+						
+				return retval;
+			}
+		}
+	}
+}
+#endif

+ 116 - 0
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripContainerTest.cs

@@ -0,0 +1,116 @@
+//
+// ToolStripContainerTests.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2007 Jonathan Pobst
+//
+// Authors:
+//	Jonathan Pobst ([email protected])
+//
+#if NET_2_0
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace MonoTests.System.Windows.Forms
+{
+	[TestFixture]
+	public class ToolStripContainerTests
+	{
+		[Test]
+		public void Constructor ()
+		{
+			ToolStripContainer tsc = new ToolStripContainer ();
+
+			Assert.AreEqual ("System.Windows.Forms.ToolStripPanel", tsc.BottomToolStripPanel.ToString (), "A1");
+			Assert.AreEqual (true, tsc.BottomToolStripPanelVisible, "A2");
+			Assert.AreEqual ("System.Windows.Forms.ToolStripContentPanel", tsc.ContentPanel.GetType ().ToString (), "A3");
+			Assert.AreEqual ("System.Windows.Forms.ToolStripPanel", tsc.LeftToolStripPanel.ToString (), "A4");
+			Assert.AreEqual (true, tsc.LeftToolStripPanelVisible, "A5");
+			Assert.AreEqual ("System.Windows.Forms.ToolStripPanel", tsc.RightToolStripPanel.ToString (), "A6");
+			Assert.AreEqual (true, tsc.RightToolStripPanelVisible, "A7");
+			Assert.AreEqual ("System.Windows.Forms.ToolStripPanel", tsc.TopToolStripPanel.ToString (), "A8");
+			Assert.AreEqual (true, tsc.TopToolStripPanelVisible, "A9");
+		}
+
+		[Test]
+		public void ProtectedProperties ()
+		{
+			ExposeProtectedProperties epp = new ExposeProtectedProperties ();
+
+			Assert.AreEqual (new Size (150, 175), epp.DefaultSize, "C1");
+		}
+
+		[Test]
+		public void PropertyBottomToolStripPanelVisible ()
+		{
+			ToolStripContainer tsc = new ToolStripContainer ();
+
+			tsc.BottomToolStripPanelVisible = false; ;
+			Assert.AreEqual (false, tsc.BottomToolStripPanelVisible, "B1");
+		}
+
+		[Test]
+		public void PropertyLeftToolStripPanelVisible ()
+		{
+			ToolStripContainer tsc = new ToolStripContainer ();
+
+			tsc.LeftToolStripPanelVisible = false; ;
+			Assert.AreEqual (false, tsc.LeftToolStripPanelVisible, "B1");
+		}
+
+		[Test]
+		public void PropertyRightToolStripPanelVisible ()
+		{
+			ToolStripContainer tsc = new ToolStripContainer ();
+
+			tsc.RightToolStripPanelVisible = false; ;
+			Assert.AreEqual (false, tsc.RightToolStripPanelVisible, "B1");
+		}
+
+		[Test]
+		public void PropertyTopToolStripPanelVisible ()
+		{
+			ToolStripContainer tsc = new ToolStripContainer ();
+
+			tsc.TopToolStripPanelVisible = false; ;
+			Assert.AreEqual (false, tsc.TopToolStripPanelVisible, "B1");
+		}
+
+		[Test]
+		public void MethodCreateControlsInstance ()
+		{
+			ExposeProtectedProperties epp = new ExposeProtectedProperties ();
+
+			Assert.AreEqual ("System.Windows.Forms.ToolStripContainer+ToolStripContainerTypedControlCollection", epp.CreateControlsInstance (). GetType ().ToString (), "B1");
+		}
+		
+		private class ExposeProtectedProperties : ToolStripContainer
+		{
+			public new Size DefaultSize { get { return base.DefaultSize; } }
+			public new ControlCollection CreateControlsInstance () { return base.CreateControlsInstance (); }
+		}
+	}
+}
+#endif

+ 123 - 0
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripContentPanelTest.cs

@@ -0,0 +1,123 @@
+//
+// ToolStripContentPanelTests.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2007 Jonathan Pobst
+//
+// Authors:
+//	Jonathan Pobst ([email protected])
+//
+#if NET_2_0
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace MonoTests.System.Windows.Forms
+{
+	[TestFixture]
+	public class ToolStripContentPanelTests
+	{
+		[Test]
+		public void Constructor ()
+		{
+			ToolStripContentPanel tsp = new ToolStripContentPanel ();
+
+			Assert.AreEqual (SystemColors.Control, tsp.BackColor, "A1");
+			//Assert.AreEqual ("System.Windows.Forms.ToolStripSystemRenderer", tsp.Renderer.ToString (), "A2");
+			//Assert.AreEqual (ToolStripRenderMode.System, tsp.RenderMode, "A3");
+		}
+
+		[Test]
+		public void PropertyBackColor ()
+		{
+			ToolStripContentPanel tsp = new ToolStripContentPanel ();
+			EventWatcher ew = new EventWatcher (tsp);
+
+			tsp.BackColor = Color.Green;
+			Assert.AreEqual (Color.Green, tsp.BackColor, "B1");
+			Assert.AreEqual (string.Empty, ew.ToString (), "B2");
+
+			ew.Clear ();
+			tsp.BackColor = Color.Green;
+			Assert.AreEqual (string.Empty, ew.ToString (), "B3");
+		}
+
+		[Test]
+		public void PropertyRenderer ()
+		{
+			ToolStripContentPanel tsp = new ToolStripContentPanel ();
+			EventWatcher ew = new EventWatcher (tsp);
+
+			ToolStripProfessionalRenderer pr = new ToolStripProfessionalRenderer ();
+
+			tsp.Renderer = pr;
+			Assert.AreSame (pr, tsp.Renderer, "B1");
+			Assert.AreEqual (ToolStripRenderMode.Custom, tsp.RenderMode, "B1-2");
+			// I refuse to call the event twice like .Net does.
+			//Assert.AreEqual ("RendererChanged;RendererChanged", ew.ToString (), "B2");
+
+			ew.Clear ();
+			tsp.Renderer = pr;
+			//Assert.AreEqual (string.Empty, ew.ToString (), "B3");
+		}
+
+		[Test]
+		public void PropertyRenderMode ()
+		{
+			ToolStripContentPanel tsp = new ToolStripContentPanel ();
+			EventWatcher ew = new EventWatcher (tsp);
+
+			tsp.RenderMode = ToolStripRenderMode.ManagerRenderMode;
+			Assert.AreEqual (ToolStripRenderMode.ManagerRenderMode, tsp.RenderMode, "B1");
+			// I refuse to call the event twice like .Net does.
+			//Assert.AreEqual ("RendererChanged;RendererChanged", ew.ToString (), "B2");
+
+			ew.Clear ();
+			tsp.RenderMode = ToolStripRenderMode.ManagerRenderMode;
+			Assert.AreEqual (string.Empty, ew.ToString (), "B3");
+		}
+
+		private class EventWatcher
+		{
+			private string events = string.Empty;
+
+			public EventWatcher (ToolStripContentPanel tsp)
+			{
+				tsp.Load += new EventHandler (delegate (Object obj, EventArgs e) { events += ("Load;"); });
+				tsp.RendererChanged += new EventHandler (delegate (Object obj, EventArgs e) { events += ("RendererChanged;"); });
+			}
+
+			public override string ToString ()
+			{
+				return events.TrimEnd (';');
+			}
+
+			public void Clear ()
+			{
+				events = string.Empty;
+			}
+		}
+	}
+}
+#endif

+ 144 - 0
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripDropDownTest.cs

@@ -0,0 +1,144 @@
+//
+// ToolStripDropDownTests.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2007 Jonathan Pobst
+//
+// Authors:
+//	Jonathan Pobst ([email protected])
+//
+#if NET_2_0
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace MonoTests.System.Windows.Forms
+{
+	[TestFixture]
+	public class ToolStripDropDownTests
+	{
+		[Test]
+		public void Constructor ()
+		{
+			ToolStripDropDown tsdd = new ToolStripDropDown ();
+
+			Assert.AreEqual (false, tsdd.AllowTransparency, "A1");
+			Assert.AreEqual (true, tsdd.AutoClose, "A2");
+			Assert.AreEqual (false, tsdd.CanOverflow, "A3");
+			Assert.AreEqual (ToolStripDropDownDirection.Right, tsdd.DefaultDropDownDirection, "A4");
+			Assert.AreEqual (true, tsdd.DropShadowEnabled, "A5");
+			Assert.AreEqual (false, tsdd.IsAutoGenerated, "A6");
+			Assert.AreEqual (1, tsdd.Opacity, "A7");
+			Assert.AreEqual (null, tsdd.OwnerItem, "A8");
+			Assert.AreEqual (null, tsdd.Region, "A9");
+			Assert.AreEqual (RightToLeft.No, tsdd.RightToLeft, "A10");
+			//Assert.AreEqual (ToolStripTextDirection.Horizontal, tsdd.TextDirection, "A11");
+			Assert.AreEqual (true, tsdd.TopLevel, "A12");
+			Assert.AreEqual (false, tsdd.Visible, "A13");
+		}
+
+		[Test]
+		public void ProtectedProperties ()
+		{
+			ExposeProtectedProperties epp = new ExposeProtectedProperties ();
+
+			Assert.AreEqual (WindowStyles.WS_TILED | WindowStyles.WS_CLIPCHILDREN | WindowStyles.WS_POPUP, (WindowStyles)epp.CreateParams.Style, "C1");
+			// This makes no sense
+			// Assert.AreEqual (WindowExStyles.WS_EX_CONTROLPARENT, (WindowExStyles)epp.CreateParams.ExStyle, "C2");
+			Assert.AreEqual (DockStyle.None, epp.DefaultDock, "C3");
+			Assert.AreEqual (new Padding (1, 2, 1, 2), epp.DefaultPadding, "C4");
+			Assert.AreEqual (true, epp.DefaultShowItemToolTips, "C5");
+			// Dependent on monitor resolution
+			// Assert.AreEqual (new Size (1678, 1016), epp.MaxItemSize, "C6");
+			Assert.AreEqual (true, epp.TopMost, "C7");
+		}
+
+		[Test]
+		public void MethodCreateLayoutSettings ()
+		{
+			ExposeProtectedProperties ts = new ExposeProtectedProperties ();
+
+			Assert.AreEqual ("System.Windows.Forms.FlowLayoutSettings", ts.PublicCreateLayoutSettings (ToolStripLayoutStyle.Flow).ToString (), "A1");
+			Assert.AreEqual (null, ts.PublicCreateLayoutSettings (ToolStripLayoutStyle.HorizontalStackWithOverflow), "A2");
+			Assert.AreEqual (null, ts.PublicCreateLayoutSettings (ToolStripLayoutStyle.StackWithOverflow), "A3");
+			//Assert.AreEqual ("System.Windows.Forms.TableLayoutSettings", ts.PublicCreateLayoutSettings (ToolStripLayoutStyle.Table).ToString (), "A4");
+			Assert.AreEqual (null, ts.PublicCreateLayoutSettings (ToolStripLayoutStyle.VerticalStackWithOverflow), "A5");
+		}
+
+		//[Test]
+		//public void Accessibility ()
+		//{
+		//        ToolStripSeparator tsi = new ToolStripSeparator ();
+		//        AccessibleObject ao = tsi.AccessibilityObject;
+
+		//        Assert.AreEqual ("ToolStripItemAccessibleObject: Owner = " + tsi.ToString (), ao.ToString (), "L");
+		//        Assert.AreEqual (Rectangle.Empty, ao.Bounds, "L1");
+		//        Assert.AreEqual ("Press", ao.DefaultAction, "L2");
+		//        Assert.AreEqual (null, ao.Description, "L3");
+		//        Assert.AreEqual (null, ao.Help, "L4");
+		//        Assert.AreEqual (string.Empty, ao.KeyboardShortcut, "L5");
+		//        Assert.AreEqual (string.Empty, ao.Name, "L6");
+		//        Assert.AreEqual (null, ao.Parent, "L7");
+		//        Assert.AreEqual (AccessibleRole.Separator, ao.Role, "L8");
+		//        Assert.AreEqual (AccessibleStates.None, ao.State, "L9");
+		//        Assert.AreEqual (string.Empty, ao.Value, "L10");
+
+		//        tsi.Name = "Label1";
+		//        tsi.Text = "Test Label";
+		//        tsi.AccessibleDescription = "Label Desc";
+
+		//        Assert.AreEqual (Rectangle.Empty, ao.Bounds, "L11");
+		//        Assert.AreEqual ("Press", ao.DefaultAction, "L12");
+		//        Assert.AreEqual ("Label Desc", ao.Description, "L13");
+		//        Assert.AreEqual (null, ao.Help, "L14");
+		//        Assert.AreEqual (string.Empty, ao.KeyboardShortcut, "L15");
+		//        Assert.AreEqual ("Test Label", ao.Name, "L16");
+		//        Assert.AreEqual (null, ao.Parent, "L17");
+		//        Assert.AreEqual (AccessibleRole.Separator, ao.Role, "L18");
+		//        Assert.AreEqual (AccessibleStates.None, ao.State, "L19");
+		//        Assert.AreEqual (string.Empty, ao.Value, "L20");
+
+		//        tsi.AccessibleName = "Access Label";
+		//        Assert.AreEqual ("Access Label", ao.Name, "L21");
+
+		//        tsi.Text = "Test Label";
+		//        Assert.AreEqual ("Access Label", ao.Name, "L22");
+
+		//        tsi.AccessibleDefaultActionDescription = "AAA";
+		//        Assert.AreEqual ("AAA", tsi.AccessibleDefaultActionDescription, "L23");
+		//}
+
+		private class ExposeProtectedProperties : ToolStripDropDown
+		{
+			public new CreateParams CreateParams { get { return base.CreateParams; } }
+			public new DockStyle DefaultDock { get { return base.DefaultDock; } }
+			public new Padding DefaultPadding { get { return base.DefaultPadding; } }
+			public new bool DefaultShowItemToolTips { get { return base.DefaultShowItemToolTips; } }
+			//public new Size MaxItemSize { get { return base.MaxItemSize; } }
+			public new bool TopMost { get { return base.TopMost; } }
+			public LayoutSettings PublicCreateLayoutSettings (ToolStripLayoutStyle style) { return base.CreateLayoutSettings (style); }
+		}
+	}
+}
+#endif

+ 119 - 0
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripManagerTest.cs

@@ -0,0 +1,119 @@
+//
+// ToolStripManagerTest.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Jonathan Pobst
+//
+// Authors:
+//	Jonathan Pobst ([email protected])
+//
+#if NET_2_0
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace MonoTests.System.Windows.Forms
+{
+	[TestFixture]
+	public class ToolStripManagerTest
+	{
+		[Test]
+		[Ignore ("This has to run all by itself.  Toolstrips in other tests register themselves and mess this up.")]
+		public void BehaviorFindToolStrip ()
+		{
+			// Default stuff
+			Assert.AreEqual (null, ToolStripManager.FindToolStrip (string.Empty), "A1");
+			Assert.AreEqual (null, ToolStripManager.FindToolStrip ("MyStrip"), "A2");
+			
+			ToolStrip ts = new ToolStrip ();
+			ts.Name = "MyStrip";
+
+			// Basic operation
+			Assert.AreSame (ts, ToolStripManager.FindToolStrip ("MyStrip"), "A3");
+			
+			// Dispose removes them
+			ts.Dispose ();
+			Assert.AreEqual (null, ToolStripManager.FindToolStrip ("MyStrip"), "A4");
+			
+			ts = new ToolStrip ();
+			ts.Name = "MyStrip1";
+			MenuStrip ms = new MenuStrip ();
+			ms.Name = "MyStrip2";
+
+			// Basic operation
+			Assert.AreSame (ts, ToolStripManager.FindToolStrip ("MyStrip1"), "A5");
+			Assert.AreSame (ms, ToolStripManager.FindToolStrip ("MyStrip2"), "A6");
+		
+			// Find unnamed strip
+			StatusStrip ss = new StatusStrip ();
+			Assert.AreEqual (ss, ToolStripManager.FindToolStrip (string.Empty), "A7");
+			
+			// Always return first unnamed strip
+			ContextMenuStrip cms = new ContextMenuStrip ();
+			Assert.AreEqual (ss, ToolStripManager.FindToolStrip (string.Empty), "A8");
+			
+			// Remove first unnamed strip, returns second one
+			ss.Dispose ();
+			Assert.AreEqual (cms, ToolStripManager.FindToolStrip (string.Empty), "A9");
+			
+			// ContextMenuStrips are included
+			cms.Name = "Context";
+			Assert.AreEqual (cms, ToolStripManager.FindToolStrip ("Context"), "A10");
+		}
+		
+		[Test]
+		public void MethodIsShortcutValid ()
+		{
+			Assert.AreEqual (true, ToolStripManager.IsValidShortcut (Keys.F1), "A1");
+			Assert.AreEqual (true, ToolStripManager.IsValidShortcut (Keys.F7), "A1");
+			Assert.AreEqual (true, ToolStripManager.IsValidShortcut (Keys.Shift | Keys.F1), "A1");
+			Assert.AreEqual (true, ToolStripManager.IsValidShortcut (Keys.Control | Keys.F1), "A1");
+			Assert.AreEqual (false, ToolStripManager.IsValidShortcut (Keys.Shift), "A1");
+			Assert.AreEqual (false, ToolStripManager.IsValidShortcut (Keys.Alt), "A1");
+			Assert.AreEqual (false, ToolStripManager.IsValidShortcut (Keys.D6), "A1");
+			Assert.AreEqual (true, ToolStripManager.IsValidShortcut (Keys.Control | Keys.S), "A1");
+			Assert.AreEqual (false, ToolStripManager.IsValidShortcut (Keys.L), "A1");
+		}
+		
+		[Test]
+		public void TwoShortcuts ()
+		{
+			ToolStripMenuItem tsmi = new ToolStripMenuItem ();
+			tsmi.ShortcutKeys = Keys.Control | Keys.D;
+			ToolStripMenuItem tsmi2 = new ToolStripMenuItem ();
+			tsmi2.ShortcutKeys = Keys.Control | Keys.D;
+
+			Assert.AreEqual (Keys.Control | Keys.D, tsmi.ShortcutKeys, "A1");
+			Assert.AreEqual (Keys.Control | Keys.D, tsmi2.ShortcutKeys, "A2");
+			
+			ToolStrip ts = new ToolStrip ();
+			ts.Items.Add (tsmi);
+			ts.Items.Add (tsmi2);
+
+			Assert.AreEqual (Keys.Control | Keys.D, tsmi.ShortcutKeys, "A3");
+			Assert.AreEqual (Keys.Control | Keys.D, tsmi2.ShortcutKeys, "A4");
+		}
+	}
+}
+#endif

+ 143 - 0
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripOverflowButtonTest.cs

@@ -0,0 +1,143 @@
+//
+// ToolStripOverflowButtonTest.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Jonathan Pobst
+//
+// Authors:
+//	Jonathan Pobst ([email protected])
+//
+#if NET_2_0
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using System.Drawing;
+using System.Windows.Forms;
+using System.ComponentModel;
+
+namespace MonoTests.System.Windows.Forms
+{
+	[TestFixture]
+	public class ToolStripOverflowButtonTests
+	{
+		[Test]
+		public void Constructor ()
+		{
+		}
+
+		[Test]
+		public void ProtectedProperties ()
+		{
+			ExposeProtectedProperties epp = new ExposeProtectedProperties ();
+
+			Assert.AreEqual (new Padding (0, 1, 0, 2), epp.DefaultMargin, "C1");
+		}
+
+		[Test]
+		public void Size2 ()
+		{
+			Form f = new Form ();
+			f.ShowInTaskbar = false;
+			f.Show ();
+
+			ToolStrip ts = new ToolStrip ();
+			f.Controls.Add (ts);
+			ToolStripOverflowButton tsi = ts.OverflowButton;
+
+			Assert.AreEqual (new Size (16, 25), tsi.Size, "B1");
+			Assert.AreEqual (false, tsi.Visible, "B3");
+			ToolStripItem test = ts.Items.Add ("test");
+			test.Overflow = ToolStripItemOverflow.Always;
+			ts.PerformLayout ();
+
+			Assert.AreEqual (Size.Empty, tsi.Size, "B2");
+			f.Hide ();
+		}
+
+		[Test]
+		public void MethodGetPreferredSize ()
+		{
+			Form f = new Form ();
+			f.ShowInTaskbar = false;
+			f.Show ();
+
+			ToolStrip ts = new ToolStrip ();
+			f.Controls.Add (ts);
+			ToolStripOverflowButton tsi = ts.OverflowButton;
+
+			Assert.AreEqual (Size.Empty, tsi.GetPreferredSize (Size.Empty), "B1");
+			Assert.AreEqual (false, tsi.Visible, "B2");
+			
+			ToolStripItem test = ts.Items.Add ("test");
+			test.Overflow = ToolStripItemOverflow.Always;
+			ts.PerformLayout ();
+
+			Assert.AreEqual (new Size (16, 25), tsi.GetPreferredSize (new Size (100, 100)), "B3");
+			Assert.AreEqual (false, tsi.Visible, "B4");
+			f.Hide ();
+		}
+		
+		[Test]
+		public void BehaviorItemsOnOverflow ()
+		{
+			Form f = new Form ();
+			f.ShowInTaskbar = false;
+			MyToolStrip ts = new MyToolStrip ();
+			f.Controls.Add (ts);
+			f.Show ();
+			
+			Assert.AreEqual (0, ts.Items.Count, "A1");
+			Assert.AreEqual (1, ts.PublicDisplayedItems.Count, "A2");
+			Assert.AreEqual (false, ts.OverflowButton.Visible, "A3");
+			Assert.AreEqual (0, ts.OverflowButton.DropDown.Items.Count, "A3");
+
+			ToolStripItem tsi = ts.Items.Add ("test");
+
+			Assert.AreEqual (1, ts.Items.Count, "A4");
+			Assert.AreEqual (2, ts.PublicDisplayedItems.Count, "A5");
+			Assert.AreEqual (false, ts.OverflowButton.Visible, "A3");
+			Assert.AreEqual (0, ts.OverflowButton.DropDown.Items.Count, "A6");
+
+			tsi.Overflow = ToolStripItemOverflow.Always;
+
+			Assert.AreEqual (1, ts.Items.Count, "A7");
+			Assert.AreEqual (2, ts.PublicDisplayedItems.Count, "A8");
+			Assert.AreEqual (true, ts.OverflowButton.Visible, "A3");
+			Assert.AreEqual (0, ts.OverflowButton.DropDown.Items.Count, "A9");
+			Console.WriteLine (ts.PublicDisplayedItems[1].GetType().ToString());
+			f.Dispose ();
+		}
+		
+		private class ExposeProtectedProperties : ToolStripButton
+		{
+			public new Padding DefaultMargin { get { return base.DefaultMargin; } }
+		}
+		
+		private class MyToolStrip : ToolStrip
+		{
+			public ToolStripItemCollection PublicDisplayedItems {
+				get { return base.DisplayedItems; }
+			}
+		}
+	}
+}
+#endif

+ 51 - 0
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripOverflowTest.cs

@@ -0,0 +1,51 @@
+//
+// ToolStripOverflowTest.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Jonathan Pobst
+//
+// Authors:
+//	Jonathan Pobst ([email protected])
+//
+#if NET_2_0
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using System.Drawing;
+using System.Windows.Forms;
+using System.ComponentModel;
+
+namespace MonoTests.System.Windows.Forms
+{
+	[TestFixture]
+	public class ToolStripOverflowTests
+	{
+		[Test]
+		public void Constructor ()
+		{
+			ToolStripOverflow tso = (ToolStripOverflow)new ToolStrip ().OverflowButton.DropDown;
+			
+			Assert.AreEqual ("System.Windows.Forms.Layout.FlowLayout", tso.LayoutEngine.ToString (), "A1");
+		}
+	}
+}
+#endif

+ 213 - 0
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripPanelTest.cs

@@ -0,0 +1,213 @@
+//
+// ToolStripPanelTests.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2007 Jonathan Pobst
+//
+// Authors:
+//	Jonathan Pobst ([email protected])
+//
+#if NET_2_0
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace MonoTests.System.Windows.Forms
+{
+	[TestFixture]
+	public class ToolStripPanelTests
+	{
+		[Test]
+		public void Constructor ()
+		{
+			ToolStripPanel tsp = new ToolStripPanel ();
+
+			Assert.AreEqual (true, tsp.AutoSize, "A1");
+			Assert.AreEqual (DockStyle.None, tsp.Dock, "A2");
+			Assert.AreEqual ("System.Windows.Forms.Layout.FlowLayout", tsp.LayoutEngine.ToString (), "A3");
+			Assert.AreEqual (false, tsp.Locked, "A4");
+			Assert.AreEqual (Orientation.Horizontal, tsp.Orientation, "A5");
+			Assert.AreSame (ToolStripManager.Renderer, tsp.Renderer, "A6");
+			Assert.AreEqual (ToolStripRenderMode.ManagerRenderMode, tsp.RenderMode, "A7");
+			Assert.AreEqual (new Padding (3, 0, 0, 0), tsp.RowMargin, "A8");
+			Assert.AreEqual ("System.Windows.Forms.ToolStripPanelRow[]", tsp.Rows.ToString (), "A9");
+		}
+
+		[Test]
+		public void ProtectedProperties ()
+		{
+			ExposeProtectedProperties epp = new ExposeProtectedProperties ();
+
+			Assert.AreEqual (new Padding (0), epp.DefaultMargin, "C1");
+			Assert.AreEqual (new Padding (0), epp.DefaultPadding, "C2");
+		}
+
+		[Test]
+		public void PropertyAutoSize ()
+		{
+			ToolStripPanel tsp = new ToolStripPanel ();
+			EventWatcher ew = new EventWatcher (tsp);
+
+			tsp.AutoSize = false;
+			Assert.AreEqual (false, tsp.AutoSize, "B1");
+			Assert.AreEqual ("AutoSizeChanged", ew.ToString (), "B2");
+
+			ew.Clear ();
+			tsp.AutoSize = false;
+			Assert.AreEqual (string.Empty, ew.ToString (), "B3");
+		}
+
+		[Test]
+		public void PropertyDock ()
+		{
+			ToolStripPanel tsp = new ToolStripPanel ();
+			EventWatcher ew = new EventWatcher (tsp);
+
+			tsp.Dock = DockStyle.Left;
+			Assert.AreEqual (DockStyle.Left, tsp.Dock, "B1");
+			Assert.AreEqual (string.Empty, ew.ToString (), "B2");
+
+			ew.Clear ();
+			tsp.Dock = DockStyle.Left;
+			Assert.AreEqual (string.Empty, ew.ToString (), "B3");
+		}
+
+		[Test]
+		public void PropertyLocked ()
+		{
+			ToolStripPanel tsp = new ToolStripPanel ();
+			EventWatcher ew = new EventWatcher (tsp);
+
+			tsp.Locked = true;
+			Assert.AreEqual (true, tsp.Locked, "B1");
+			Assert.AreEqual (string.Empty, ew.ToString (), "B2");
+
+			ew.Clear ();
+			tsp.Locked = true;
+			Assert.AreEqual (string.Empty, ew.ToString (), "B3");
+		}
+
+		[Test]
+		public void PropertyOrientation ()
+		{
+			ToolStripPanel tsp = new ToolStripPanel ();
+			EventWatcher ew = new EventWatcher (tsp);
+
+			tsp.Orientation = Orientation.Vertical;
+			Assert.AreEqual (Orientation.Vertical, tsp.Orientation, "B1");
+			Assert.AreEqual (string.Empty, ew.ToString (), "B2");
+
+			ew.Clear ();
+			tsp.Orientation = Orientation.Vertical;
+			Assert.AreEqual (string.Empty, ew.ToString (), "B3");
+		}
+
+		[Test]
+		public void PropertyRenderer ()
+		{
+			ToolStripPanel tsp = new ToolStripPanel ();
+			EventWatcher ew = new EventWatcher (tsp);
+
+			ToolStripProfessionalRenderer pr = new ToolStripProfessionalRenderer ();
+
+			tsp.Renderer = pr;
+			Assert.AreSame (pr, tsp.Renderer, "B1");
+			Assert.AreEqual (ToolStripRenderMode.Custom, tsp.RenderMode, "B1-2");
+			// I refuse to call the event twice like .Net does.
+			//Assert.AreEqual ("RendererChanged;RendererChanged", ew.ToString (), "B2");
+
+			ew.Clear ();
+			tsp.Renderer = pr;
+			//Assert.AreEqual (string.Empty, ew.ToString (), "B3");
+		}
+
+		[Test]
+		public void PropertyRenderMode ()
+		{
+			ToolStripPanel tsp = new ToolStripPanel ();
+			EventWatcher ew = new EventWatcher (tsp);
+
+			tsp.RenderMode = ToolStripRenderMode.System;
+			Assert.AreEqual (ToolStripRenderMode.System, tsp.RenderMode, "B1");
+			// I refuse to call the event twice like .Net does.
+			//Assert.AreEqual ("RendererChanged;RendererChanged", ew.ToString (), "B2");
+
+			ew.Clear ();
+			tsp.RenderMode = ToolStripRenderMode.System;
+			//Assert.AreEqual ("RendererChanged", ew.ToString (), "B3");
+		}
+
+		[Test]
+		public void PropertyRowMargin ()
+		{
+			ToolStripPanel tsp = new ToolStripPanel ();
+			EventWatcher ew = new EventWatcher (tsp);
+
+			tsp.RowMargin = new Padding (4);
+			Assert.AreEqual (new Padding (4), tsp.RowMargin, "B1");
+			Assert.AreEqual (string.Empty, ew.ToString (), "B2");
+
+			ew.Clear ();
+			tsp.RowMargin = new Padding (4);
+			Assert.AreEqual (string.Empty, ew.ToString (), "B3");
+		}
+
+		[Test]
+		public void MethodCreateControlsInstance ()
+		{
+			ExposeProtectedProperties epp = new ExposeProtectedProperties ();
+
+			Assert.AreEqual ("System.Windows.Forms.ToolStripPanel+ToolStripPanelControlCollection", epp.CreateControlsInstance (). GetType ().ToString (), "B1");
+		}
+
+		private class EventWatcher
+		{
+			private string events = string.Empty;
+
+			public EventWatcher (ToolStripPanel tsp)
+			{
+				tsp.AutoSizeChanged += new EventHandler (delegate (Object obj, EventArgs e) { events += ("AutoSizeChanged;"); });
+				tsp.RendererChanged += new EventHandler (delegate (Object obj, EventArgs e) { events += ("RendererChanged;"); });
+			}
+
+			public override string ToString ()
+			{
+				return events.TrimEnd (';');
+			}
+
+			public void Clear ()
+			{
+				events = string.Empty;
+			}
+		}
+
+		private class ExposeProtectedProperties : ToolStripPanel
+		{
+			public new Padding DefaultMargin { get { return base.DefaultMargin; } }
+			public new Padding DefaultPadding { get { return base.DefaultPadding; } }
+			public new ControlCollection CreateControlsInstance () { return base.CreateControlsInstance (); }
+		}
+	}
+}
+#endif

+ 13 - 13
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripProgressBarTest.cs

@@ -44,7 +44,7 @@ namespace MonoTests.System.Windows.Forms
 		{
 			ToolStripProgressBar tsi = new ToolStripProgressBar ();
 
-			//Assert.AreEqual (100, tsi.MarqueeAnimationSpeed, "A1");
+			Assert.AreEqual (100, tsi.MarqueeAnimationSpeed, "A1");
 			Assert.AreEqual (100, tsi.Maximum, "A2");
 			Assert.AreEqual (0, tsi.Minimum, "A3");
 			Assert.AreEqual ("System.Windows.Forms.ProgressBar", tsi.ProgressBar.GetType ().ToString (), "A4");
@@ -68,20 +68,20 @@ namespace MonoTests.System.Windows.Forms
 			Assert.AreEqual (new Size (100, 15), epp.DefaultSize, "C2");
 		}
 
-		//[Test]
-		//public void PropertyMarqueeAnimationSpeed ()
-		//{
-		//        ToolStripProgressBar tsi = new ToolStripProgressBar ();
-		//        EventWatcher ew = new EventWatcher (tsi);
+		[Test]
+		public void PropertyMarqueeAnimationSpeed ()
+		{
+			ToolStripProgressBar tsi = new ToolStripProgressBar ();
+			EventWatcher ew = new EventWatcher (tsi);
 
-		//        tsi.MarqueeAnimationSpeed = 200;
-		//        Assert.AreEqual (200, tsi.MarqueeAnimationSpeed, "B1");
-		//        Assert.AreEqual (string.Empty, ew.ToString (), "B2");
+			tsi.MarqueeAnimationSpeed = 200;
+			Assert.AreEqual (200, tsi.MarqueeAnimationSpeed, "B1");
+			Assert.AreEqual (string.Empty, ew.ToString (), "B2");
 
-		//        ew.Clear ();
-		//        tsi.MarqueeAnimationSpeed = 200;
-		//        Assert.AreEqual (string.Empty, ew.ToString (), "B3");
-		//}
+			ew.Clear ();
+			tsi.MarqueeAnimationSpeed = 200;
+			Assert.AreEqual (string.Empty, ew.ToString (), "B3");
+		}
 
 		[Test]
 		public void PropertyMaximum ()

+ 207 - 0
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripStatusLabelTest.cs

@@ -0,0 +1,207 @@
+//
+// ToolStripStatusLabelTests.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Jonathan Pobst
+//
+// Authors:
+//	Jonathan Pobst ([email protected])
+//
+#if NET_2_0
+using System;
+using System.Collections.Generic;
+using System.Text;
+using NUnit.Framework;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace MonoTests.System.Windows.Forms
+{
+	[TestFixture]
+	public class ToolStripStatusLabelTests
+	{
+		//[Test]
+		//public void Constructor ()
+		//{
+		//        ToolStripLabel tsi = new ToolStripLabel ();
+
+		//        Assert.AreEqual (Color.Red, tsi.ActiveLinkColor, "A1");
+		//        Assert.AreEqual (false, tsi.CanSelect, "A2");
+		//        Assert.AreEqual (false, tsi.IsLink, "A3");
+		//        Assert.AreEqual (LinkBehavior.SystemDefault, tsi.LinkBehavior, "A4");
+		//        Assert.AreEqual (Color.FromArgb (0,0,255), tsi.LinkColor, "A5");
+		//        Assert.AreEqual (false, tsi.LinkVisited, "A6");
+		//        Assert.AreEqual (Color.FromArgb (128, 0, 128), tsi.VisitedLinkColor, "A7");
+
+		//        int count = 0;
+		//        EventHandler oc = new EventHandler (delegate (object sender, EventArgs e) { count++; });
+		//        Image i = new Bitmap (1,1);
+
+		//        tsi = new ToolStripLabel (i);
+		//        tsi.PerformClick();
+		//        Assert.AreEqual (null, tsi.Text, "A8");
+		//        Assert.AreSame (i, tsi.Image, "A9");
+		//        Assert.AreEqual (false, tsi.IsLink, "A10");
+		//        Assert.AreEqual (0, count, "A11");
+		//        Assert.AreEqual (string.Empty, tsi.Name, "A12");
+
+		//        tsi = new ToolStripLabel ("Text");
+		//        tsi.PerformClick ();
+		//        Assert.AreEqual ("Text", tsi.Text, "A13");
+		//        Assert.AreSame (null, tsi.Image, "A14");
+		//        Assert.AreEqual (false, tsi.IsLink, "A15");
+		//        Assert.AreEqual (0, count, "A16");
+		//        Assert.AreEqual (string.Empty, tsi.Name, "A17");
+
+		//        tsi = new ToolStripLabel ("Text", i);
+		//        tsi.PerformClick ();
+		//        Assert.AreEqual ("Text", tsi.Text, "A18");
+		//        Assert.AreSame (i, tsi.Image, "A19");
+		//        Assert.AreEqual (false, tsi.IsLink, "A20");
+		//        Assert.AreEqual (0, count, "A21");
+		//        Assert.AreEqual (string.Empty, tsi.Name, "A22");
+
+		//        tsi = new ToolStripLabel ("Text", i, true);
+		//        tsi.PerformClick ();
+		//        Assert.AreEqual ("Text", tsi.Text, "A23");
+		//        Assert.AreSame (i, tsi.Image, "A24");
+		//        Assert.AreEqual (true, tsi.IsLink, "A25");
+		//        Assert.AreEqual (0, count, "A26");
+		//        Assert.AreEqual (string.Empty, tsi.Name, "A27");
+
+		//        tsi = new ToolStripLabel ("Text", i, true, oc);
+		//        tsi.PerformClick ();
+		//        Assert.AreEqual ("Text", tsi.Text, "A28");
+		//        Assert.AreSame (i, tsi.Image, "A29");
+		//        Assert.AreEqual (true, tsi.IsLink, "A30");
+		//        Assert.AreEqual (1, count, "A31");
+		//        Assert.AreEqual (string.Empty, tsi.Name, "A32");
+
+		//        tsi = new ToolStripLabel ("Text", i, true, oc, "Name");
+		//        tsi.PerformClick ();
+		//        Assert.AreEqual ("Text", tsi.Text, "A33");
+		//        Assert.AreSame (i, tsi.Image, "A34");
+		//        Assert.AreEqual (true, tsi.IsLink, "A35");
+		//        Assert.AreEqual (2, count, "A36");
+		//        Assert.AreEqual ("Name", tsi.Name, "A37");
+		//}
+
+		[Test]
+		public void ProtectedProperties ()
+		{
+			ExposeProtectedProperties epp = new ExposeProtectedProperties ();
+
+			Assert.AreEqual (new Padding (0, 3, 0, 2), epp.DefaultMargin, "C3");
+		}
+
+		//[Test]
+		//public void PropertyActiveLinkColor ()
+		//{
+		//        ToolStripLabel tsi = new ToolStripLabel ();
+
+		//        tsi.ActiveLinkColor = Color.Green;
+		//        Assert.AreEqual (Color.Green, tsi.ActiveLinkColor, "B1");
+		//}
+
+		//[Test]
+		//public void PropertyIsLink ()
+		//{
+		//        ToolStripLabel tsi = new ToolStripLabel ();
+
+		//        tsi.IsLink = true;
+		//        Assert.AreEqual (true, tsi.IsLink, "B1");
+		//}
+
+		//[Test]
+		//public void PropertyLinkBehavior ()
+		//{
+		//        ToolStripLabel tsi = new ToolStripLabel ();
+
+		//        tsi.LinkBehavior = LinkBehavior.NeverUnderline;
+		//        Assert.AreEqual (LinkBehavior.NeverUnderline, tsi.LinkBehavior, "B1");
+		//}
+
+		//[Test]
+		//public void PropertyLinkColor ()
+		//{
+		//        ToolStripLabel tsi = new ToolStripLabel ();
+
+		//        tsi.LinkColor = Color.Green;
+		//        Assert.AreEqual (Color.Green, tsi.LinkColor, "B1");
+		//}
+
+		//[Test]
+		//public void PropertyLinkVisited ()
+		//{
+		//        ToolStripLabel tsi = new ToolStripLabel ();
+
+		//        tsi.LinkVisited = true;
+		//        Assert.AreEqual (true, tsi.LinkVisited, "B1");
+		//}
+
+		//[Test]
+		//public void PropertyVisitedLinkColor ()
+		//{
+		//        ToolStripLabel tsi = new ToolStripLabel ();
+
+		//        tsi.VisitedLinkColor = Color.Green;
+		//        Assert.AreEqual (Color.Green, tsi.VisitedLinkColor, "B1");
+		//}
+
+
+		//[Test]
+		//public void PropertyAnchorAndDocking ()
+		//{
+		//        ToolStripItem ts = new NullToolStripItem ();
+
+		//        ts.Anchor = AnchorStyles.Top | AnchorStyles.Bottom;
+
+		//        Assert.AreEqual (AnchorStyles.Top | AnchorStyles.Bottom, ts.Anchor, "A1");
+		//        Assert.AreEqual (DockStyle.None, ts.Dock, "A2");
+
+		//        ts.Anchor = AnchorStyles.Left | AnchorStyles.Right;
+
+		//        Assert.AreEqual (AnchorStyles.Left | AnchorStyles.Right, ts.Anchor, "A1");
+		//        Assert.AreEqual (DockStyle.None, ts.Dock, "A2");
+
+		//        ts.Dock = DockStyle.Left;
+
+		//        Assert.AreEqual (AnchorStyles.Top | AnchorStyles.Left, ts.Anchor, "A1");
+		//        Assert.AreEqual (DockStyle.Left, ts.Dock, "A2");
+
+		//        ts.Dock = DockStyle.None;
+
+		//        Assert.AreEqual (AnchorStyles.Top | AnchorStyles.Left, ts.Anchor, "A1");
+		//        Assert.AreEqual (DockStyle.None, ts.Dock, "A2");
+
+		//        ts.Dock = DockStyle.Top;
+
+		//        Assert.AreEqual (AnchorStyles.Top | AnchorStyles.Left, ts.Anchor, "A1");
+		//        Assert.AreEqual (DockStyle.Top, ts.Dock, "A2");
+		//}
+
+		private class ExposeProtectedProperties : ToolStripStatusLabel
+		{
+			public new Padding DefaultMargin { get { return base.DefaultMargin; } }
+		}
+	}
+}
+#endif