using System.Windows.Forms;\r
using System.Drawing;\r
\r
-namespace ProfessionalColorTest\r
+namespace MonoTests.System.Windows.Forms\r
{\r
[TestFixture]\r
- public class SplitContainerTests\r
+ public class SplitContainerTests : TestHelper\r
{\r
[Test]\r
public void TestSplitContainerConstruction ()\r
}\r
\r
[Test]\r
- public void TestNotReleventProperties()\r
- {\r
- // (MSDN lists are the following as "This property is not relevant to this class.")\r
- SplitContainer sc = new SplitContainer ();\r
- \r
- Assert.AreEqual (false, sc.AutoScroll, "B1");\r
- sc.AutoScroll = true;\r
- Assert.AreEqual (false, sc.AutoScroll, "B1-2");\r
-\r
- Assert.AreEqual (new Size(0,0), sc.AutoScrollMargin, "B2");\r
- sc.AutoScrollMargin = new Size (100, 100);\r
- Assert.AreEqual (new Size (100,100), sc.AutoScrollMargin, "B2-2");\r
-\r
- Assert.AreEqual (new Size (0, 0), sc.AutoScrollMinSize, "B3");\r
- sc.AutoScrollMinSize = new Size (100, 100);\r
- Assert.AreEqual (new Size (100, 100), sc.AutoScrollMinSize, "B3-2");\r
-\r
- //Assert.AreEqual (new Point (0, 0), sc.AutoScrollOffset, "B4");\r
- //sc.AutoScrollOffset = new Point (100, 100);\r
- //Assert.AreEqual (new Point (100, 100), sc.AutoScrollOffset, "B4-2");\r
-\r
- Assert.AreEqual (new Point (0, 0), sc.AutoScrollPosition, "B5");\r
- sc.AutoScrollPosition = new Point (100, 100);\r
- Assert.AreEqual (new Point (0, 0), sc.AutoScrollPosition, "B5-2");\r
-\r
- Assert.AreEqual (false, sc.AutoSize, "B6");\r
- sc.AutoSize = true;\r
- Assert.AreEqual (true, sc.AutoSize, "B6-2");\r
-\r
- //Assert.AreEqual (ImageLayout.Tile, sc.BackgroundImageLayout, "B7");\r
- //sc.BackgroundImageLayout = ImageLayout.Stretch;\r
- //Assert.AreEqual (ImageLayout.Stretch, sc.BackgroundImageLayout, "B7-2");\r
-\r
- Assert.AreEqual (null, sc.BindingContext, "B8");\r
- sc.BindingContext = new BindingContext();\r
- Assert.AreEqual ("System.Windows.Forms.BindingContext", sc.BindingContext.ToString (), "B8-2");\r
-\r
- Assert.AreEqual (new Padding(0), sc.Padding, "B10");\r
- sc.Padding = new Padding (7);\r
- Assert.AreEqual (new Padding (7), sc.Padding, "B10-2");\r
-\r
- Assert.AreEqual (String.Empty, sc.Text, "B11");\r
- sc.Text = "Hello";\r
- Assert.AreEqual ("Hello", sc.Text, "B11-2");\r
-\r
- }\r
-\r
- [Test]\r
- public void TestRelevantProperties ()\r
+ public void TestProperties ()\r
{\r
SplitContainer sc = new SplitContainer ();\r
\r
p.AutoSize = true;\r
Assert.AreEqual (true, p.AutoSize, "D2-2");\r
\r
- //Assert.AreEqual (AutoSizeMode.GrowOnly, p.AutoSizeMode, "D3");\r
- //p.AutoSizeMode = AutoSizeMode.GrowAndShrink;\r
- //Assert.AreEqual (AutoSizeMode.GrowOnly, p.AutoSizeMode, "D3-2");\r
+ Assert.AreEqual (AutoSizeMode.GrowOnly, p.AutoSizeMode, "D3");\r
+ p.AutoSizeMode = AutoSizeMode.GrowAndShrink;\r
+ Assert.AreEqual (AutoSizeMode.GrowOnly, p.AutoSizeMode, "D3-2");\r
\r
Assert.AreEqual (BorderStyle.None, p.BorderStyle, "D4");\r
p.BorderStyle = BorderStyle.FixedSingle;\r
Assert.AreEqual (BorderStyle.FixedSingle, p.BorderStyle, "D4-2");\r
\r
- //Assert.AreEqual (DockStyle.None, p.Dock, "D5");\r
- //p.Dock = DockStyle.Left;\r
- //Assert.AreEqual (DockStyle.Left, p.Dock, "D5-2");\r
+ Assert.AreEqual (DockStyle.None, p.Dock, "D5");\r
+ p.Dock = DockStyle.Left;\r
+ Assert.AreEqual (DockStyle.Left, p.Dock, "D5-2");\r
\r
- //Assert.AreEqual (new Point(0,0), p.Location, "D7");\r
- //p.Location = new Point (10, 10);\r
- //Assert.AreEqual (new Point (0, 0), p.Location, "D7-2");\r
+ Assert.AreEqual (new Point (0, 0), p.Location, "D7");\r
+ p.Location = new Point (10, 10);\r
+ Assert.AreEqual (new Point (0, 0), p.Location, "D7-2");\r
\r
Assert.AreEqual (new Size (0, 0), p.MaximumSize, "D8");\r
p.MaximumSize = new Size (10, 10);\r
// We set a new max/min size above, so let's start over with new controls\r
sc = new SplitContainer();\r
p = sc.Panel1;\r
- \r
- //Assert.AreEqual (new Size (50, 100), p.Size, "D12");\r
- //p.Size = new Size (10, 10);\r
- //Assert.AreEqual (new Size (50, 100), p.Size, "D12-2");\r
+\r
+ Assert.AreEqual (new Size (50, 100), p.Size, "D12");\r
+ p.Size = new Size (10, 10);\r
+ Assert.AreEqual (new Size (50, 100), p.Size, "D12-2");\r
\r
//Assert.AreEqual (0, p.TabIndex, "D13");\r
p.TabIndex = 4;\r
}\r
\r
[Test]\r
- [Ignore ("SplitContainer.FixedPanel not yet implemented")]\r
public void TestFixedPanelNone ()\r
{\r
SplitContainer sc = new SplitContainer ();\r
}\r
\r
[Test]\r
- [Ignore ("SplitContainer.FixedPanel not yet implemented")]\r
public void TestFixedPanel1 ()\r
{\r
SplitContainer sc = new SplitContainer ();\r
}\r
\r
[Test]\r
- [Ignore ("SplitContainer.FixedPanel not yet implemented")]\r
public void TestFixedPanel2 ()\r
{\r
SplitContainer sc = new SplitContainer ();\r
sc.SplitterWidth = 10;\r
Assert.AreEqual (new Rectangle (50, 0, 10, 100), sc.SplitterRectangle, "M2");\r
}\r
+\r
+ [Test]\r
+ public void MethodScaleControl ()\r
+ {\r
+ Form f = new Form ();\r
+\r
+ PublicSplitContainer gb = new PublicSplitContainer ();\r
+ gb.Location = new Point (5, 10);\r
+ f.Controls.Add (gb);\r
+\r
+ Assert.AreEqual (new Rectangle (5, 10, 150, 100), gb.Bounds, "A1");\r
+\r
+ gb.PublicScaleControl (new SizeF (2.0f, 2.0f), BoundsSpecified.All);\r
+ Assert.AreEqual (new Rectangle (10, 20, 300, 200), gb.Bounds, "A2");\r
+\r
+ gb.PublicScaleControl (new SizeF (.5f, .5f), BoundsSpecified.Location);\r
+ Assert.AreEqual (new Rectangle (5, 10, 300, 200), gb.Bounds, "A3");\r
+\r
+ gb.PublicScaleControl (new SizeF (.5f, .5f), BoundsSpecified.Size);\r
+ Assert.AreEqual (new Rectangle (5, 10, 150, 100), gb.Bounds, "A4");\r
+\r
+ gb.PublicScaleControl (new SizeF (3.5f, 3.5f), BoundsSpecified.Size);\r
+ Assert.AreEqual (new Rectangle (5, 10, 525, 350), gb.Bounds, "A5");\r
+\r
+ gb.PublicScaleControl (new SizeF (2.5f, 2.5f), BoundsSpecified.Size);\r
+ Assert.AreEqual (new Rectangle (5, 10, 1312, 875), gb.Bounds, "A6");\r
+\r
+ gb.PublicScaleControl (new SizeF (.2f, .2f), BoundsSpecified.Size);\r
+ Assert.AreEqual (new Rectangle (5, 10, 262, 175), gb.Bounds, "A7");\r
+\r
+ f.Dispose ();\r
+ }\r
+\r
+ [Test]\r
+ public void ControlStyle ()\r
+ {\r
+ PublicSplitContainer epp = new PublicSplitContainer ();\r
+\r
+ ControlStyles cs = ControlStyles.ContainerControl;\r
+ cs |= ControlStyles.UserPaint;\r
+ cs |= ControlStyles.StandardClick;\r
+ cs |= ControlStyles.SupportsTransparentBackColor;\r
+ cs |= ControlStyles.StandardDoubleClick;\r
+ cs |= ControlStyles.Selectable;\r
+ cs |= ControlStyles.OptimizedDoubleBuffer;\r
+ cs |= ControlStyles.UseTextForAccessibility;\r
+\r
+ Assert.AreEqual (cs, epp.GetControlStyles (), "Styles");\r
+ }\r
+\r
+ private class PublicSplitContainer : SplitContainer\r
+ {\r
+ public void PublicScaleControl (SizeF factor, BoundsSpecified specified)\r
+ {\r
+ base.ScaleControl (factor, specified);\r
+ }\r
+\r
+ public ControlStyles GetControlStyles ()\r
+ {\r
+ ControlStyles retval = (ControlStyles)0;\r
+\r
+ foreach (ControlStyles cs in Enum.GetValues (typeof (ControlStyles)))\r
+ if (this.GetStyle (cs) == true)\r
+ retval |= cs;\r
+\r
+ return retval;\r
+ }\r
+ }\r
}\r
}\r
#endif
\ No newline at end of file