In System.Windows.Forms:
[mcs.git] / class / Managed.Windows.Forms / Test / System.Windows.Forms / SplitterTest.cs
blobafa0d944dbde9a7242bd3046f06926a3067c7451
1 using System;
2 using System.Windows.Forms;
3 using NUnit.Framework;
5 namespace MonoTests.System.Windows.Forms
7 [TestFixture]
8 public class SplitterTest
11 /* make sure the Capture setting has nothing to do with SplitPosition (reopened bug #78871) */
12 [Test]
13 public void TestCaptureWhileSettingSplitPosition ()
15 Form f = new Form ();
17 TextBox TextBox1 = new TextBox();
18 TextBox1.Dock = DockStyle.Left;
19 Splitter Splitter = new Splitter();
20 Splitter.Dock = DockStyle.Left;
21 TextBox TextBox2 = new TextBox();
22 TextBox2.Dock = DockStyle.Fill;
23 f.Controls.AddRange(new Control[] { TextBox2, Splitter, TextBox1 });
24 Splitter.Capture = true;
25 Splitter.SplitPosition = (f.ClientSize.Width - Splitter.Width) / 2;
27 int position_with_capture = Splitter.SplitPosition;
29 f.Dispose ();
31 f = new Form ();
33 TextBox1 = new TextBox();
34 TextBox1.Dock = DockStyle.Left;
35 Splitter = new Splitter();
36 Splitter.Dock = DockStyle.Left;
37 TextBox2 = new TextBox();
38 TextBox2.Dock = DockStyle.Fill;
39 f.Controls.AddRange(new Control[] { TextBox2, Splitter, TextBox1 });
40 Splitter.Capture = true;
41 Splitter.SplitPosition = (f.ClientSize.Width - Splitter.Width) / 2;
43 Assert.AreEqual (Splitter.SplitPosition, position_with_capture, "1");