2 // ToolStripContainerTests.cs
\r
4 // Permission is hereby granted, free of charge, to any person obtaining
\r
5 // a copy of this software and associated documentation files (the
\r
6 // "Software"), to deal in the Software without restriction, including
\r
7 // without limitation the rights to use, copy, modify, merge, publish,
\r
8 // distribute, sublicense, and/or sell copies of the Software, and to
\r
9 // permit persons to whom the Software is furnished to do so, subject to
\r
10 // the following conditions:
\r
12 // The above copyright notice and this permission notice shall be
\r
13 // included in all copies or substantial portions of the Software.
\r
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
\r
16 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
\r
17 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
\r
18 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
\r
19 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
\r
20 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
\r
21 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
23 // Copyright (c) 2007 Jonathan Pobst
\r
26 // Jonathan Pobst (monkey@jpobst.com)
\r
29 using System.Collections.Generic;
\r
31 using NUnit.Framework;
\r
32 using System.Drawing;
\r
33 using System.Windows.Forms;
\r
35 namespace MonoTests.System.Windows.Forms
\r
38 public class ToolStripContainerTests : TestHelper
\r
41 public void Constructor ()
\r
43 ToolStripContainer tsc = new ToolStripContainer ();
\r
45 Assert.AreEqual ("System.Windows.Forms.ToolStripPanel", tsc.BottomToolStripPanel.ToString (), "A1");
\r
46 Assert.AreEqual (true, tsc.BottomToolStripPanelVisible, "A2");
\r
47 Assert.AreEqual ("System.Windows.Forms.ToolStripContentPanel", tsc.ContentPanel.GetType ().ToString (), "A3");
\r
48 Assert.AreEqual ("System.Windows.Forms.ToolStripPanel", tsc.LeftToolStripPanel.ToString (), "A4");
\r
49 Assert.AreEqual (true, tsc.LeftToolStripPanelVisible, "A5");
\r
50 Assert.AreEqual ("System.Windows.Forms.ToolStripPanel", tsc.RightToolStripPanel.ToString (), "A6");
\r
51 Assert.AreEqual (true, tsc.RightToolStripPanelVisible, "A7");
\r
52 Assert.AreEqual ("System.Windows.Forms.ToolStripPanel", tsc.TopToolStripPanel.ToString (), "A8");
\r
53 Assert.AreEqual (true, tsc.TopToolStripPanelVisible, "A9");
\r
57 public void ProtectedProperties ()
\r
59 ExposeProtectedProperties epp = new ExposeProtectedProperties ();
\r
61 Assert.AreEqual (new Size (150, 175), epp.DefaultSize, "C1");
\r
65 public void PropertyBottomToolStripPanelVisible ()
\r
67 ToolStripContainer tsc = new ToolStripContainer ();
\r
69 tsc.BottomToolStripPanelVisible = false; ;
\r
70 Assert.AreEqual (false, tsc.BottomToolStripPanelVisible, "B1");
\r
74 public void PropertyLeftToolStripPanelVisible ()
\r
76 ToolStripContainer tsc = new ToolStripContainer ();
\r
78 tsc.LeftToolStripPanelVisible = false; ;
\r
79 Assert.AreEqual (false, tsc.LeftToolStripPanelVisible, "B1");
\r
83 public void PropertyRightToolStripPanelVisible ()
\r
85 ToolStripContainer tsc = new ToolStripContainer ();
\r
87 tsc.RightToolStripPanelVisible = false; ;
\r
88 Assert.AreEqual (false, tsc.RightToolStripPanelVisible, "B1");
\r
92 public void PropertyTopToolStripPanelVisible ()
\r
94 ToolStripContainer tsc = new ToolStripContainer ();
\r
96 tsc.TopToolStripPanelVisible = false; ;
\r
97 Assert.AreEqual (false, tsc.TopToolStripPanelVisible, "B1");
\r
101 public void MethodCreateControlsInstance ()
\r
103 ExposeProtectedProperties epp = new ExposeProtectedProperties ();
\r
105 Assert.AreEqual ("System.Windows.Forms.ToolStripContainer+ToolStripContainerTypedControlCollection", epp.CreateControlsInstance (). GetType ().ToString (), "B1");
\r
109 public void ControlStyle ()
\r
111 ExposeProtectedProperties epp = new ExposeProtectedProperties ();
\r
113 ControlStyles cs = ControlStyles.ContainerControl;
\r
114 cs |= ControlStyles.UserPaint;
\r
115 cs |= ControlStyles.StandardClick;
\r
116 cs |= ControlStyles.SupportsTransparentBackColor;
\r
117 cs |= ControlStyles.StandardDoubleClick;
\r
118 cs |= ControlStyles.Selectable;
\r
119 cs |= ControlStyles.ResizeRedraw;
\r
120 cs |= ControlStyles.UseTextForAccessibility;
\r
122 Assert.AreEqual (cs, epp.GetControlStyles (), "Styles");
\r
125 private class ExposeProtectedProperties : ToolStripContainer
\r
127 public new Size DefaultSize { get { return base.DefaultSize; } }
\r
128 public new ControlCollection CreateControlsInstance () { return base.CreateControlsInstance (); }
\r
130 public ControlStyles GetControlStyles ()
\r
132 ControlStyles retval = (ControlStyles)0;
\r
134 foreach (ControlStyles cs in Enum.GetValues (typeof (ControlStyles)))
\r
135 if (this.GetStyle (cs) == true)
\r