Author: jpobst
Date: 2007-03-25 15:42:48 -0500 (Sun, 25 Mar 2007)
New Revision: 74965
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripComboBox.cs
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ButtonTest.cs
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MenuStripTest.cs
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripComboBoxTest.cs
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripControlHostTest.cs
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripItemTest.cs
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripMenuItemTest.cs
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripProgressBarTest.cs
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripTest.cs
Log:
2007-03-25 Jonathan Pobst <[EMAIL PROTECTED]>
* ToolStripComboBox.cs: Default the ComboBox's FlatStyle to Popup.
2007-03-25 Jonathan Pobst <[EMAIL PROTECTED]>
* ButtonTest.cs: Add test demonstrating the behavior of ImageList.
* MenuStripTest.cs: General test suite.
* ToolStripComboBoxTest.cs: Enable tests for FlatStyle.
* ToolStripControlHostTest.cs: Form.ShowInTaskbar = false.
* ToolStripItemTest.cs: Test for method Dispose.
* ToolStripMenuItemTest.cs: Add tests for constructor and keyboard
shortcuts.
* ToolStripProgressBarTest.cs: Enable previously NotWorking test.
* ToolStripTest.cs: Add tests for Overflow, Dock/Orientation, and
CreateLayoutSettings.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-03-25 19:18:16 UTC (rev 74964)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-03-25 20:42:48 UTC (rev 74965)
@@ -1,3 +1,7 @@
+2007-03-25 Jonathan Pobst <[EMAIL PROTECTED]>
+
+ * ToolStripComboBox.cs: Default the ComboBox's FlatStyle to Popup.
+
2007-03-24 Jonathan Pobst <[EMAIL PROTECTED]>
* Control.cs: Make SetBoundsCore match MS better. The BoundsSpecified
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripComboBox.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripComboBox.cs
2007-03-25 19:18:16 UTC (rev 74964)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripComboBox.cs
2007-03-25 20:42:48 UTC (rev 74965)
@@ -382,6 +382,7 @@
public ToolStripComboBoxControl () : base ()
{
this.border_style = BorderStyle.None;
+ this.FlatStyle = FlatStyle.Popup;
}
}
}
Modified:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ButtonTest.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ButtonTest.cs
2007-03-25 19:18:16 UTC (rev 74964)
+++
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ButtonTest.cs
2007-03-25 20:42:48 UTC (rev 74965)
@@ -56,6 +56,58 @@
flatApp.BorderSize = -1;
}
+
+ [Test]
+ [Ignore ("Needs a bugfix in libgdiplus, #80842")]
+ public void BehaviorImageList ()
+ {
+ // Basically, this shows that whichever of
[Image|ImageIndex|ImageKey]
+ // is set last resets the others to their default state
+ Button b = new Button ();
+
+ Bitmap i1 = new Bitmap (16, 4);
+ i1.SetPixel (0, 0, Color.Blue);
+ Bitmap i2 = new Bitmap (16, 5);
+ i2.SetPixel (0, 0, Color.Red);
+ Bitmap i3 = new Bitmap (16, 6);
+ i3.SetPixel (0, 0, Color.Green);
+
+ Assert.AreEqual (null, b.Image, "D1");
+ Assert.AreEqual (-1, b.ImageIndex, "D2");
+ Assert.AreEqual (string.Empty, b.ImageKey, "D3");
+
+ ImageList il = new ImageList ();
+ il.Images.Add ("i2", i2);
+ il.Images.Add ("i3", i3);
+
+ b.ImageList = il;
+
+ b.ImageKey = "i3";
+ Assert.AreEqual (-1, b.ImageIndex, "D4");
+ Assert.AreEqual ("i3", b.ImageKey, "D5");
+ Assert.AreEqual (i3.GetPixel (0, 0), (b.Image as
Bitmap).GetPixel (0, 0), "D6");
+
+ b.ImageIndex = 0;
+ Assert.AreEqual (0, b.ImageIndex, "D7");
+ Assert.AreEqual (string.Empty, b.ImageKey, "D8");
+ Assert.AreEqual (i2.GetPixel (0, 0), (b.Image as
Bitmap).GetPixel (0, 0), "D9");
+
+ // Also, Image is not cached, changing the underlying
ImageList image is reflected
+ il.Images[0] = i1;
+ Assert.AreEqual (i1.GetPixel (0, 0), (b.Image as
Bitmap).GetPixel (0, 0), "D16");
+
+ // Note: setting Image resets ImageList to null
+ b.Image = i1;
+ Assert.AreEqual (-1, b.ImageIndex, "D10");
+ Assert.AreEqual (string.Empty, b.ImageKey, "D11");
+ Assert.AreEqual (i1.GetPixel (0, 0), (b.Image as
Bitmap).GetPixel (0, 0), "D12");
+ Assert.AreEqual (null, b.ImageList, "D12-2");
+
+ b.Image = null;
+ Assert.AreEqual (null, b.Image, "D13");
+ Assert.AreEqual (-1, b.ImageIndex, "D14");
+ Assert.AreEqual (string.Empty, b.ImageKey, "D15");
+ }
#endif
[Test]
public void ImageTest ()
Modified:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
2007-03-25 19:18:16 UTC (rev 74964)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
2007-03-25 20:42:48 UTC (rev 74965)
@@ -1,3 +1,15 @@
+2007-03-25 Jonathan Pobst <[EMAIL PROTECTED]>
+
+ * ButtonTest.cs: Add test demonstrating the behavior of ImageList.
+ * MenuStripTest.cs: General test suite.
+ * ToolStripComboBoxTest.cs: Enable tests for FlatStyle.
+ * ToolStripControlHostTest.cs: Form.ShowInTaskbar = false.
+ * ToolStripItemTest.cs: Test for method Dispose.
+ * ToolStripMenuItemTest.cs: Add tests for constructor and keyboard
shortcuts.
+ * ToolStripProgressBarTest.cs: Enable previously NotWorking test.
+ * ToolStripTest.cs: Add tests for Overflow, Dock/Orientation, and
+ CreateLayoutSettings.
+
2007-03-24 Jonathan Pobst <[EMAIL PROTECTED]>
* DefaultLayoutTest.cs: Enable some NotWorking tests that now
Modified:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MenuStripTest.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MenuStripTest.cs
2007-03-25 19:18:16 UTC (rev 74964)
+++
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/MenuStripTest.cs
2007-03-25 20:42:48 UTC (rev 74965)
@@ -40,9 +40,96 @@
public class MenuStripTest
{
[Test]
+ public void Constructor ()
+ {
+ MenuStrip ms = new MenuStrip ();
+
+ Assert.AreEqual (false, ms.CanOverflow, "A1");
+ Assert.AreEqual (ToolStripGripStyle.Hidden,
ms.GripStyle, "A2");
+ Assert.AreEqual (null, ms.MdiWindowListItem, "A3");
+ Assert.AreEqual (false, ms.ShowItemToolTips, "A4");
+ Assert.AreEqual (true, ms.Stretch, "A5");
+ Assert.AreEqual
(ToolStripLayoutStyle.HorizontalStackWithOverflow, ms.LayoutStyle, "A6");
+ }
+
+ [Test]
+ public void ControlStyle ()
+ {
+ ExposeProtectedProperties epp = new
ExposeProtectedProperties ();
+
+ ControlStyles cs = ControlStyles.ContainerControl;
+ cs |= ControlStyles.UserPaint;
+ cs |= ControlStyles.StandardClick;
+ cs |= ControlStyles.SupportsTransparentBackColor;
+ cs |= ControlStyles.StandardDoubleClick;
+ cs |= ControlStyles.AllPaintingInWmPaint;
+ cs |= ControlStyles.OptimizedDoubleBuffer;
+ cs |= ControlStyles.UseTextForAccessibility;
+
+ Assert.AreEqual (cs, epp.GetControlStyles (), "Styles");
+ }
+
+ [Test]
+ public void ProtectedProperties ()
+ {
+ ExposeProtectedProperties epp = new
ExposeProtectedProperties ();
+
+ Assert.AreEqual (new Padding (2, 2, 0, 2),
epp.DefaultGripMargin, "C1");
+ Assert.AreEqual (new Padding (6, 2, 0, 2),
epp.DefaultPadding, "C2");
+ Assert.AreEqual (false, epp.DefaultShowItemToolTips,
"C3");
+ Assert.AreEqual (new Size (200, 24), epp.DefaultSize,
"C4");
+ }
+
+ [Test]
+ public void PropertyCanOverflow ()
+ {
+ StatusStrip ts = new StatusStrip ();
+
+ ts.CanOverflow = true;
+ Assert.AreEqual (true, ts.CanOverflow, "B1");
+ }
+
+ [Test]
+ public void PropertyGripStyle ()
+ {
+ StatusStrip ts = new StatusStrip ();
+
+ ts.GripStyle = ToolStripGripStyle.Visible;
+ Assert.AreEqual (ToolStripGripStyle.Visible,
ts.GripStyle, "B1");
+ }
+
+ [Test]
+ [ExpectedException (typeof (InvalidEnumArgumentException))]
+ public void PropertyGripStyleIEAE ()
+ {
+ StatusStrip ts = new StatusStrip ();
+
+ ts.GripStyle = (ToolStripGripStyle)42;
+ }
+
+ [Test]
+ public void PropertyShowItemToolTips ()
+ {
+ StatusStrip ts = new StatusStrip ();
+
+ ts.ShowItemToolTips = true;
+ Assert.AreEqual (true, ts.ShowItemToolTips, "B1");
+ }
+
+ [Test]
+ public void PropertyStretch ()
+ {
+ StatusStrip ts = new StatusStrip ();
+
+ ts.Stretch = false;
+ Assert.AreEqual (false, ts.Stretch, "B1");
+ }
+
+ [Test]
public void BehaviorMdiWindowMenuItem ()
{
Form f = new Form ();
+ f.ShowInTaskbar = false;
f.IsMdiContainer = true;
Form c1 = new Form ();
c1.MdiParent = f;
@@ -92,6 +179,25 @@
Assert.AreEqual (5, tsmi.DropDownItems.Count, "Q14");
Assert.AreEqual (true, (tsmi.DropDownItems[4] as
ToolStripMenuItem).Checked, "Q15");
}
+
+ private class ExposeProtectedProperties : MenuStrip
+ {
+ public new Padding DefaultGripMargin { get { return
base.DefaultGripMargin; } }
+ public new Padding DefaultPadding { get { return
base.DefaultPadding; } }
+ public new bool DefaultShowItemToolTips { get { return
base.DefaultShowItemToolTips; } }
+ public new Size DefaultSize { get { return
base.DefaultSize; } }
+
+ public ControlStyles GetControlStyles ()
+ {
+ ControlStyles retval = (ControlStyles)0;
+
+ foreach (ControlStyles cs in Enum.GetValues
(typeof (ControlStyles)))
+ if (this.GetStyle (cs) == true)
+ retval |= cs;
+
+ return retval;
+ }
+ }
}
}
#endif
Modified:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripComboBoxTest.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripComboBoxTest.cs
2007-03-25 19:18:16 UTC (rev 74964)
+++
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripComboBoxTest.cs
2007-03-25 20:42:48 UTC (rev 74965)
@@ -51,7 +51,7 @@
Assert.AreEqual (ComboBoxStyle.DropDown,
tsi.DropDownStyle, "A6");
Assert.AreEqual (121, tsi.DropDownWidth, "A7");
Assert.AreEqual (false, tsi.DroppedDown, "A8");
- //Assert.AreEqual (FlatStyle.Popup, tsi.FlatStyle,
"A9");
+ Assert.AreEqual (FlatStyle.Popup, tsi.FlatStyle, "A9");
Assert.AreEqual (true, tsi.IntegralHeight, "A10");
Assert.AreEqual
("System.Windows.Forms.ComboBox+ObjectCollection", tsi.Items.ToString (),
"A11");
Assert.AreEqual (8, tsi.MaxDropDownItems, "A12");
@@ -163,20 +163,20 @@
Assert.AreEqual (string.Empty, ew.ToString (), "B3");
}
- //[Test]
- //public void PropertyFlatStyle ()
- //{
- // ToolStripComboBox tsi = new ToolStripComboBox ();
- // EventWatcher ew = new EventWatcher (tsi);
+ [Test]
+ public void PropertyFlatStyle ()
+ {
+ ToolStripComboBox tsi = new ToolStripComboBox ();
+ EventWatcher ew = new EventWatcher (tsi);
- // tsi.FlatStyle = FlatStyle.System;
- // Assert.AreEqual (FlatStyle.System, tsi.FlatStyle,
"B1");
- // Assert.AreEqual (string.Empty, ew.ToString (), "B2");
+ tsi.FlatStyle = FlatStyle.System;
+ Assert.AreEqual (FlatStyle.System, tsi.FlatStyle, "B1");
+ Assert.AreEqual (string.Empty, ew.ToString (), "B2");
- // ew.Clear ();
- // tsi.FlatStyle = FlatStyle.System;
- // Assert.AreEqual (string.Empty, ew.ToString (), "B3");
- //}
+ ew.Clear ();
+ tsi.FlatStyle = FlatStyle.System;
+ Assert.AreEqual (string.Empty, ew.ToString (), "B3");
+ }
[Test]
public void PropertyIntegralHeight ()
Modified:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripControlHostTest.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripControlHostTest.cs
2007-03-25 19:18:16 UTC (rev 74964)
+++
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripControlHostTest.cs
2007-03-25 20:42:48 UTC (rev 74965)
@@ -424,6 +424,7 @@
Assert.AreEqual (new Size (100, 50), tsi.Size, "H8");
Form f = new Form ();
+ f.ShowInTaskbar = false;
f.Controls.Add (ts);
ts.Items.Add (tsi);
f.Show ();
Modified:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripItemTest.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripItemTest.cs
2007-03-25 19:18:16 UTC (rev 74964)
+++
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripItemTest.cs
2007-03-25 20:42:48 UTC (rev 74965)
@@ -112,7 +112,7 @@
Assert.AreEqual (2, count, "A55");
Assert.AreEqual ("MyName", tsi.Name, "A56");
}
-
+
[Test]
public void ProtectedProperties ()
{
@@ -744,6 +744,20 @@
Assert.AreEqual (string.Empty, ew.ToString (), "B3");
}
+ [Test]
+ public void MethodDispose ()
+ {
+ ToolStrip ts = new ToolStrip ();
+ NullToolStripItem tsi = new NullToolStripItem ();
+
+ ts.Items.Add (tsi);
+
+ Assert.AreEqual (false, tsi.IsDisposed, "A1");
+
+ tsi.Dispose ();
+ Assert.AreEqual (true, tsi.IsDisposed, "A2");
+ }
+
//[Test]
//public void PropertyAnchorAndDocking ()
//{
Modified:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripMenuItemTest.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripMenuItemTest.cs
2007-03-25 19:18:16 UTC (rev 74964)
+++
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripMenuItemTest.cs
2007-03-25 20:42:48 UTC (rev 74965)
@@ -40,9 +40,86 @@
public class ToolStripMenuItemTest
{
[Test]
+ public void Constructor ()
+ {
+ ToolStripMenuItem tsi = new ToolStripMenuItem ();
+
+ Assert.AreEqual (false, tsi.Checked, "A1");
+ Assert.AreEqual (false, tsi.CheckOnClick, "A2");
+ Assert.AreEqual (CheckState.Unchecked, tsi.CheckState,
"A3");
+ Assert.AreEqual (true, tsi.Enabled, "A4");
+ Assert.AreEqual (false, tsi.IsMdiWindowListEntry, "A5");
+ Assert.AreEqual (ToolStripItemOverflow.Never,
tsi.Overflow, "A6");
+ Assert.AreEqual (null, tsi.ShortcutKeyDisplayString,
"A7");
+ Assert.AreEqual (Keys.None, tsi.ShortcutKeys, "A8");
+ Assert.AreEqual (true, tsi.ShowShortcutKeys, "A9");
+
+
+ int count = 0;
+ EventHandler oc = new EventHandler (delegate (object
sender, EventArgs e) { count++; });
+ Image i = new Bitmap (1, 1);
+
+ tsi = new ToolStripMenuItem (i);
+ tsi.PerformClick ();
+ Assert.AreEqual (null, tsi.Text, "A10-1");
+ Assert.AreSame (i, tsi.Image, "A10-2");
+ Assert.AreEqual (0, count, "A10-3");
+ Assert.AreEqual (string.Empty, tsi.Name, "A10-4");
+
+ tsi = new ToolStripMenuItem ("Text");
+ tsi.PerformClick ();
+ Assert.AreEqual ("Text", tsi.Text, "A10-5");
+ Assert.AreSame (null, tsi.Image, "A11");
+ Assert.AreEqual (0, count, "A12");
+ Assert.AreEqual (string.Empty, tsi.Name, "A13");
+
+ tsi = new ToolStripMenuItem ("Text", i);
+ tsi.PerformClick ();
+ Assert.AreEqual ("Text", tsi.Text, "A14");
+ Assert.AreSame (i, tsi.Image, "A15");
+ Assert.AreEqual (0, count, "A16");
+ Assert.AreEqual (string.Empty, tsi.Name, "A17");
+
+ tsi = new ToolStripMenuItem ("Text", i, oc);
+ tsi.PerformClick ();
+ Assert.AreEqual ("Text", tsi.Text, "A18");
+ Assert.AreSame (i, tsi.Image, "A19");
+ Assert.AreEqual (1, count, "A20");
+ Assert.AreEqual (string.Empty, tsi.Name, "A21");
+
+ tsi = new ToolStripMenuItem ("Text", i, oc, "Name");
+ tsi.PerformClick ();
+ Assert.AreEqual ("Text", tsi.Text, "A22");
+ Assert.AreSame (i, tsi.Image, "A23");
+ Assert.AreEqual (2, count, "A24");
+ Assert.AreEqual ("Name", tsi.Name, "A25");
+ }
+
+ [Test]
+ public void BehaviorKeyboardShortcuts ()
+ {
+ ExposeProtectedMethods tsmi = new
ExposeProtectedMethods ();
+ tsmi.ShortcutKeys = Keys.Control | Keys.D;
+
+ Message m = new Message ();
+ Assert.AreEqual (false, tsmi.PublicProcessCmdKey (ref
m, Keys.D), "A1");
+ Assert.AreEqual (false, tsmi.PublicProcessCmdKey (ref
m, Keys.Control), "A2");
+ Assert.AreEqual (true, tsmi.PublicProcessCmdKey (ref m,
Keys.Control | Keys.D), "A3");
+ Assert.AreEqual (false, tsmi.PublicProcessCmdKey (ref
m, Keys.A), "A4");
+ Assert.AreEqual (false, tsmi.PublicProcessCmdKey (ref
m, Keys.Control | Keys.A), "A5");
+
+ tsmi.ShowShortcutKeys = false;
+ Assert.AreEqual (true, tsmi.PublicProcessCmdKey (ref m,
Keys.Control | Keys.D), "A6");
+
+ tsmi.ShortcutKeyDisplayString = "Moose";
+ Assert.AreEqual (true, tsmi.PublicProcessCmdKey (ref m,
Keys.Control | Keys.D), "A7");
+ }
+
+ [Test]
public void BehaviorMdiWindowMenuItem ()
{
Form f = new Form ();
+ f.ShowInTaskbar = false;
f.IsMdiContainer = true;
Form c1 = new Form ();
c1.MdiParent = f;
@@ -60,6 +137,36 @@
f.Show ();
Assert.AreEqual (true, (tsmi.DropDownItems[0] as
ToolStripMenuItem).IsMdiWindowListEntry, "R1");
}
+
+ [Test]
+ public void BehaviorShortcutText ()
+ {
+ ToolStripMenuItem tsmi = new ToolStripMenuItem ();
+
+ tsmi.ShortcutKeys = Keys.Control | Keys.O;
+
+ Assert.AreEqual (null, tsmi.ShortcutKeyDisplayString,
"A1");
+
+ tsmi.ShortcutKeyDisplayString = "Test String";
+ Assert.AreEqual ("Test String",
tsmi.ShortcutKeyDisplayString, "A2");
+
+ tsmi.ShortcutKeys = Keys.Control | Keys.P;
+ Assert.AreEqual ("Test String",
tsmi.ShortcutKeyDisplayString, "A3");
+
+ tsmi.ShortcutKeyDisplayString = string.Empty;
+ Assert.AreEqual (string.Empty,
tsmi.ShortcutKeyDisplayString, "A4");
+
+ tsmi.ShortcutKeyDisplayString = null;
+ Assert.AreEqual (null, tsmi.ShortcutKeyDisplayString,
"A5");
+ }
+
+ private class ExposeProtectedMethods : ToolStripMenuItem
+ {
+ public bool PublicProcessCmdKey (ref Message m, Keys
keys)
+ {
+ return this.ProcessCmdKey (ref m, keys);
+ }
+ }
}
}
#endif
\ No newline at end of file
Modified:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripProgressBarTest.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripProgressBarTest.cs
2007-03-25 19:18:16 UTC (rev 74964)
+++
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripProgressBarTest.cs
2007-03-25 20:42:48 UTC (rev 74965)
@@ -191,7 +191,6 @@
}
[Test]
- [Ignore ("ProgressBar throws AE, not AOORE")]
[ExpectedException (typeof (ArgumentOutOfRangeException))]
public void PropertyValueAOORE ()
{
Modified:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripTest.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripTest.cs
2007-03-25 19:18:16 UTC (rev 74964)
+++
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripTest.cs
2007-03-25 20:42:48 UTC (rev 74965)
@@ -554,6 +554,85 @@
//}
[Test]
+ public void BehaviorDisplayRectangleAndOverflow ()
+ {
+ Form f = new Form ();
+ f.ShowInTaskbar = false;
+ ToolStrip ts = new ToolStrip ();
+ f.Controls.Add (ts);
+ f.Show ();
+
+ Assert.AreEqual (false, ts.OverflowButton.Visible,
"D1");
+ Assert.AreEqual (new Rectangle (7, 0, 284, 25),
ts.DisplayRectangle, "D2");
+
+ ts.Items.Add (new ToolStripButton ("hello11111111111"));
+ ts.Items.Add (new ToolStripButton ("hello11111111111"));
+ ts.Items.Add (new ToolStripButton ("hello11111111111"));
+ ts.Items.Add (new ToolStripButton ("hello11111111111"));
+ ts.Items.Add (new ToolStripButton ("hello11111111111"));
+ ts.Items.Add (new ToolStripButton ("hello11111111111"));
+
+ Assert.AreEqual (true, ts.OverflowButton.Visible, "D3");
+ Assert.AreEqual (new Rectangle (7, 0, 284, 25),
ts.DisplayRectangle, "D4");
+ f.Dispose ();
+ }
+
+ [Test]
+ public void BehaviorGripAndOverflowWithFlowLayout ()
+ {
+ ToolStrip ts = new ToolStrip ();
+ ts.LayoutStyle = ToolStripLayoutStyle.Flow;
+
+ Assert.AreEqual (ToolStripGripStyle.Visible,
ts.GripStyle, "A1");
+ Assert.AreEqual (false, ts.OverflowButton.Visible,
"A2");
+ Assert.AreEqual
("System.Windows.Forms.Layout.FlowLayout", ts.LayoutEngine.ToString (), "A3");
+ }
+
+ [Test]
+ public void BehaviorDockAndOrientation ()
+ {
+ Form f = new Form ();
+ f.ShowInTaskbar = false;
+
+ ToolStrip ts = new ToolStrip ();
+ ts.Dock = DockStyle.Left;
+
+ f.Controls.Add (ts);
+ f.Show ();
+
+ Assert.AreEqual
(ToolStripLayoutStyle.VerticalStackWithOverflow, ts.LayoutStyle, "A1");
+ Assert.AreEqual (Orientation.Vertical, ts.Orientation,
"A2");
+
+ ts.LayoutStyle = ToolStripLayoutStyle.StackWithOverflow;
+ Assert.AreEqual
(ToolStripLayoutStyle.VerticalStackWithOverflow, ts.LayoutStyle, "A3");
+ Assert.AreEqual (Orientation.Vertical, ts.Orientation,
"A4");
+
+ ts.LayoutStyle =
ToolStripLayoutStyle.HorizontalStackWithOverflow;
+ Assert.AreEqual
(ToolStripLayoutStyle.HorizontalStackWithOverflow, ts.LayoutStyle, "A5");
+ Assert.AreEqual (Orientation.Horizontal,
ts.Orientation, "A6");
+
+ ts.LayoutStyle = ToolStripLayoutStyle.Flow;
+ Assert.AreEqual (ToolStripLayoutStyle.Flow,
ts.LayoutStyle, "A7");
+ Assert.AreEqual (Orientation.Horizontal,
ts.Orientation, "A8");
+
+ ts.LayoutStyle = ToolStripLayoutStyle.StackWithOverflow;
+ Assert.AreEqual
(ToolStripLayoutStyle.VerticalStackWithOverflow, ts.LayoutStyle, "A9");
+ Assert.AreEqual (Orientation.Vertical, ts.Orientation,
"A10");
+ }
+
+ [Test]
+ public void MethodCreateLayoutSettings ()
+ {
+ ExposeProtectedProperties ts = new
ExposeProtectedProperties ();
+
+ Assert.AreEqual
("System.Windows.Forms.FlowLayoutSettings", ts.PublicCreateLayoutSettings
(ToolStripLayoutStyle.Flow).ToString (), "A1");
+ Assert.AreEqual (null, ts.PublicCreateLayoutSettings
(ToolStripLayoutStyle.HorizontalStackWithOverflow), "A2");
+ Assert.AreEqual (null, ts.PublicCreateLayoutSettings
(ToolStripLayoutStyle.StackWithOverflow), "A3");
+ //Assert.AreEqual
("System.Windows.Forms.TableLayoutSettings", ts.PublicCreateLayoutSettings
(ToolStripLayoutStyle.Table).ToString (), "A4");
+ Assert.AreEqual (null, ts.PublicCreateLayoutSettings
(ToolStripLayoutStyle.VerticalStackWithOverflow), "A5");
+ }
+
+ [Test]
public void TestToolStrip ()
{
ToolStrip ts = new ToolStrip ();
@@ -676,6 +755,8 @@
return retval;
}
+
+ public LayoutSettings PublicCreateLayoutSettings
(ToolStripLayoutStyle layoutStyle) { return base.CreateLayoutSettings
(layoutStyle); }
}
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches