From: Sebastien Pouliot Date: Tue, 19 Sep 2006 13:39:02 +0000 (-0000) Subject: 2006-09-19 Sebastien Pouliot X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=d9786f7fe7570b25cf30ac8b175d5088c873ea89;p=mono.git 2006-09-19 Sebastien Pouliot * GDIPlusTest.cs: Added test cases for GdipMeasureCharacterRanges and StringFormat functions. * TestStringFormat.cs: Increased coverage of the unit tests. svn path=/trunk/mcs/; revision=65641 --- diff --git a/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog b/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog index 5be73583e77..893c2aa0095 100644 --- a/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog +++ b/mcs/class/System.Drawing/Test/System.Drawing/ChangeLog @@ -1,3 +1,9 @@ +2006-09-19 Sebastien Pouliot + + * GDIPlusTest.cs: Added test cases for GdipMeasureCharacterRanges and + StringFormat functions. + * TestStringFormat.cs: Increased coverage of the unit tests. + 2006-09-18 Sebastien Pouliot * TestGraphics.cs: Add test cases for MeasureString and diff --git a/mcs/class/System.Drawing/Test/System.Drawing/GDIPlusTest.cs b/mcs/class/System.Drawing/Test/System.Drawing/GDIPlusTest.cs index 3eff8f0a776..dfbba65f93e 100644 --- a/mcs/class/System.Drawing/Test/System.Drawing/GDIPlusTest.cs +++ b/mcs/class/System.Drawing/Test/System.Drawing/GDIPlusTest.cs @@ -30,6 +30,7 @@ using System; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; +using System.Drawing.Text; using System.Runtime.InteropServices; using NUnit.Framework; @@ -190,7 +191,6 @@ namespace MonoTests.System.Drawing { Assert.AreEqual (Status.Ok, GDIPlus.GdipGetImageGraphicsContext (image, out graphics), "GdipGetImageGraphicsContext"); Assert.IsTrue (graphics != IntPtr.Zero, "graphics"); - Assert.AreEqual (Status.Ok, GDIPlus.GdipDeleteGraphics (graphics), "GdipDeleteGraphics"); Assert.AreEqual (Status.InvalidParameter, GDIPlus.GdipDeleteGraphics (IntPtr.Zero), "GdipDeleteGraphics-null"); @@ -198,6 +198,46 @@ namespace MonoTests.System.Drawing { Assert.AreEqual (Status.Ok, GDIPlus.GdipDisposeImage (image), "GdipDisposeImage"); } + [Test] + public void MeasureCharacterRanges () + { + IntPtr image; + GDIPlus.GdipCreateBitmapFromScan0 (10, 10, 0, PixelFormat.Format32bppArgb, IntPtr.Zero, out image); + Assert.IsTrue (image != IntPtr.Zero, "image"); + + IntPtr graphics; + Assert.AreEqual (Status.Ok, GDIPlus.GdipGetImageGraphicsContext (image, out graphics), "GdipGetImageGraphicsContext"); + Assert.IsTrue (graphics != IntPtr.Zero, "graphics"); + + IntPtr family; + GDIPlus.GdipCreateFontFamilyFromName ("Arial", IntPtr.Zero, out family); + if (family == IntPtr.Zero) + Assert.Ignore ("Arial isn't available on this platform"); + + IntPtr font; + Assert.AreEqual (Status.Ok, GDIPlus.GdipCreateFont (family, 10f, FontStyle.Regular, GraphicsUnit.Point, out font), "GdipCreateFont"); + Assert.IsTrue (font != IntPtr.Zero, "font"); + + RectangleF layout = new RectangleF (); + IntPtr[] regions = new IntPtr[1]; + IntPtr format; + Assert.AreEqual (Status.Ok, GDIPlus.GdipStringFormatGetGenericDefault (out format), "GdipStringFormatGetGenericDefault"); + + Assert.AreEqual (Status.InvalidParameter, GDIPlus.GdipMeasureCharacterRanges (IntPtr.Zero, "a", 1, font, ref layout, format, 1, out regions[0]), "GdipMeasureCharacterRanges-null"); + Assert.AreEqual (Status.InvalidParameter, GDIPlus.GdipMeasureCharacterRanges (graphics, null, 0, font, ref layout, format, 1, out regions[0]), "GdipMeasureCharacterRanges-null string"); + + int count; + Assert.AreEqual (Status.Ok, GDIPlus.GdipGetStringFormatMeasurableCharacterRangeCount (format, out count), "GdipGetStringFormatMeasurableCharacterRangeCount"); + Assert.AreEqual (0, count, "count"); + Assert.AreEqual (Status.Ok, GDIPlus.GdipMeasureCharacterRanges (graphics, "a", 1, font, ref layout, format, 1, out regions[0]), "GdipMeasureCharacterRanges"); + + Assert.AreEqual (Status.Ok, GDIPlus.GdipDeleteStringFormat (format), "GdipDeleteStringFormat"); + Assert.AreEqual (Status.Ok, GDIPlus.GdipDeleteGraphics (graphics), "GdipDeleteGraphics"); + Assert.AreEqual (Status.Ok, GDIPlus.GdipDeleteFont (font), "GdipDeleteFont"); + Assert.AreEqual (Status.Ok, GDIPlus.GdipDeleteFontFamily (family), "GdipDeleteFontFamily"); + Assert.AreEqual (Status.Ok, GDIPlus.GdipDisposeImage (image), "GdipDisposeImage"); + } + // GraphicsPath [Test] public void GetPointCount_Zero () @@ -861,6 +901,96 @@ namespace MonoTests.System.Drawing { GDIPlus.GdipDisposeImage (image); } + // StringFormat + private void CheckStringFormat (IntPtr sf, StringFormatFlags exepcted_flags, StringTrimming expected_trimmings) + { + StringAlignment sa = StringAlignment.Center; + Assert.AreEqual (Status.InvalidParameter, GDIPlus.GdipGetStringFormatAlign (IntPtr.Zero, out sa), "GdipGetStringFormatAlign-null"); + Assert.AreEqual (Status.Ok, GDIPlus.GdipGetStringFormatAlign (sf, out sa), "GdipGetStringFormatAlign"); + Assert.AreEqual (StringAlignment.Near, sa, "StringAlignment-1"); + + StringAlignment la = StringAlignment.Center; + Assert.AreEqual (Status.InvalidParameter, GDIPlus.GdipGetStringFormatLineAlign (IntPtr.Zero, out la), "GdipGetStringFormatLineAlign-null"); + Assert.AreEqual (Status.Ok, GDIPlus.GdipGetStringFormatLineAlign (sf, out la), "GdipGetStringFormatLineAlign"); + Assert.AreEqual (StringAlignment.Near, la, "StringAlignment-2"); + + StringFormatFlags flags = StringFormatFlags.DirectionRightToLeft; + Assert.AreEqual (Status.InvalidParameter, GDIPlus.GdipGetStringFormatFlags (IntPtr.Zero, out flags), "GdipGetStringFormatFlags-null"); + Assert.AreEqual (Status.Ok, GDIPlus.GdipGetStringFormatFlags (sf, out flags), "GdipGetStringFormatFlags"); + Assert.AreEqual (exepcted_flags, flags, "StringFormatFlags"); + + HotkeyPrefix hotkey = HotkeyPrefix.Show; + Assert.AreEqual (Status.InvalidParameter, GDIPlus.GdipGetStringFormatHotkeyPrefix (IntPtr.Zero, out hotkey), "GdipGetStringFormatHotkeyPrefix-null"); + Assert.AreEqual (Status.Ok, GDIPlus.GdipGetStringFormatHotkeyPrefix (sf, out hotkey), "GdipGetStringFormatHotkeyPrefix"); + Assert.AreEqual (HotkeyPrefix.None, hotkey, "HotkeyPrefix"); + + StringTrimming trimming = StringTrimming.None; + Assert.AreEqual (Status.InvalidParameter, GDIPlus.GdipGetStringFormatTrimming (IntPtr.Zero, out trimming), "GdipGetStringFormatTrimming-null"); + Assert.AreEqual (Status.Ok, GDIPlus.GdipGetStringFormatTrimming (sf, out trimming), "GdipGetStringFormatTrimming"); + Assert.AreEqual (expected_trimmings, trimming, "StringTrimming"); + + StringDigitSubstitute sub = StringDigitSubstitute.Traditional; + Assert.AreEqual (Status.InvalidParameter, GDIPlus.GdipGetStringFormatDigitSubstitution (IntPtr.Zero, 0, out sub), "GdipGetStringFormatDigitSubstitution-null"); + Assert.AreEqual (Status.Ok, GDIPlus.GdipGetStringFormatDigitSubstitution (sf, 0, out sub), "GdipGetStringFormatDigitSubstitution"); + Assert.AreEqual (StringDigitSubstitute.User, sub, "StringDigitSubstitute"); + + int count; + Assert.AreEqual (Status.InvalidParameter, GDIPlus.GdipGetStringFormatMeasurableCharacterRangeCount (IntPtr.Zero, out count), "GdipGetStringFormatMeasurableCharacterRangeCount-null"); + Assert.AreEqual (Status.Ok, GDIPlus.GdipGetStringFormatMeasurableCharacterRangeCount (sf, out count), "GdipGetStringFormatMeasurableCharacterRangeCount"); + Assert.AreEqual (0, count, "count"); + } + + [Test] + public void StringFormat () + { + IntPtr sf; + Assert.AreEqual (Status.Ok, GDIPlus.GdipCreateStringFormat (Int32.MinValue, Int32.MinValue, out sf), "GdipCreateStringFormat"); + + CheckStringFormat (sf, (StringFormatFlags) Int32.MinValue, StringTrimming.Character); + + Assert.AreEqual (Status.InvalidParameter, GDIPlus.GdipDeleteStringFormat (IntPtr.Zero), "GdipDeleteStringFormat-null"); + Assert.AreEqual (Status.Ok, GDIPlus.GdipDeleteStringFormat (sf), "GdipDeleteStringFormat"); + } + + [Test] + public void StringFormat_Clone () + { + IntPtr sf; + Assert.AreEqual (Status.Ok, GDIPlus.GdipCreateStringFormat (Int32.MinValue, Int32.MinValue, out sf), "GdipCreateStringFormat"); + + IntPtr clone; + Assert.AreEqual (Status.InvalidParameter, GDIPlus.GdipCloneStringFormat (IntPtr.Zero, out clone), "GdipCloneStringFormat"); + Assert.AreEqual (Status.Ok, GDIPlus.GdipCloneStringFormat (sf, out clone), "GdipCloneStringFormat"); + + CheckStringFormat (clone, (StringFormatFlags) Int32.MinValue, StringTrimming.Character); + + Assert.AreEqual (Status.Ok, GDIPlus.GdipDeleteStringFormat (clone), "GdipDeleteStringFormat-clone"); + Assert.AreEqual (Status.Ok, GDIPlus.GdipDeleteStringFormat (sf), "GdipDeleteStringFormat"); + } + + [Test] + public void StringFormat_GenericDefault () + { + IntPtr sf; + Assert.AreEqual (Status.Ok, GDIPlus.GdipStringFormatGetGenericDefault (out sf), "GdipStringFormatGetGenericDefault"); + + CheckStringFormat (sf, (StringFormatFlags) 0, StringTrimming.Character); + + Assert.AreEqual (Status.Ok, GDIPlus.GdipDeleteStringFormat (sf), "GdipDeleteStringFormat"); + } + + [Test] + public void StringFormat_GenericTypographic () + { + IntPtr sf; + Assert.AreEqual (Status.Ok, GDIPlus.GdipStringFormatGetGenericTypographic (out sf), "GdipStringFormatGetGenericTypographic"); + + StringFormatFlags flags = StringFormatFlags.NoClip | StringFormatFlags.LineLimit | StringFormatFlags.FitBlackBox; + CheckStringFormat (sf, flags , StringTrimming.None); + + Assert.AreEqual (Status.Ok, GDIPlus.GdipDeleteStringFormat (sf), "GdipDeleteStringFormat"); + } + // TextureBrush [Test] public void Texture () diff --git a/mcs/class/System.Drawing/Test/System.Drawing/TestStringFormat.cs b/mcs/class/System.Drawing/Test/System.Drawing/TestStringFormat.cs index 4858c39ba11..8e316ee29ca 100644 --- a/mcs/class/System.Drawing/Test/System.Drawing/TestStringFormat.cs +++ b/mcs/class/System.Drawing/Test/System.Drawing/TestStringFormat.cs @@ -1,15 +1,12 @@ // -// StringFormatFlags class testing unit -// -// Author: +// StringFormat class testing unit // +// Authors: // Jordi Mas i Hernàndez (jordi@ximian.com) +// Sebastien Pouliot // // (C) 2004 Ximian, Inc. http://www.ximian.com -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// Copyright (C) 2004-2006 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -30,9 +27,11 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // + using System; +using System.ComponentModel; using System.Drawing; -using System.Drawing.Imaging; +using System.Drawing.Text; using System.Security.Permissions; using NUnit.Framework; @@ -41,55 +40,226 @@ namespace MonoTests.System.Drawing{ [TestFixture] [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)] public class StringFormatTest { - - [TearDown] - public void Clean() {} - - [SetUp] - public void GetReady() + + private void CheckDefaults (StringFormat sf) { - + Assert.AreEqual (StringAlignment.Near, sf.Alignment, "Alignment"); + Assert.AreEqual (0, sf.DigitSubstitutionLanguage, "DigitSubstitutionLanguage"); + Assert.AreEqual (StringDigitSubstitute.User, sf.DigitSubstitutionMethod, "DigitSubstitutionMethod"); + Assert.AreEqual ((StringFormatFlags) 0, sf.FormatFlags, "FormatFlags"); + Assert.AreEqual (HotkeyPrefix.None, sf.HotkeyPrefix, "HotkeyPrefix"); + Assert.AreEqual (StringAlignment.Near, sf.LineAlignment, "LineAlignment"); + Assert.AreEqual (StringTrimming.Character, sf.Trimming, "Trimming"); } - + [Test] - public void TestSpecialConstructors() - { - StringFormat smf = StringFormat.GenericDefault; - smf = StringFormat.GenericTypographic; - } - + public void Default () + { + using (StringFormat sf = new StringFormat ()) { + CheckDefaults (sf); + Assert.AreEqual ("[StringFormat, FormatFlags=0]", sf.ToString (), "ToString"); + // check setters validations + sf.FormatFlags = (StringFormatFlags) Int32.MinValue; + Assert.AreEqual ((StringFormatFlags) Int32.MinValue, sf.FormatFlags, "Min-FormatFlags"); + Assert.AreEqual ("[StringFormat, FormatFlags=-2147483648]", sf.ToString (), "ToString-2"); + } + } + [Test] - public void TestClone() - { - StringFormat smf = new StringFormat(); - StringFormat smfclone = (StringFormat) smf.Clone(); - - Assert.AreEqual (smf.LineAlignment, smfclone.LineAlignment); - Assert.AreEqual (smf.FormatFlags, smfclone.FormatFlags); - Assert.AreEqual (smf.LineAlignment, smfclone.LineAlignment); - Assert.AreEqual (smf.Alignment, smfclone.Alignment); - Assert.AreEqual (smf.Trimming, smfclone.Trimming); + [ExpectedException (typeof (ArgumentException))] + public void Default_Dispose () + { + StringFormat sf = new StringFormat (); + sf.Dispose (); + sf.ToString (); } - + [Test] - public void TestAlignment() - { - StringFormat smf = new StringFormat (); - - smf.LineAlignment = StringAlignment.Center; - Assert.AreEqual (StringAlignment.Center, smf.LineAlignment); - - smf.Alignment = StringAlignment.Far; - Assert.AreEqual (StringAlignment.Far, smf.Alignment); - } + [ExpectedException (typeof (ArgumentNullException))] + public void ctor_StringFormat_Null () + { + new StringFormat (null); + } + + [Test] + public void ctor_StringFormat () + { + using (StringFormat sf = new StringFormat (StringFormat.GenericTypographic)) { + CheckTypographic (sf); + } + } + + [Test] + public void ctor_StringFormatFlags () + { + using (StringFormat sf = new StringFormat ((StringFormatFlags)Int32.MinValue)) { + Assert.AreEqual ((StringFormatFlags) Int32.MinValue, sf.FormatFlags, "FormatFlags"); + } + } + + [Test] + public void ctor_StringFormatFlags_Int32 () + { + using (StringFormat sf = new StringFormat ((StringFormatFlags) Int32.MinValue, Int32.MinValue)) { + Assert.AreEqual (0, sf.DigitSubstitutionLanguage, "DigitSubstitutionLanguage"); + Assert.AreEqual ((StringFormatFlags) Int32.MinValue, sf.FormatFlags, "FormatFlags"); + } + } + + [Test] + public void GenericDefault () + { + CheckDefaults (StringFormat.GenericDefault); + } + + [Test] + public void GenericDefault_Dispose () + { + StringFormat.GenericDefault.Dispose (); + CheckDefaults (StringFormat.GenericDefault); + } + + [Test] + [ExpectedException (typeof (ArgumentException))] + public void GenericDefault_Local_Dispose () + { + StringFormat sf = StringFormat.GenericDefault; + sf.Dispose (); // can't be cached + CheckDefaults (sf); + } + + private void CheckTypographic (StringFormat sf) + { + Assert.AreEqual (StringAlignment.Near, sf.Alignment, "Alignment"); + Assert.AreEqual (0, sf.DigitSubstitutionLanguage, "DigitSubstitutionLanguage"); + Assert.AreEqual (StringDigitSubstitute.User, sf.DigitSubstitutionMethod, "DigitSubstitutionMethod"); + Assert.AreEqual (StringFormatFlags.FitBlackBox | StringFormatFlags.LineLimit | StringFormatFlags.NoClip, sf.FormatFlags, "FormatFlags"); + Assert.AreEqual (HotkeyPrefix.None, sf.HotkeyPrefix, "HotkeyPrefix"); + Assert.AreEqual (StringAlignment.Near, sf.LineAlignment, "LineAlignment"); + Assert.AreEqual (StringTrimming.None, sf.Trimming, "Trimming"); + } + + [Test] + public void GenericTypographic () + { + StringFormat sf = StringFormat.GenericTypographic; + CheckTypographic (sf); + Assert.AreEqual ("[StringFormat, FormatFlags=FitBlackBox, LineLimit, NoClip]", sf.ToString (), "ToString"); + } + + [Test] + public void GenericTypographic_Dispose () + { + StringFormat.GenericTypographic.Dispose (); + CheckTypographic (StringFormat.GenericTypographic); + } + + [Test] + [ExpectedException (typeof (ArgumentException))] + public void GenericTypographic_Local_Dispose () + { + StringFormat sf = StringFormat.GenericTypographic; + sf.Dispose (); // can't be cached + CheckTypographic (sf); + } + + [Test] + public void Alignment_All () + { + using (StringFormat sf = new StringFormat ()) { + foreach (StringAlignment sa in Enum.GetValues (typeof (StringAlignment))) { + sf.Alignment = sa; + Assert.AreEqual (sa, sf.Alignment, sa.ToString ()); + } + } + } + + [Test] + [ExpectedException (typeof (InvalidEnumArgumentException))] + public void Alignment_Invalid () + { + using (StringFormat sf = new StringFormat ()) { + sf.Alignment = (StringAlignment) Int32.MinValue; + } + } + + [Test] + public void HotkeyPrefix_All () + { + using (StringFormat sf = new StringFormat ()) { + foreach (HotkeyPrefix hp in Enum.GetValues (typeof (HotkeyPrefix))) { + sf.HotkeyPrefix = hp; + Assert.AreEqual (hp, sf.HotkeyPrefix, hp.ToString ()); + } + } + } + + [Test] + [ExpectedException (typeof (InvalidEnumArgumentException))] + public void HotkeyPrefix_Invalid () + { + using (StringFormat sf = new StringFormat ()) { + sf.HotkeyPrefix = (HotkeyPrefix) Int32.MinValue; + } + } + + [Test] + public void LineAlignment_All () + { + using (StringFormat sf = new StringFormat ()) { + foreach (StringAlignment sa in Enum.GetValues (typeof (StringAlignment))) { + sf.LineAlignment = sa; + Assert.AreEqual (sa, sf.LineAlignment, sa.ToString ()); + } + } + } + + [Test] + [ExpectedException (typeof (InvalidEnumArgumentException))] + public void LineAlignment_Invalid () + { + using (StringFormat sf = new StringFormat ()) { + sf.LineAlignment = (StringAlignment) Int32.MinValue; + } + } + + [Test] + public void Trimming_All () + { + using (StringFormat sf = new StringFormat ()) { + foreach (StringTrimming st in Enum.GetValues (typeof (StringTrimming))) { + sf.Trimming = st; + Assert.AreEqual (st, sf.Trimming, st.ToString ()); + } + } + } + + [Test] + [ExpectedException (typeof (InvalidEnumArgumentException))] + public void Trimming_Invalid () + { + using (StringFormat sf = new StringFormat ()) { + sf.Trimming = (StringTrimming) Int32.MinValue; + } + } + + [Test] + public void Clone() + { + using (StringFormat sf = new StringFormat ()) { + using (StringFormat clone = (StringFormat) sf.Clone ()) { + CheckDefaults (clone); + } + } + } [Test] public void TestFormatFlags() - { - StringFormat smf = new StringFormat (); - - smf.FormatFlags = StringFormatFlags.DisplayFormatControl; - Assert.AreEqual (StringFormatFlags.DisplayFormatControl, smf.FormatFlags); + { + using (StringFormat smf = new StringFormat ()) { + smf.FormatFlags = StringFormatFlags.DisplayFormatControl; + Assert.AreEqual (StringFormatFlags.DisplayFormatControl, smf.FormatFlags); + } } [Test] @@ -97,23 +267,59 @@ namespace MonoTests.System.Drawing{ [Category ("NotWorking")] #endif public void TabsStops() - { - StringFormat smf = new StringFormat (); - - float firstTabOffset; - float[] tabsSrc = {100, 200, 300, 400}; - float[] tabStops; - - smf.SetTabStops(200, tabsSrc); - tabStops = smf.GetTabStops(out firstTabOffset); - - Assert.AreEqual (200, firstTabOffset); - Assert.AreEqual (tabsSrc.Length, tabStops.Length); - Assert.AreEqual (tabsSrc[0], tabStops[0]); - Assert.AreEqual (tabsSrc[1], tabStops[1]); - Assert.AreEqual (tabsSrc[2], tabStops[2]); - Assert.AreEqual (tabsSrc[3], tabStops[3]); - } - + { + using (StringFormat smf = new StringFormat ()) { + float firstTabOffset; + float[] tabsSrc = { 100, 200, 300, 400 }; + float[] tabStops; + + smf.SetTabStops (200, tabsSrc); + tabStops = smf.GetTabStops (out firstTabOffset); + + Assert.AreEqual (200, firstTabOffset); + Assert.AreEqual (tabsSrc.Length, tabStops.Length); + Assert.AreEqual (tabsSrc[0], tabStops[0]); + Assert.AreEqual (tabsSrc[1], tabStops[1]); + Assert.AreEqual (tabsSrc[2], tabStops[2]); + Assert.AreEqual (tabsSrc[3], tabStops[3]); + } + } + + [Test] + [ExpectedException (typeof (NullReferenceException))] + public void SetTabStops_Null () + { + using (StringFormat sf = new StringFormat ()) { + sf.SetTabStops (Single.NaN, null); + } + } + + [Test] + public void SetDigitSubstitution () + { + using (StringFormat sf = new StringFormat ()) { + sf.SetDigitSubstitution (Int32.MinValue, (StringDigitSubstitute) Int32.MinValue); + Assert.AreEqual (0, sf.DigitSubstitutionLanguage, "DigitSubstitutionLanguage"); + Assert.AreEqual ((StringDigitSubstitute) Int32.MinValue, sf.DigitSubstitutionMethod, "DigitSubstitutionMethod"); + } + } + + [Test] + [ExpectedException (typeof (NullReferenceException))] + public void SetMeasurableCharacterRanges_Null () + { + using (StringFormat sf = new StringFormat ()) { + sf.SetMeasurableCharacterRanges (null); + } + } + + [Test] + public void SetMeasurableCharacterRanges_Empty () + { + using (StringFormat sf = new StringFormat ()) { + CharacterRange[] range = new CharacterRange[0]; + sf.SetMeasurableCharacterRanges (range); + } + } } }