2 // Test Font class testing unit
5 // Jordi Mas i Hernandez, jordi@ximian.com
6 // Peter Dennis Bartok, pbartok@novell.com
7 // Sebastien Pouliot <sebastien@ximian.com>
9 // (C) 2003 Ximian, Inc. http://www.ximian.com
10 // Copyright (C) 2004-2007 Novell, Inc (http://www.novell.com)
12 // Permission is hereby granted, free of charge, to any person obtaining
13 // a copy of this software and associated documentation files (the
14 // "Software"), to deal in the Software without restriction, including
15 // without limitation the rights to use, copy, modify, merge, publish,
16 // distribute, sublicense, and/or sell copies of the Software, and to
17 // permit persons to whom the Software is furnished to do so, subject to
18 // the following conditions:
20 // The above copyright notice and this permission notice shall be
21 // included in all copies or substantial portions of the Software.
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 using NUnit.Framework;
35 using System.Drawing.Text;
36 using System.Security;
37 using System.Security.Permissions;
38 using System.Runtime.InteropServices;
40 namespace MonoTests.System.Drawing{
43 public class FontTest {
48 public void FixtureSetUp ()
51 using (FontFamily ff = new FontFamily (GenericFontFamilies.Monospace)) {
55 catch (ArgumentException) {
56 Assert.Ignore ("No font family could be found.");
60 // Test basic Font clone, properties and contructor
62 [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
63 public void TestClone()
65 Font f = new Font("Arial",12);
66 Font f2 = (Font) f.Clone();
68 Assert.AreEqual (f.Bold, f2.Bold, "Bold");
69 Assert.AreEqual (f.FontFamily, f2.FontFamily, "FontFamily");
70 Assert.AreEqual (f.GdiCharSet, f2.GdiCharSet, "GdiCharSet");
71 Assert.AreEqual (f.GdiVerticalFont, f2.GdiVerticalFont, "GdiVerticalFont");
72 Assert.AreEqual (f.Height, f2.Height, "Height");
73 Assert.AreEqual (f.Italic, f2.Italic, "Italic");
74 Assert.AreEqual (f.Name, f2.Name, "Name");
75 Assert.AreEqual (f.Size, f2.Size, "Size");
76 Assert.AreEqual (f.SizeInPoints, f2.SizeInPoints, "SizeInPoints");
77 Assert.AreEqual (f.Strikeout, f2.Strikeout, "Strikeout");
78 Assert.AreEqual (f.Style, f2.Style, "Style");
79 Assert.AreEqual (f.Underline, f2.Underline, "Underline");
80 Assert.AreEqual (f.Unit, f2.Unit, "Unit");
83 [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
87 public int lfEscapement;
88 public int lfOrientation;
91 public byte lfUnderline;
92 public byte lfStrikeOut;
93 public byte lfCharSet;
94 public byte lfOutPrecision;
95 public byte lfClipPrecision;
96 public byte lfQuality;
97 public byte lfPitchAndFamily;
98 [ MarshalAs(UnmanagedType.ByValTStr, SizeConst=32) ]
99 public string lfFaceName;
102 [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Auto)]
103 struct LOGFONT_STRUCT {
106 public int lfEscapement;
107 public int lfOrientation;
109 public byte lfItalic;
110 public byte lfUnderline;
111 public byte lfStrikeOut;
112 public byte lfCharSet;
113 public byte lfOutPrecision;
114 public byte lfClipPrecision;
115 public byte lfQuality;
116 public byte lfPitchAndFamily;
117 [MarshalAs (UnmanagedType.ByValTStr, SizeConst = 32)]
118 public string lfFaceName;
123 [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
124 public void ToLogFont_DenyUnmanagedCode ()
130 f = new Font("Arial", 10);
132 Assert.Throws<SecurityException> (() => f.ToLogFont(lf));
136 [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
137 public void ToLogFont_AssertUnmanagedCode ()
139 Font f = new Font("Arial", 10);
140 LOGFONT lf = new LOGFONT();
143 Assert.AreEqual (400, lf.lfWeight, "lfWeight");
144 Assert.AreEqual (1, lf.lfCharSet, "lfCharSet");
145 Assert.AreEqual (f.Name, lf.lfFaceName, "lfFaceName");
147 LOGFONT_STRUCT lfs = new LOGFONT_STRUCT ();
149 Assert.AreEqual (0, lfs.lfWeight, "struct-lfWeight");
150 Assert.AreEqual (0, lfs.lfCharSet, "struct-lfCharSet");
151 Assert.AreEqual (0, lfs.lfHeight, "struct-lfHeight");
152 Assert.AreEqual (0, lfs.lfWidth, "struct-lfWidth");
153 Assert.AreEqual (0, lfs.lfEscapement, "struct-lfEscapement");
154 Assert.AreEqual (0, lfs.lfOrientation, "struct-lfOrientation");
155 Assert.AreEqual (0, lfs.lfWeight, "struct-lfWeight");
156 Assert.AreEqual (0, lfs.lfItalic, "struct-lfItalic");
157 Assert.AreEqual (0, lfs.lfUnderline, "struct-lfUnderline");
158 Assert.AreEqual (0, lfs.lfStrikeOut, "struct-lfStrikeOut");
159 Assert.AreEqual (0, lfs.lfCharSet, "struct-lfCharSet");
160 Assert.AreEqual (0, lfs.lfOutPrecision, "struct-lfOutPrecision");
161 Assert.AreEqual (0, lfs.lfClipPrecision, "struct-lfClipPrecision");
162 Assert.AreEqual (0, lfs.lfQuality, "struct-lfQuality");
163 Assert.AreEqual (0, lfs.lfPitchAndFamily, "struct-lfPitchAndFamily");
164 Assert.IsNull (lfs.lfFaceName, "struct-lfFaceName");
168 [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
169 public void ToLogFont_TooSmall ()
171 Font f = new Font ("Arial", 10);
172 object o = new object ();
173 Assert.Throws<ArgumentException> (() => f.ToLogFont (o));
174 // no PInvoke conversion exists !?!?
178 [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
179 public void ToLogFont_Int ()
181 Font f = new Font ("Arial", 10);
184 Assert.AreEqual (1, i);
188 [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
189 public void ToLogFont_Null ()
191 Font f = new Font ("Arial", 10);
192 Assert.Throws<AccessViolationException> (() => f.ToLogFont (null));
195 public void Font_StringNull_Float ()
197 string family = null;
198 Font f = new Font (family, 12.5f);
199 Assert.AreEqual (FontFamily.GenericSansSerif, f.FontFamily, "FontFamily");
200 Assert.AreEqual (f.Name, f.FontFamily.Name, "Name");
201 Assert.AreEqual (12.5f, f.Size, "Size");
202 Assert.AreEqual (12.5f, f.SizeInPoints, "SizeInPoints");
203 Assert.AreEqual (GraphicsUnit.Point, f.Unit, "Unit");
207 public void Font_String_Float ()
209 Font f = new Font (name, 12.5f);
210 Assert.AreEqual (FontFamily.GenericMonospace, f.FontFamily, "FontFamily");
211 Assert.IsFalse (f.Bold, "Bold");
212 Assert.AreEqual (1, f.GdiCharSet, "GdiCharSet");
213 Assert.IsFalse (f.GdiVerticalFont, "GdiVerticalFont");
214 Assert.IsTrue (f.Height > 0, "Height");
215 Assert.IsFalse (f.Italic, "Italic");
216 Assert.AreEqual (f.Name, f.FontFamily.Name, "Name");
217 Assert.AreEqual (12.5f, f.Size, "Size");
218 Assert.AreEqual (12.5f, f.SizeInPoints, "SizeInPoints");
219 Assert.IsFalse (f.Strikeout, "Strikeout");
220 Assert.IsFalse (f.Underline, "Underline");
221 Assert.AreEqual (GraphicsUnit.Point, f.Unit, "Unit");
225 public void Font_String_Float_FontStyle ()
227 Font f = new Font (name, 12.5f, FontStyle.Bold);
228 Assert.AreEqual (FontFamily.GenericMonospace, f.FontFamily, "FontFamily");
229 Assert.IsTrue (f.Bold, "Bold");
230 Assert.AreEqual (1, f.GdiCharSet, "GdiCharSet");
231 Assert.IsFalse (f.GdiVerticalFont, "GdiVerticalFont");
232 Assert.IsTrue (f.Height > 0, "Height");
233 Assert.IsFalse (f.Italic, "Italic");
234 Assert.AreEqual (f.Name, f.FontFamily.Name, "Name");
235 Assert.AreEqual (12.5f, f.Size, "Size");
236 Assert.AreEqual (12.5f, f.SizeInPoints, "SizeInPoints");
237 Assert.IsFalse (f.Strikeout, "Strikeout");
238 Assert.IsFalse (f.Underline, "Underline");
239 Assert.AreEqual (GraphicsUnit.Point, f.Unit, "Unit");
243 public void Font_String_Float_FontStyle_GraphicsUnit ()
245 Font f = new Font (name, 12.5f, FontStyle.Italic, GraphicsUnit.Pixel);
246 Assert.IsFalse (f.Bold, "Bold");
247 Assert.AreEqual (1, f.GdiCharSet, "GdiCharSet");
248 Assert.IsFalse (f.GdiVerticalFont, "GdiVerticalFont");
249 Assert.IsTrue (f.Height > 0, "Height");
250 Assert.IsTrue (f.Italic, "Italic");
251 Assert.AreEqual (FontFamily.GenericMonospace, f.FontFamily, "FontFamily");
252 Assert.AreEqual (f.Name, f.FontFamily.Name, "Name");
253 Assert.AreEqual (12.5f, f.Size, "Size");
254 Assert.IsFalse (f.Strikeout, "Strikeout");
255 Assert.IsFalse (f.Underline, "Underline");
256 Assert.AreEqual (GraphicsUnit.Pixel, f.Unit, "Unit");
260 public void Font_String_Float_FontStyle_GraphicsUnit_Display ()
262 Assert.Throws<ArgumentException> (() => new Font (name, 12.5f, FontStyle.Italic, GraphicsUnit.Display));
266 public void Font_String_Float_FontStyle_GraphicsUnit_Byte ()
268 Font f = new Font (name, 12.5f, FontStyle.Strikeout, GraphicsUnit.Inch, Byte.MaxValue);
269 Assert.IsFalse (f.Bold, "Bold");
270 Assert.AreEqual (Byte.MaxValue, f.GdiCharSet, "GdiCharSet");
271 Assert.IsFalse (f.GdiVerticalFont, "GdiVerticalFont");
272 Assert.IsTrue (f.Height > 0, "Height");
273 Assert.IsFalse (f.Italic, "Italic");
274 Assert.AreEqual (FontFamily.GenericMonospace, f.FontFamily, "FontFamily");
275 Assert.AreEqual (f.Name, f.FontFamily.Name, "Name");
276 Assert.AreEqual (12.5f, f.Size, "Size");
277 Assert.AreEqual (900f, f.SizeInPoints, "SizeInPoints");
278 Assert.IsTrue (f.Strikeout, "Strikeout");
279 Assert.IsFalse (f.Underline, "Underline");
280 Assert.AreEqual (GraphicsUnit.Inch, f.Unit, "Unit");
284 public void Font_String_Float_FontStyle_GraphicsUnit_Byte_Bool ()
286 Font f = new Font (name, 12.5f, FontStyle.Underline, GraphicsUnit.Document, Byte.MinValue, true);
287 Assert.IsFalse (f.Bold, "Bold");
288 Assert.AreEqual (Byte.MinValue, f.GdiCharSet, "GdiCharSet");
289 Assert.IsTrue (f.GdiVerticalFont, "GdiVerticalFont");
290 Assert.IsTrue (f.Height > 0, "Height");
291 Assert.IsFalse (f.Italic, "Italic");
292 Assert.AreEqual (FontFamily.GenericMonospace, f.FontFamily, "FontFamily");
293 Assert.AreEqual (f.Name, f.FontFamily.Name, "Name");
294 Assert.AreEqual (12.5f, f.Size, "Size");
295 Assert.AreEqual (3f, f.SizeInPoints, "SizeInPoints");
296 Assert.IsFalse (f.Strikeout, "Strikeout");
297 Assert.IsTrue (f.Underline, "Underline");
298 Assert.AreEqual (GraphicsUnit.Document, f.Unit, "Unit");
302 public void Font_FontFamilyNull_Float ()
304 FontFamily ff = null;
305 Assert.Throws<ArgumentNullException> (() => new Font (ff, 12.5f));
309 public void Font_FontNull_FontStyle ()
312 Assert.Throws<NullReferenceException> (() => new Font (f, FontStyle.Bold));
316 public void Font_FontFamily_Float ()
318 Font f = new Font (FontFamily.GenericMonospace, 12.5f);
319 Assert.AreEqual (FontFamily.GenericMonospace, f.FontFamily, "FontFamily");
320 Assert.IsFalse (f.Bold, "Bold");
321 Assert.AreEqual (1, f.GdiCharSet, "GdiCharSet");
322 Assert.IsFalse (f.GdiVerticalFont, "GdiVerticalFont");
323 Assert.IsTrue (f.Height > 0, "Height");
324 Assert.IsFalse (f.Italic, "Italic");
325 Assert.AreEqual (f.Name, f.FontFamily.Name, "Name");
326 Assert.AreEqual (12.5f, f.Size, "Size");
327 Assert.AreEqual (12.5f, f.SizeInPoints, "SizeInPoints");
328 Assert.IsFalse (f.Strikeout, "Strikeout");
329 Assert.IsFalse (f.Underline, "Underline");
330 Assert.AreEqual (GraphicsUnit.Point, f.Unit, "Unit");
334 public void Font_FontFamily_Float_FontStyle ()
336 Font f = new Font (FontFamily.GenericMonospace, 12.5f, FontStyle.Bold);
337 Assert.AreEqual (FontFamily.GenericMonospace, f.FontFamily, "FontFamily");
338 Assert.IsTrue (f.Bold, "Bold");
339 Assert.AreEqual (1, f.GdiCharSet, "GdiCharSet");
340 Assert.IsFalse (f.GdiVerticalFont, "GdiVerticalFont");
341 Assert.IsTrue (f.Height > 0, "Height");
342 Assert.IsFalse (f.Italic, "Italic");
343 Assert.AreEqual (f.Name, f.FontFamily.Name, "Name");
344 Assert.AreEqual (12.5f, f.Size, "Size");
345 Assert.AreEqual (12.5f, f.SizeInPoints, "SizeInPoints");
346 Assert.IsFalse (f.Strikeout, "Strikeout");
347 Assert.IsFalse (f.Underline, "Underline");
348 Assert.AreEqual (GraphicsUnit.Point, f.Unit, "Unit");
352 public void Font_FontFamily_Float_FontStyle_GraphicsUnit ()
354 Font f = new Font (FontFamily.GenericMonospace, 12.5f, FontStyle.Italic, GraphicsUnit.Millimeter);
355 Assert.IsFalse (f.Bold, "Bold");
356 Assert.AreEqual (1, f.GdiCharSet, "GdiCharSet");
357 Assert.IsFalse (f.GdiVerticalFont, "GdiVerticalFont");
358 Assert.IsTrue (f.Height > 0, "Height");
359 Assert.IsTrue (f.Italic, "Italic");
360 Assert.AreEqual (FontFamily.GenericMonospace, f.FontFamily, "FontFamily");
361 Assert.AreEqual (f.Name, f.FontFamily.Name, "Name");
362 Assert.AreEqual (12.5f, f.Size, "Size");
363 Assert.AreEqual (35.43307f, f.SizeInPoints, "SizeInPoints");
364 Assert.IsFalse (f.Strikeout, "Strikeout");
365 Assert.IsFalse (f.Underline, "Underline");
366 Assert.AreEqual (GraphicsUnit.Millimeter, f.Unit, "Unit");
370 public void Font_FontFamily_Float_FontStyle_GraphicsUnit_Display ()
372 Assert.Throws<ArgumentException> (() => new Font (FontFamily.GenericMonospace, 12.5f, FontStyle.Italic, GraphicsUnit.Display));
376 public void Font_FontFamily_Float_FontStyle_GraphicsUnit_Byte ()
378 Font f = new Font (FontFamily.GenericMonospace, 12.5f, FontStyle.Strikeout, GraphicsUnit.Inch, Byte.MaxValue);
379 Assert.IsFalse (f.Bold, "Bold");
380 Assert.AreEqual (Byte.MaxValue, f.GdiCharSet, "GdiCharSet");
381 Assert.IsFalse (f.GdiVerticalFont, "GdiVerticalFont");
382 Assert.IsTrue (f.Height > 0, "Height");
383 Assert.IsFalse (f.Italic, "Italic");
384 Assert.AreEqual (FontFamily.GenericMonospace, f.FontFamily, "FontFamily");
385 Assert.AreEqual (f.Name, f.FontFamily.Name, "Name");
386 Assert.AreEqual (12.5f, f.Size, "Size");
387 Assert.AreEqual (900f, f.SizeInPoints, "SizeInPoints");
388 Assert.IsTrue (f.Strikeout, "Strikeout");
389 Assert.IsFalse (f.Underline, "Underline");
390 Assert.AreEqual (GraphicsUnit.Inch, f.Unit, "Unit");
394 public void Font_FontFamily_Float_FontStyle_GraphicsUnit_Byte_Bool ()
396 Font f = new Font (FontFamily.GenericMonospace, 12.5f, FontStyle.Underline, GraphicsUnit.Document, Byte.MinValue, true);
397 Assert.IsFalse (f.Bold, "Bold");
398 Assert.AreEqual (Byte.MinValue, f.GdiCharSet, "GdiCharSet");
399 Assert.IsTrue (f.GdiVerticalFont, "GdiVerticalFont");
400 Assert.IsTrue (f.Height > 0, "Height");
401 Assert.IsFalse (f.Italic, "Italic");
402 Assert.AreEqual (FontFamily.GenericMonospace, f.FontFamily, "FontFamily");
403 Assert.AreEqual (f.Name, f.FontFamily.Name, "Name");
404 Assert.AreEqual (12.5f, f.Size, "Size");
405 Assert.AreEqual (3f, f.SizeInPoints, "SizeInPoints");
406 Assert.IsFalse (f.Strikeout, "Strikeout");
407 Assert.IsTrue (f.Underline, "Underline");
408 Assert.AreEqual (GraphicsUnit.Document, f.Unit, "Unit");
412 public void Dispose_Double ()
414 Font f = new Font (name, 12.5f);
420 public void Dispose_UseAfter_Works ()
422 Font f = new Font (name, 12.5f);
423 string fname = f.Name;
425 // most properties don't throw, everything seems to be cached
426 Assert.AreEqual (fname, f.Name, "Name");
427 Assert.AreEqual (12.5f, f.Size, "Size");
431 public void Dispose_Height ()
433 Font f = new Font (name, 12.5f);
435 Assert.Throws<ArgumentException> (() => { var x = f.Height; });
439 public void Dispose_ToLogFont ()
441 Font f = new Font (name, 12.5f);
443 LOGFONT lf = new LOGFONT();
444 Assert.Throws<ArgumentException> (() => f.ToLogFont (lf));
448 public void Dispose_ToLogFont_LoopCharSet ()
450 Font f = new Font (name, 12.5f);
452 LOGFONT lf = new LOGFONT ();
454 for (int i = Byte.MinValue; i < Byte.MaxValue; i++) {
459 lf.lfOrientation = b;
465 lf.lfOutPrecision = b;
466 lf.lfClipPrecision = b;
468 lf.lfPitchAndFamily = b;
469 lf.lfFaceName = b.ToString ();
473 catch (ArgumentException) {
474 Assert.AreEqual (b, lf.lfHeight, "lfHeight");
475 Assert.AreEqual (b, lf.lfWidth, "lfWidth");
476 Assert.AreEqual (b, lf.lfEscapement, "lfEscapement");
477 Assert.AreEqual (b, lf.lfOrientation, "lfOrientation");
478 Assert.AreEqual (b, lf.lfWeight, "lfWeight");
479 Assert.AreEqual (b, lf.lfItalic, "lfItalic");
480 Assert.AreEqual (b, lf.lfUnderline, "lfUnderline");
481 Assert.AreEqual (b, lf.lfStrikeOut, "lfStrikeOut");
482 // special case for 0
483 Assert.AreEqual ((i == 0) ? (byte)1 : b, lf.lfCharSet, "lfCharSet");
484 Assert.AreEqual (b, lf.lfOutPrecision, "lfOutPrecision");
485 Assert.AreEqual (b, lf.lfClipPrecision, "lfClipPrecision");
486 Assert.AreEqual (b, lf.lfQuality, "lfQuality");
487 Assert.AreEqual (b, lf.lfPitchAndFamily, "lfPitchAndFamily");
488 Assert.AreEqual (b.ToString (), lf.lfFaceName, "lfFaceName");
490 catch (Exception e) {
491 Assert.Fail ("Unexcepted exception {0} at iteration {1}", e, i);
497 public void Dispose_ToHFont ()
499 Font f = new Font (name, 12.5f);
501 Assert.Throws<ArgumentException> (() => f.ToHfont ());
505 [Category ("NotWorking")]
506 public void UnavailableStyleException ()
508 // Marked NotWorking because it is dependent on what fonts/styles are available
509 // on the OS. This test is written for Windows.
510 Assert.Throws<ArgumentException> (() => new Font ("Monotype Corsiva", 8, FontStyle.Regular));
514 public void GetHeight_Float ()
516 using (Font f = new Font (name, 12.5f)) {
517 Assert.AreEqual (0, f.GetHeight (0), "0");
522 public void GetHeight_Graphics ()
524 using (Bitmap bmp = new Bitmap (10, 10)) {
525 using (Graphics g = Graphics.FromImage (bmp)) {
526 using (Font f = new Font (name, 12.5f)) {
527 float expected = f.GetHeight (g.DpiY);
528 Assert.AreEqual (expected, f.GetHeight (g), 0.01f, "Default");
529 g.ScaleTransform (2, 4);
530 Assert.AreEqual (expected, f.GetHeight (g), 0.01f, "ScaleTransform");
532 Assert.AreEqual (expected, f.GetHeight (g), 0.01f, "PageScale");
539 public void GetHeight_Graphics_Null ()
541 using (Font f = new Font (name, 12.5f)) {
542 Assert.Throws<ArgumentNullException> (() => f.GetHeight (null));
547 public void FontUniqueHashCode ()
549 Font f1 = new Font ("Arial", 14);
550 Font f2 = new Font ("Arial", 12);
551 Font f3 = new Font (f1, FontStyle.Bold);
553 Assert.IsFalse (f1.GetHashCode () == f2.GetHashCode (), "1) Fonts with different sizes should have different HashCodes");
554 Assert.IsFalse (f1.GetHashCode () == f3.GetHashCode (), "2) Fonts with different styles should have different HashCodes");
558 public void GetHashCode_UnitDiffers_HashesNotEqual()
560 Font f1 = new Font("Arial", 8.25F, GraphicsUnit.Point);
561 Font f2 = new Font("Arial", 8.25F, GraphicsUnit.Pixel);
563 Assert.IsFalse(f1.GetHashCode() == f2.GetHashCode(),
564 "Hashcodes should differ if _unit member differs");
568 public void GetHashCode_NameDiffers_HashesNotEqual()
570 Font f1 = new Font("Arial", 8.25F, GraphicsUnit.Point);
571 Font f2 = new Font("Courier New", 8.25F, GraphicsUnit.Point);
573 if (f1.Name != f2.Name) {
574 Assert.IsFalse(f1.GetHashCode() == f2.GetHashCode(),
575 "Hashcodes should differ if _name member differs");
580 public void GetHashCode_StyleEqualsGdiCharSet_HashesNotEqual()
582 Font f1 = new Font("Arial", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
583 Font f2 = new Font("Arial", 8.25F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(1)));
585 Assert.IsFalse(f1.GetHashCode() == f2.GetHashCode(),
586 "Hashcodes should differ if _style member differs");