Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Dettmering <chad.dettmering@gmail.com>2015-02-27 01:31:49 +0300
committerChad Dettmering <chad.dettmering@gmail.com>2015-02-27 01:31:49 +0300
commit2550e73081f8d9ab3fb56df4314f4253cbfb1e86 (patch)
tree694e612a0fb0885b50c6daae5fa6e23f057fc12b /mcs/class/Managed.Windows.Forms
parent6f14f86357a962f649d558526560015a6ecf59a0 (diff)
Changed System.Windows.Forms.ToolStripManager.RevertMerge to return
false when given a null argument instead of throwing an exception. According to the msdn here: https://msdn.microsoft.com/en-us/library/b4e35dwy%28v=vs.110%29.aspx this method should never throw an exception. This was also confirmed with the official Microsoft runtime. This change is released under the MIT license.
Diffstat (limited to 'mcs/class/Managed.Windows.Forms')
-rw-r--r--mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripManager.cs5
-rw-r--r--mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ToolStripManagerTest.cs21
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..760ace67be3 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..626930d497b 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]