context: #if NET_2_0
  using System;
  using System.Text;
  using NUnit.Framework;
  using System.Windows.Forms;
  using System.Drawing;
  using System.Collections.Generic;
  
  namespace MonoTests.System.Windows.Forms
  {
  	[TestFixture()]	
  	public class FlowPanelTests : TestHelper
  	{
  		[Test]
  		public void TestConstruction()
  		{
  			FlowLayoutPanel p = new FlowLayoutPanel();
  			
  			Assert.AreEqual(FlowDirection.LeftToRight, p.FlowDirection, "A1");
  			Assert.AreEqual(true, p.WrapContents, "A2");
  			Assert.AreEqual("System.Windows.Forms.Layout.FlowLayout", p.LayoutEngine.ToString(), "A3");
  			
  			p.FlowDirection = FlowDirection.BottomUp;
  			p.WrapContents = false;
  
  			Assert.AreEqual (FlowDirection.BottomUp, p.FlowDirection, "A4");
  			Assert.AreEqual (false, p.WrapContents, "A5");
  		}
  		
  		[Test]
  		public void TestExtenderProvider()
  		{
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  			Button b = new Button();
  			
  			Assert.AreEqual(false, p.GetFlowBreak(b), "B1");
  			
  			p.SetFlowBreak(b, true);
  
  			Assert.AreEqual (true, p.GetFlowBreak (b), "B2");
  		}
  
  		#region LeftToRight Tests
  		[Test]
  		public void LeftToRightLayoutTest1 ()
  		{
  			// 2 Normal Buttons
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (0, 0, 100, 100), p.Controls[0].Bounds, "C1");
  			Assert.AreEqual (new Rectangle (100, 0, 100, 100), p.Controls[1].Bounds, "C2");
  		}
  
  		[Test]
  		public void LeftToRightLayoutTest2 ()
  		{
  			// Dock Fill and Normal
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  
  			p.Controls.Add (CreateButton (100, 50, false, DockStyle.Fill, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (0, 0, 100, 100), p.Controls[0].Bounds, "D1");
  			Assert.AreEqual (new Rectangle (100, 0, 100, 100), p.Controls[1].Bounds, "D2");
  		}
  
  		[Test]
  		public void LeftToRightLayoutTest3 ()
  		{
  			// Anchored: Top/Bottom and Normal
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  
  			p.Controls.Add (CreateButton (100, 50, false, DockStyle.None, new Padding (), AnchorStyles.Top | AnchorStyles.Bottom));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (0, 0, 100, 100), p.Controls[0].Bounds, "E1");
  			Assert.AreEqual (new Rectangle (100, 0, 100, 100), p.Controls[1].Bounds, "E2");
  		}
  
  		[Test]
  		public void LeftToRightLayoutTest4 ()
  		{
  			// Anchored: Top/Bottom and Dock Fill
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  
  			p.Controls.Add (CreateButton (100, 50, false, DockStyle.None, new Padding (), AnchorStyles.Top | AnchorStyles.Bottom));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.Fill, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (0, 0, 100, 0), p.Controls[0].Bounds, "F1");
  			Assert.AreEqual (new Rectangle (100, 0, 100, 0), p.Controls[1].Bounds, "F2");
  		}
  
  		[Test]
  		public void LeftToRightLayoutTest5 ()
  		{
  			// 2 Anchored: Top/Bottom
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  
  			p.Controls.Add (CreateButton (100, 50, false, DockStyle.None, new Padding (), AnchorStyles.Top | AnchorStyles.Bottom));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Top | AnchorStyles.Bottom));
  
  			Assert.AreEqual (new Rectangle (0, 0, 100, 0), p.Controls[0].Bounds, "G1");
  			Assert.AreEqual (new Rectangle (100, 0, 100, 0), p.Controls[1].Bounds, "G2");
  		}
  
  		[Test]
  		public void LeftToRightLayoutTest6 ()
  		{
  			// 2 Dock Fill
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  
  			p.Controls.Add (CreateButton (100, 50, false, DockStyle.Fill, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.Fill, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (0, 0, 100, 0), p.Controls[0].Bounds, "H1");
  			Assert.AreEqual (new Rectangle (100, 0, 100, 0), p.Controls[1].Bounds, "H2");
  		}
  
  		[Test]
  		public void LeftToRightLayoutTest7 ()
  		{
  			// Dock Top
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  
  			p.Controls.Add (CreateButton (100, 50, false, DockStyle.Top, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (0, 0, 100, 50), p.Controls[0].Bounds, "I1");
  			Assert.AreEqual (new Rectangle (100, 0, 100, 100), p.Controls[1].Bounds, "I2");
  		}
  
  		[Test]
  		public void LeftToRightLayoutTest8 ()
  		{
  			// Dock Bottom
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  
  			p.Controls.Add (CreateButton (100, 50, false, DockStyle.Bottom, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (0, 50, 100, 50), p.Controls[0].Bounds, "J1");
  			Assert.AreEqual (new Rectangle (100, 0, 100, 100), p.Controls[1].Bounds, "J2");
  		}
  
  		[Test]
  		public void LeftToRightLayoutTest9 ()
  		{
  			// Anchor Bottom
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  
  			p.Controls.Add (CreateButton (100, 50, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Bottom));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (0, 50, 100, 50), p.Controls[0].Bounds, "K1");
  			Assert.AreEqual (new Rectangle (100, 0, 100, 100), p.Controls[1].Bounds, "K2");
  		}
  
  		[Test]
  		public void LeftToRightLayoutTest10 ()
  		{
  			// No Dock or Anchor
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  
  			p.Controls.Add (CreateButton (100, 50, false, DockStyle.None, new Padding (), AnchorStyles.None));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (0, 25, 100, 50), p.Controls[0].Bounds, "L1");
  			Assert.AreEqual (new Rectangle (100, 0, 100, 100), p.Controls[1].Bounds, "L2");
  		}
  
  		[Test]
  		public void LeftToRightLayoutTest11 ()
  		{
  			// WrapContents = true
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  
  			p.Controls.Add (CreateButton (100, 50, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (0, 0, 100, 50), p.Controls[0].Bounds, "M1");
  			Assert.AreEqual (new Rectangle (100, 0, 100, 100), p.Controls[1].Bounds, "M2");
  			Assert.AreEqual (new Rectangle (0, 100, 100, 100), p.Controls[2].Bounds, "M3");
  			Assert.AreEqual (new Rectangle (100, 100, 100, 100), p.Controls[3].Bounds, "M4");
  		}
  
  		[Test]
  		public void LeftToRightLayoutTest12 ()
  		{
  			// WrapContents = false
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  			p.WrapContents = false;
  			
  			p.Controls.Add (CreateButton (100, 50, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (0, 0, 100, 50), p.Controls[0].Bounds, "N1");
  			Assert.AreEqual (new Rectangle (100, 0, 100, 100), p.Controls[1].Bounds, "N2");
  			Assert.AreEqual (new Rectangle (200, 0, 100, 100), p.Controls[2].Bounds, "N3");
  			Assert.AreEqual (new Rectangle (300, 0, 100, 100), p.Controls[3].Bounds, "N4");
  		}
  
  		[Test]
  		public void LeftToRightLayoutTest13 ()
  		{
  			// SetFlowBreak 1, 3
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			p.SetFlowBreak (p.Controls[0], true);
  			p.SetFlowBreak (p.Controls[2], true);
  			
  			Assert.AreEqual (new Rectangle (0, 0, 100, 100), p.Controls[0].Bounds, "O1");
  			Assert.AreEqual (new Rectangle (0, 100, 100, 100), p.Controls[1].Bounds, "O2");
  			Assert.AreEqual (new Rectangle (100, 100, 100, 100), p.Controls[2].Bounds, "O3");
  			Assert.AreEqual (new Rectangle (0, 200, 100, 100), p.Controls[3].Bounds, "O4");
  		}
  
  		[Test]
  		public void LeftToRightLayoutTest14 ()
  		{
  			// Margins
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  
  			p.Controls.Add (CreateButton (50, 50, false, DockStyle.None, new Padding (1,3,5,2), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (50, 50, false, DockStyle.None, new Padding (7,3,12,5), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (50, 50, false, DockStyle.None, new Padding (14,7,1,3), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (50, 50, false, DockStyle.None, new Padding (4), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (1, 3, 50, 50), p.Controls[0].Bounds, "P1");
  			Assert.AreEqual (new Rectangle (63, 3, 50, 50), p.Controls[1].Bounds, "P2");
  			Assert.AreEqual (new Rectangle (139, 7, 50, 50), p.Controls[2].Bounds, "P3");
  			Assert.AreEqual (new Rectangle (4, 64, 50, 50), p.Controls[3].Bounds, "P4");
  		}
  
  		[Test]
  		public void LeftToRightLayoutTest15 ()
  		{
  			// Margins and Different Sizes
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  
  			p.Controls.Add (CreateButton (25, 45, false, DockStyle.None, new Padding (6), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (60, 20, false, DockStyle.None, new Padding (9), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (15, 85, false, DockStyle.None, new Padding (2), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (50, 20, false, DockStyle.None, new Padding (4), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (6, 6, 25, 45), p.Controls[0].Bounds, "Q1");
  			Assert.AreEqual (new Rectangle (46, 9, 60, 20), p.Controls[1].Bounds, "Q2");
  			Assert.AreEqual (new Rectangle (117, 2, 15, 85), p.Controls[2].Bounds, "Q3");
  			Assert.AreEqual (new Rectangle (138, 4, 50, 20), p.Controls[3].Bounds, "Q4");
  		}
  
  		[Test]
  		public void LeftToRightLayoutTest16 ()
  		{
  			// Random Complex Layout 1
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  
  			p.Controls.Add (CreateButton (25, 45, false, DockStyle.None, new Padding (6), AnchorStyles.Right | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (60, 20, false, DockStyle.Fill, new Padding (9), AnchorStyles.Bottom | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (15, 85, false, DockStyle.None, new Padding (2), AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom));
  			p.Controls.Add (CreateButton (50, 20, false, DockStyle.None, new Padding (4), AnchorStyles.Left | AnchorStyles.Bottom));
  			p.Controls.Add (CreateButton (13, 22, false, DockStyle.None, new Padding (12), AnchorStyles.Left | AnchorStyles.Right));
  			p.Controls.Add (CreateButton (73, 28, false, DockStyle.Top, new Padding (6), AnchorStyles.None));
  
  			Assert.AreEqual (new Rectangle (6, 6, 25, 45), p.Controls[0].Bounds, "R1");
  			Assert.AreEqual (new Rectangle (46, 9, 60, 39), p.Controls[1].Bounds, "R2");
  			Assert.AreEqual (new Rectangle (117, 2, 15, 53), p.Controls[2].Bounds, "R3");
  			Assert.AreEqual (new Rectangle (138, 33, 50, 20), p.Controls[3].Bounds, "R4");
  			Assert.AreEqual (new Rectangle (12, 69, 13, 22), p.Controls[4].Bounds, "R5");
  			Assert.AreEqual (new Rectangle (43, 63, 73, 28), p.Controls[5].Bounds, "R6");
  		}
  
  		[Test]
  		public void LeftToRightLayoutTest17 ()
  		{
  			// Random Complex Layout 2
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  
  			p.Controls.Add (CreateButton (12, 345, false, DockStyle.Bottom, new Padding (1, 2, 3, 4), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (9, 44, false, DockStyle.Top, new Padding (6, 3, 2, 7), AnchorStyles.Right | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (78, 14, false, DockStyle.None, new Padding (5, 1, 2, 4), AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right));
  			p.Controls.Add (CreateButton (21, 64, false, DockStyle.Top, new Padding (3, 3, 3, 1), AnchorStyles.None));
  			p.Controls.Add (CreateButton (14, 14, false, DockStyle.Fill, new Padding (11, 4, 6, 3), AnchorStyles.Top | AnchorStyles.Bottom));
  			p.Controls.Add (CreateButton (132, 6, false, DockStyle.Fill, new Padding (5, 5, 4, 5), AnchorStyles.Top | AnchorStyles.Bottom));
  
  			p.SetFlowBreak (p.Controls[0], true);
  			p.SetFlowBreak (p.Controls[2], true);
  
  			Assert.AreEqual (new Rectangle (1, 2, 12, 345), p.Controls[0].Bounds, "S1");
  			Assert.AreEqual (new Rectangle (6, 354, 9, 44), p.Controls[1].Bounds, "S2");
  			Assert.AreEqual (new Rectangle (22, 352, 78, 49), p.Controls[2].Bounds, "S3");
  			Assert.AreEqual (new Rectangle (3, 408, 21, 64), p.Controls[3].Bounds, "S4");
  			Assert.AreEqual (new Rectangle (38, 409, 14, 61), p.Controls[4].Bounds, "S5");
  			Assert.AreEqual (new Rectangle (63, 410, 132, 58), p.Controls[5].Bounds, "S6");
  		}
  		
  		[Test]
  		public void LeftToRightLayoutTest18 ()
  		{
  			// SetFlowBreak has no effect when WrapContents = false
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  			p.WrapContents = false;
  
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			p.SetFlowBreak(p.Controls[0], true);
  			
  			Assert.AreEqual (new Rectangle (0, 0, 100, 100), p.Controls[0].Bounds, "T1");
  			Assert.AreEqual (new Rectangle (100, 0, 100, 100), p.Controls[1].Bounds, "T2");
  		}
  		#endregion
  
  		#region RightToLeft Tests
  		[Test]
  		public void RightToLeftLayoutTest1 ()
  		{
  			// 2 Normal Buttons
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  			p.FlowDirection = FlowDirection.RightToLeft;
  			
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (100, 0, 100, 100), p.Controls[0].Bounds, "AC1");
  			Assert.AreEqual (new Rectangle (0, 0, 100, 100), p.Controls[1].Bounds, "AC2");
  		}
  
  		[Test]
  		public void RightToLeftLayoutTest2 ()
  		{
  			// Dock Fill and Normal
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  			p.FlowDirection = FlowDirection.RightToLeft;
  
  			p.Controls.Add (CreateButton (100, 50, false, DockStyle.Fill, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (100, 0, 100, 100), p.Controls[0].Bounds, "AD1");
  			Assert.AreEqual (new Rectangle (0, 0, 100, 100), p.Controls[1].Bounds, "AD2");
  		}
  
  		[Test]
  		public void RightToLeftLayoutTest3 ()
  		{
  			// Anchored: Top/Bottom and Normal
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  			p.FlowDirection = FlowDirection.RightToLeft;
  
  			p.Controls.Add (CreateButton (100, 50, false, DockStyle.None, new Padding (), AnchorStyles.Top | AnchorStyles.Bottom));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (100, 0, 100, 100), p.Controls[0].Bounds, "AE1");
  			Assert.AreEqual (new Rectangle (0, 0, 100, 100), p.Controls[1].Bounds, "AE2");
  		}
  
  		[Test]
  		public void RightToLeftLayoutTest4 ()
  		{
  			// Anchored: Top/Bottom and Dock Fill
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  			p.FlowDirection = FlowDirection.RightToLeft;
  
  			p.Controls.Add (CreateButton (100, 50, false, DockStyle.None, new Padding (), AnchorStyles.Top | AnchorStyles.Bottom));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.Fill, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (100, 0, 100, 0), p.Controls[0].Bounds, "AF1");
  			Assert.AreEqual (new Rectangle (0, 0, 100, 0), p.Controls[1].Bounds, "AF2");
  		}
  
  		[Test]
  		public void RightToLeftLayoutTest5 ()
  		{
  			// 2 Anchored: Top/Bottom
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  			p.FlowDirection = FlowDirection.RightToLeft;
  
  			p.Controls.Add (CreateButton (100, 50, false, DockStyle.None, new Padding (), AnchorStyles.Top | AnchorStyles.Bottom));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Top | AnchorStyles.Bottom));
  
  			Assert.AreEqual (new Rectangle (100, 0, 100, 0), p.Controls[0].Bounds, "AG1");
  			Assert.AreEqual (new Rectangle (0, 0, 100, 0), p.Controls[1].Bounds, "AG2");
  		}
  
  		[Test]
  		public void RightToLeftLayoutTest6 ()
  		{
  			// 2 Dock Fill
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  			p.FlowDirection = FlowDirection.RightToLeft;
  
  			p.Controls.Add (CreateButton (100, 50, false, DockStyle.Fill, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.Fill, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (100, 0, 100, 0), p.Controls[0].Bounds, "AH1");
  			Assert.AreEqual (new Rectangle (0, 0, 100, 0), p.Controls[1].Bounds, "AH2");
  		}
  
  		[Test]
  		public void RightToLeftLayoutTest7 ()
  		{
  			// Dock Top
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  			p.FlowDirection = FlowDirection.RightToLeft;
  
  			p.Controls.Add (CreateButton (100, 50, false, DockStyle.Top, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (100, 0, 100, 50), p.Controls[0].Bounds, "AI1");
  			Assert.AreEqual (new Rectangle (0, 0, 100, 100), p.Controls[1].Bounds, "AI2");
  		}
  
  		[Test]
  		public void RightToLeftLayoutTest8 ()
  		{
  			// Dock Bottom
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  			p.FlowDirection = FlowDirection.RightToLeft;
  
  			p.Controls.Add (CreateButton (100, 50, false, DockStyle.Bottom, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (100, 50, 100, 50), p.Controls[0].Bounds, "AJ1");
  			Assert.AreEqual (new Rectangle (0, 0, 100, 100), p.Controls[1].Bounds, "AJ2");
  		}
  
  		[Test]
  		public void RightToLeftLayoutTest9 ()
  		{
  			// Anchor Bottom
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  			p.FlowDirection = FlowDirection.RightToLeft;
  
  			p.Controls.Add (CreateButton (100, 50, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Bottom));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (100, 50, 100, 50), p.Controls[0].Bounds, "AK1");
  			Assert.AreEqual (new Rectangle (0, 0, 100, 100), p.Controls[1].Bounds, "AK2");
  		}
  
  		[Test]
  		public void RightToLeftLayoutTest10 ()
  		{
  			// No Dock or Anchor
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  			p.FlowDirection = FlowDirection.RightToLeft;
  
  			p.Controls.Add (CreateButton (100, 50, false, DockStyle.None, new Padding (), AnchorStyles.None));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (100, 25, 100, 50), p.Controls[0].Bounds, "AL1");
  			Assert.AreEqual (new Rectangle (0, 0, 100, 100), p.Controls[1].Bounds, "AL2");
  		}
  
  		[Test]
  		public void RightToLeftLayoutTest11 ()
  		{
  			// WrapContents = true
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  			p.FlowDirection = FlowDirection.RightToLeft;
  
  			p.Controls.Add (CreateButton (100, 50, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (100, 0, 100, 50), p.Controls[0].Bounds, "AM1");
  			Assert.AreEqual (new Rectangle (0, 0, 100, 100), p.Controls[1].Bounds, "AM2");
  			Assert.AreEqual (new Rectangle (100, 100, 100, 100), p.Controls[2].Bounds, "AM3");
  			Assert.AreEqual (new Rectangle (0, 100, 100, 100), p.Controls[3].Bounds, "AM4");
  		}
  
  		[Test]
  		public void RightToLeftLayoutTest12 ()
  		{
  			// WrapContents = false
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  			p.WrapContents = false;
  			p.FlowDirection = FlowDirection.RightToLeft;
  
  			p.Controls.Add (CreateButton (100, 50, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			Assert.AreEqual (new Rectangle (100, 0, 100, 50), p.Controls[0].Bounds, "AN1");
  			Assert.AreEqual (new Rectangle (0, 0, 100, 100), p.Controls[1].Bounds, "AN2");
  			Assert.AreEqual (new Rectangle (-100, 0, 100, 100), p.Controls[2].Bounds, "AN3");
  			Assert.AreEqual (new Rectangle (-200, 0, 100, 100), p.Controls[3].Bounds, "AN4");
  		}
  
  		[Test]
  		public void RightToLeftLayoutTest13 ()
  		{
  			// SetFlowBreak 1, 3
  			FlowLayoutPanel p = new FlowLayoutPanel ();
  			p.FlowDirection = FlowDirection.RightToLeft;
  
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  			p.Controls.Add (CreateButton (100, 100, false, DockStyle.None, new Padding (), AnchorStyles.Left | AnchorStyles.Top));
  
  			p.SetFlowBreak (p.Controls[0], true);
  			p.SetFlowBreak (p.Controls[2], true);
  
  			Assert.AreEqual (new Rectangle (100, 0, 100, 100), p.Controls[0].Bounds, "AO1");
  			Assert.AreEqual (new Rectangle (100, 100, 100, 100), p.Controls[1].Bounds, "AO2");
  			Assert.AreEqual (new Rectangle (0, 100, 100, 100), p.Controls[2].Bounds, "AO3");
  			Assert.AreEqual (new Rectangle (100, 200, 100, 100), p.Controls[3].Bounds, "AO4");
  		}
  
  		[Test]
  		public void RightToLeftLayoutTest14 ()
  		{
  			// Margins
  
gt: 			FlowLayoutPanel p = new FlowLayoutPanel ();