2 // ToolStripSeparatorTests.cs
4 // Permission is hereby granted, free of charge, to any person obtaining
5 // a copy of this software and associated documentation files (the
6 // "Software"), to deal in the Software without restriction, including
7 // without limitation the rights to use, copy, modify, merge, publish,
8 // distribute, sublicense, and/or sell copies of the Software, and to
9 // permit persons to whom the Software is furnished to do so, subject to
10 // the following conditions:
12 // The above copyright notice and this permission notice shall be
13 // included in all copies or substantial portions of the Software.
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 // Copyright (c) 2006 Jonathan Pobst
26 // Jonathan Pobst (monkey@jpobst.com)
30 using System
.Collections
.Generic
;
32 using NUnit
.Framework
;
34 using System
.Windows
.Forms
;
36 namespace MonoTests
.System
.Windows
.Forms
39 public class ToolStripSeparatorTests
42 public void Constructor ()
44 ToolStripSeparator tsi
= new ToolStripSeparator ();
46 Assert
.AreEqual (false, tsi
.CanSelect
, "A1");
50 public void ProtectedProperties ()
52 ExposeProtectedProperties epp
= new ExposeProtectedProperties ();
54 Assert
.AreEqual (new Padding (0), epp
.DefaultMargin
, "C1");
55 Assert
.AreEqual (new Size (6, 6), epp
.DefaultSize
, "C2");
59 public void Accessibility ()
61 ToolStripSeparator tsi
= new ToolStripSeparator ();
62 AccessibleObject ao
= tsi
.AccessibilityObject
;
64 Assert
.AreEqual ("ToolStripItemAccessibleObject: Owner = " + tsi
.ToString (), ao
.ToString (), "L");
65 Assert
.AreEqual (Rectangle
.Empty
, ao
.Bounds
, "L1");
66 Assert
.AreEqual ("Press", ao
.DefaultAction
, "L2");
67 Assert
.AreEqual (null, ao
.Description
, "L3");
68 Assert
.AreEqual (null, ao
.Help
, "L4");
69 Assert
.AreEqual (string.Empty
, ao
.KeyboardShortcut
, "L5");
70 Assert
.AreEqual (string.Empty
, ao
.Name
, "L6");
71 Assert
.AreEqual (null, ao
.Parent
, "L7");
72 Assert
.AreEqual (AccessibleRole
.Separator
, ao
.Role
, "L8");
73 Assert
.AreEqual (AccessibleStates
.None
, ao
.State
, "L9");
74 Assert
.AreEqual (string.Empty
, ao
.Value
, "L10");
77 tsi
.Text
= "Test Label";
78 tsi
.AccessibleDescription
= "Label Desc";
80 Assert
.AreEqual (Rectangle
.Empty
, ao
.Bounds
, "L11");
81 Assert
.AreEqual ("Press", ao
.DefaultAction
, "L12");
82 Assert
.AreEqual ("Label Desc", ao
.Description
, "L13");
83 Assert
.AreEqual (null, ao
.Help
, "L14");
84 Assert
.AreEqual (string.Empty
, ao
.KeyboardShortcut
, "L15");
85 Assert
.AreEqual ("Test Label", ao
.Name
, "L16");
86 Assert
.AreEqual (null, ao
.Parent
, "L17");
87 Assert
.AreEqual (AccessibleRole
.Separator
, ao
.Role
, "L18");
88 Assert
.AreEqual (AccessibleStates
.None
, ao
.State
, "L19");
89 Assert
.AreEqual (string.Empty
, ao
.Value
, "L20");
91 tsi
.AccessibleName
= "Access Label";
92 Assert
.AreEqual ("Access Label", ao
.Name
, "L21");
94 tsi
.Text
= "Test Label";
95 Assert
.AreEqual ("Access Label", ao
.Name
, "L22");
97 tsi
.AccessibleDefaultActionDescription
= "AAA";
98 Assert
.AreEqual ("AAA", tsi
.AccessibleDefaultActionDescription
, "L23");
101 private class ExposeProtectedProperties
: ToolStripSeparator
103 public new Padding DefaultMargin { get { return base.DefaultMargin; }
}
104 public new Size DefaultSize { get { return base.DefaultSize; }
}