diff options
author | Zoltan Varga <vargaz@gmail.com> | 2015-02-27 01:54:40 +0300 |
---|---|---|
committer | Zoltan Varga <vargaz@gmail.com> | 2015-02-27 01:54:40 +0300 |
commit | c38f5406a7d0de8717f5e9a86c6b55c78f9c7b15 (patch) | |
tree | 3b160b537738bc240dbf224da5ebe6e32c8ed3f6 /mcs/class | |
parent | 4c9cd800997e6763abae578630d6db5d0be2c6fa (diff) | |
parent | 9fe095222110a17ac67e4da4a39ae08acb1fa185 (diff) |
Merge pull request #1602 from cdettmering/master
Fixing ToolStripManager.RevertMerge
Diffstat (limited to 'mcs/class')
-rw-r--r-- | mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripManager.cs | 5 | ||||
-rw-r--r-- | mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripManagerTest.cs | 21 |
2 files changed, 22 insertions, 4 deletions
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripManager.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripManager.cs index d85ae420f05..1ef4f318ebc 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripManager.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripManager.cs @@ -354,13 +354,16 @@ namespace System.Windows.Forms public static bool RevertMerge (ToolStrip targetToolStrip) { + if (targetToolStrip == null) + return false; + return RevertMerge (targetToolStrip, targetToolStrip.CurrentlyMergedWith); } public static bool RevertMerge (ToolStrip targetToolStrip, ToolStrip sourceToolStrip) { if (sourceToolStrip == null) - throw new ArgumentNullException ("sourceToolStrip"); + return false; List<ToolStripItem> items_to_move = new List<ToolStripItem> (); diff --git a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripManagerTest.cs b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripManagerTest.cs index c9a11bc9bea..f0f27f37769 100644 --- a/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripManagerTest.cs +++ b/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripManagerTest.cs @@ -578,12 +578,27 @@ namespace MonoTests.System.Windows.Forms }
[Test]
- [ExpectedException (typeof (ArgumentNullException))]
- public void MethodRevertMergeANE ()
+ public void MethodRevertMergeNullArgument1 ()
+ {
+ String ts = null;
+
+ Assert.AreEqual (false, ToolStripManager.RevertMerge (ts), "C1");
+ }
+
+ [Test]
+ public void MethodRevertMergeNullArgument2 ()
+ {
+ ToolStrip ts = null;
+
+ Assert.AreEqual (false, ToolStripManager.RevertMerge (ts), "C2");
+ }
+
+ [Test]
+ public void MethodRevertMergeNullArgument3 ()
{
ToolStrip ts = new ToolStrip ();
- ToolStripManager.RevertMerge (ts, null);
+ Assert.AreEqual (false, ToolStripManager.RevertMerge (ts, null), "C3");
}
[Test]
|