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 [ExpectedException (typeof (SecurityException))]
124 [SecurityPermission (SecurityAction.Deny, UnmanagedCode = true)]
125 public void ToLogFont_DenyUnmanagedCode ()
131 f = new Font("Arial", 10);
137 [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
138 public void ToLogFont_AssertUnmanagedCode ()
140 Font f = new Font("Arial", 10);
141 LOGFONT lf = new LOGFONT();
144 Assert.AreEqual (400, lf.lfWeight, "lfWeight");
145 Assert.AreEqual (1, lf.lfCharSet, "lfCharSet");
146 Assert.AreEqual (f.Name, lf.lfFaceName, "lfFaceName");
148 LOGFONT_STRUCT lfs = new LOGFONT_STRUCT ();
150 Assert.AreEqual (0, lfs.lfWeight, "struct-lfWeight");
151 Assert.AreEqual (0, lfs.lfCharSet, "struct-lfCharSet");
152 Assert.AreEqual (0, lfs.lfHeight, "struct-lfHeight");
153 Assert.AreEqual (0, lfs.lfWidth, "struct-lfWidth");
154 Assert.AreEqual (0, lfs.lfEscapement, "struct-lfEscapement");
155 Assert.AreEqual (0, lfs.lfOrientation, "struct-lfOrientation");
156 Assert.AreEqual (0, lfs.lfWeight, "struct-lfWeight");
157 Assert.AreEqual (0, lfs.lfItalic, "struct-lfItalic");
158 Assert.AreEqual (0, lfs.lfUnderline, "struct-lfUnderline");
159 Assert.AreEqual (0, lfs.lfStrikeOut, "struct-lfStrikeOut");
160 Assert.AreEqual (0, lfs.lfCharSet, "struct-lfCharSet");
161 Assert.AreEqual (0, lfs.lfOutPrecision, "struct-lfOutPrecision");
162 Assert.AreEqual (0, lfs.lfClipPrecision, "struct-lfClipPrecision");
163 Assert.AreEqual (0, lfs.lfQuality, "struct-lfQuality");
164 Assert.AreEqual (0, lfs.lfPitchAndFamily, "struct-lfPitchAndFamily");
165 Assert.IsNull (lfs.lfFaceName, "struct-lfFaceName");
169 [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
170 [ExpectedException (typeof (ArgumentException))]
171 public void ToLogFont_TooSmall ()
173 Font f = new Font ("Arial", 10);
174 object o = new object ();
176 // no PInvoke conversion exists !?!?
180 [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
181 public void ToLogFont_Int ()
183 Font f = new Font ("Arial", 10);
186 Assert.AreEqual (1, i);
190 [SecurityPermission (SecurityAction.Assert, UnmanagedCode = true)]
191 [ExpectedException (typeof (AccessViolationException))]
192 public void ToLogFont_Null ()
194 Font f = new Font ("Arial", 10);
198 public void Font_StringNull_Float ()
200 string family = null;
201 Font f = new Font (family, 12.5f);
202 Assert.AreEqual (FontFamily.GenericSansSerif, f.FontFamily, "FontFamily");
203 Assert.AreEqual (f.Name, f.FontFamily.Name, "Name");
204 Assert.AreEqual (12.5f, f.Size, "Size");
205 Assert.AreEqual (12.5f, f.SizeInPoints, "SizeInPoints");
206 Assert.AreEqual (GraphicsUnit.Point, f.Unit, "Unit");
210 public void Font_String_Float ()
212 Font f = new Font (name, 12.5f);
213 Assert.AreEqual (FontFamily.GenericMonospace, f.FontFamily, "FontFamily");
214 Assert.IsFalse (f.Bold, "Bold");
215 Assert.AreEqual (1, f.GdiCharSet, "GdiCharSet");
216 Assert.IsFalse (f.GdiVerticalFont, "GdiVerticalFont");
217 Assert.IsTrue (f.Height > 0, "Height");
218 Assert.IsFalse (f.Italic, "Italic");
219 Assert.AreEqual (f.Name, f.FontFamily.Name, "Name");
220 Assert.AreEqual (12.5f, f.Size, "Size");
221 Assert.AreEqual (12.5f, f.SizeInPoints, "SizeInPoints");
222 Assert.IsFalse (f.Strikeout, "Strikeout");
223 Assert.IsFalse (f.Underline, "Underline");
224 Assert.AreEqual (GraphicsUnit.Point, f.Unit, "Unit");
228 public void Font_String_Float_FontStyle ()
230 Font f = new Font (name, 12.5f, FontStyle.Bold);
231 Assert.AreEqual (FontFamily.GenericMonospace, f.FontFamily, "FontFamily");
232 Assert.IsTrue (f.Bold, "Bold");
233 Assert.AreEqual (1, f.GdiCharSet, "GdiCharSet");
234 Assert.IsFalse (f.GdiVerticalFont, "GdiVerticalFont");
235 Assert.IsTrue (f.Height > 0, "Height");
236 Assert.IsFalse (f.Italic, "Italic");
237 Assert.AreEqual (f.Name, f.FontFamily.Name, "Name");
238 Assert.AreEqual (12.5f, f.Size, "Size");
239 Assert.AreEqual (12.5f, f.SizeInPoints, "SizeInPoints");
240 Assert.IsFalse (f.Strikeout, "Strikeout");
241 Assert.IsFalse (f.Underline, "Underline");
242 Assert.AreEqual (GraphicsUnit.Point, f.Unit, "Unit");
246 public void Font_String_Float_FontStyle_GraphicsUnit ()
248 Font f = new Font (name, 12.5f, FontStyle.Italic, GraphicsUnit.Pixel);
249 Assert.IsFalse (f.Bold, "Bold");
250 Assert.AreEqual (1, f.GdiCharSet, "GdiCharSet");
251 Assert.IsFalse (f.GdiVerticalFont, "GdiVerticalFont");
252 Assert.IsTrue (f.Height > 0, "Height");
253 Assert.IsTrue (f.Italic, "Italic");
254 Assert.AreEqual (FontFamily.GenericMonospace, f.FontFamily, "FontFamily");
255 Assert.AreEqual (f.Name, f.FontFamily.Name, "Name");
256 Assert.AreEqual (12.5f, f.Size, "Size");
257 Assert.IsFalse (f.Strikeout, "Strikeout");
258 Assert.IsFalse (f.Underline, "Underline");
259 Assert.AreEqual (GraphicsUnit.Pixel, f.Unit, "Unit");
263 [ExpectedException (typeof (ArgumentException))]
264 public void Font_String_Float_FontStyle_GraphicsUnit_Display ()
266 new Font (name, 12.5f, FontStyle.Italic, GraphicsUnit.Display);
270 public void Font_String_Float_FontStyle_GraphicsUnit_Byte ()
272 Font f = new Font (name, 12.5f, FontStyle.Strikeout, GraphicsUnit.Inch, Byte.MaxValue);
273 Assert.IsFalse (f.Bold, "Bold");
274 Assert.AreEqual (Byte.MaxValue, f.GdiCharSet, "GdiCharSet");
275 Assert.IsFalse (f.GdiVerticalFont, "GdiVerticalFont");
276 Assert.IsTrue (f.Height > 0, "Height");
277 Assert.IsFalse (f.Italic, "Italic");
278 Assert.AreEqual (FontFamily.GenericMonospace, f.FontFamily, "FontFamily");
279 Assert.AreEqual (f.Name, f.FontFamily.Name, "Name");
280 Assert.AreEqual (12.5f, f.Size, "Size");
281 Assert.AreEqual (900f, f.SizeInPoints, "SizeInPoints");
282 Assert.IsTrue (f.Strikeout, "Strikeout");
283 Assert.IsFalse (f.Underline, "Underline");
284 Assert.AreEqual (GraphicsUnit.Inch, f.Unit, "Unit");
288 public void Font_String_Float_FontStyle_GraphicsUnit_Byte_Bool ()
290 Font f = new Font (name, 12.5f, FontStyle.Underline, GraphicsUnit.Document, Byte.MinValue, true);
291 Assert.IsFalse (f.Bold, "Bold");
292 Assert.AreEqual (Byte.MinValue, f.GdiCharSet, "GdiCharSet");
293 Assert.IsTrue (f.GdiVerticalFont, "GdiVerticalFont");
294 Assert.IsTrue (f.Height > 0, "Height");
295 Assert.IsFalse (f.Italic, "Italic");
296 Assert.AreEqual (FontFamily.GenericMonospace, f.FontFamily, "FontFamily");
297 Assert.AreEqual (f.Name, f.FontFamily.Name, "Name");
298 Assert.AreEqual (12.5f, f.Size, "Size");
299 Assert.AreEqual (3f, f.SizeInPoints, "SizeInPoints");
300 Assert.IsFalse (f.Strikeout, "Strikeout");
301 Assert.IsTrue (f.Underline, "Underline");
302 Assert.AreEqual (GraphicsUnit.Document, f.Unit, "Unit");
306 [ExpectedException (typeof (ArgumentNullException))]
307 public void Font_FontFamilyNull_Float ()
309 FontFamily ff = null;
310 new Font (ff, 12.5f);
314 [ExpectedException (typeof (NullReferenceException))]
315 public void Font_FontNull_FontStyle ()
318 new Font (f, FontStyle.Bold);
322 public void Font_FontFamily_Float ()
324 Font f = new Font (FontFamily.GenericMonospace, 12.5f);
325 Assert.AreEqual (FontFamily.GenericMonospace, f.FontFamily, "FontFamily");
326 Assert.IsFalse (f.Bold, "Bold");
327 Assert.AreEqual (1, f.GdiCharSet, "GdiCharSet");
328 Assert.IsFalse (f.GdiVerticalFont, "GdiVerticalFont");
329 Assert.IsTrue (f.Height > 0, "Height");
330 Assert.IsFalse (f.Italic, "Italic");
331 Assert.AreEqual (f.Name, f.FontFamily.Name, "Name");
332 Assert.AreEqual (12.5f, f.Size, "Size");
333 Assert.AreEqual (12.5f, f.SizeInPoints, "SizeInPoints");
334 Assert.IsFalse (f.Strikeout, "Strikeout");
335 Assert.IsFalse (f.Underline, "Underline");
336 Assert.AreEqual (GraphicsUnit.Point, f.Unit, "Unit");
340 public void Font_FontFamily_Float_FontStyle ()
342 Font f = new Font (FontFamily.GenericMonospace, 12.5f, FontStyle.Bold);
343 Assert.AreEqual (FontFamily.GenericMonospace, f.FontFamily, "FontFamily");
344 Assert.IsTrue (f.Bold, "Bold");
345 Assert.AreEqual (1, f.GdiCharSet, "GdiCharSet");
346 Assert.IsFalse (f.GdiVerticalFont, "GdiVerticalFont");
347 Assert.IsTrue (f.Height > 0, "Height");
348 Assert.IsFalse (f.Italic, "Italic");
349 Assert.AreEqual (f.Name, f.FontFamily.Name, "Name");
350 Assert.AreEqual (12.5f, f.Size, "Size");
351 Assert.AreEqual (12.5f, f.SizeInPoints, "SizeInPoints");
352 Assert.IsFalse (f.Strikeout, "Strikeout");
353 Assert.IsFalse (f.Underline, "Underline");
354 Assert.AreEqual (GraphicsUnit.Point, f.Unit, "Unit");
358 public void Font_FontFamily_Float_FontStyle_GraphicsUnit ()
360 Font f = new Font (FontFamily.GenericMonospace, 12.5f, FontStyle.Italic, GraphicsUnit.Millimeter);
361 Assert.IsFalse (f.Bold, "Bold");
362 Assert.AreEqual (1, f.GdiCharSet, "GdiCharSet");
363 Assert.IsFalse (f.GdiVerticalFont, "GdiVerticalFont");
364 Assert.IsTrue (f.Height > 0, "Height");
365 Assert.IsTrue (f.Italic, "Italic");
366 Assert.AreEqual (FontFamily.GenericMonospace, f.FontFamily, "FontFamily");
367 Assert.AreEqual (f.Name, f.FontFamily.Name, "Name");
368 Assert.AreEqual (12.5f, f.Size, "Size");
369 Assert.AreEqual (35.43307f, f.SizeInPoints, "SizeInPoints");
370 Assert.IsFalse (f.Strikeout, "Strikeout");
371 Assert.IsFalse (f.Underline, "Underline");
372 Assert.AreEqual (GraphicsUnit.Millimeter, f.Unit, "Unit");
376 [ExpectedException (typeof (ArgumentException))]
377 public void Font_FontFamily_Float_FontStyle_GraphicsUnit_Display ()
379 new Font (FontFamily.GenericMonospace, 12.5f, FontStyle.Italic, GraphicsUnit.Display);
383 public void Font_FontFamily_Float_FontStyle_GraphicsUnit_Byte ()
385 Font f = new Font (FontFamily.GenericMonospace, 12.5f, FontStyle.Strikeout, GraphicsUnit.Inch, Byte.MaxValue);
386 Assert.IsFalse (f.Bold, "Bold");
387 Assert.AreEqual (Byte.MaxValue, f.GdiCharSet, "GdiCharSet");
388 Assert.IsFalse (f.GdiVerticalFont, "GdiVerticalFont");
389 Assert.IsTrue (f.Height > 0, "Height");
390 Assert.IsFalse (f.Italic, "Italic");
391 Assert.AreEqual (FontFamily.GenericMonospace, f.FontFamily, "FontFamily");
392 Assert.AreEqual (f.Name, f.FontFamily.Name, "Name");
393 Assert.AreEqual (12.5f, f.Size, "Size");
394 Assert.AreEqual (900f, f.SizeInPoints, "SizeInPoints");
395 Assert.IsTrue (f.Strikeout, "Strikeout");
396 Assert.IsFalse (f.Underline, "Underline");
397 Assert.AreEqual (GraphicsUnit.Inch, f.Unit, "Unit");
401 public void Font_FontFamily_Float_FontStyle_GraphicsUnit_Byte_Bool ()
403 Font f = new Font (FontFamily.GenericMonospace, 12.5f, FontStyle.Underline, GraphicsUnit.Document, Byte.MinValue, true);
404 Assert.IsFalse (f.Bold, "Bold");
405 Assert.AreEqual (Byte.MinValue, f.GdiCharSet, "GdiCharSet");
406 Assert.IsTrue (f.GdiVerticalFont, "GdiVerticalFont");
407 Assert.IsTrue (f.Height > 0, "Height");
408 Assert.IsFalse (f.Italic, "Italic");
409 Assert.AreEqual (FontFamily.GenericMonospace, f.FontFamily, "FontFamily");
410 Assert.AreEqual (f.Name, f.FontFamily.Name, "Name");
411 Assert.AreEqual (12.5f, f.Size, "Size");
412 Assert.AreEqual (3f, f.SizeInPoints, "SizeInPoints");
413 Assert.IsFalse (f.Strikeout, "Strikeout");
414 Assert.IsTrue (f.Underline, "Underline");
415 Assert.AreEqual (GraphicsUnit.Document, f.Unit, "Unit");
419 public void Dispose_Double ()
421 Font f = new Font (name, 12.5f);
427 public void Dispose_UseAfter_Works ()
429 Font f = new Font (name, 12.5f);
430 string fname = f.Name;
432 // most properties don't throw, everything seems to be cached
433 Assert.AreEqual (fname, f.Name, "Name");
434 Assert.AreEqual (12.5f, f.Size, "Size");
438 [ExpectedException (typeof (ArgumentException))]
439 public void Dispose_Height ()
441 Font f = new Font (name, 12.5f);
443 Assert.AreEqual (0, f.Height, "Name");
447 [ExpectedException (typeof (ArgumentException))]
448 public void Dispose_ToLogFont ()
450 Font f = new Font (name, 12.5f);
452 LOGFONT lf = new LOGFONT();
457 public void Dispose_ToLogFont_LoopCharSet ()
459 Font f = new Font (name, 12.5f);
461 LOGFONT lf = new LOGFONT ();
463 for (int i = Byte.MinValue; i < Byte.MaxValue; i++) {
468 lf.lfOrientation = b;
474 lf.lfOutPrecision = b;
475 lf.lfClipPrecision = b;
477 lf.lfPitchAndFamily = b;
478 lf.lfFaceName = b.ToString ();
482 catch (ArgumentException) {
483 Assert.AreEqual (b, lf.lfHeight, "lfHeight");
484 Assert.AreEqual (b, lf.lfWidth, "lfWidth");
485 Assert.AreEqual (b, lf.lfEscapement, "lfEscapement");
486 Assert.AreEqual (b, lf.lfOrientation, "lfOrientation");
487 Assert.AreEqual (b, lf.lfWeight, "lfWeight");
488 Assert.AreEqual (b, lf.lfItalic, "lfItalic");
489 Assert.AreEqual (b, lf.lfUnderline, "lfUnderline");
490 Assert.AreEqual (b, lf.lfStrikeOut, "lfStrikeOut");
491 // special case for 0
492 Assert.AreEqual ((i == 0) ? (byte)1 : b, lf.lfCharSet, "lfCharSet");
493 Assert.AreEqual (b, lf.lfOutPrecision, "lfOutPrecision");
494 Assert.AreEqual (b, lf.lfClipPrecision, "lfClipPrecision");
495 Assert.AreEqual (b, lf.lfQuality, "lfQuality");
496 Assert.AreEqual (b, lf.lfPitchAndFamily, "lfPitchAndFamily");
497 Assert.AreEqual (b.ToString (), lf.lfFaceName, "lfFaceName");
499 catch (Exception e) {
500 Assert.Fail ("Unexcepted exception {0} at iteration {1}", e, i);
506 [ExpectedException (typeof (ArgumentException))]
507 public void Dispose_ToHFont ()
509 Font f = new Font (name, 12.5f);
515 [ExpectedException (typeof (ArgumentException))]
516 [Category ("NotWorking")]
517 public void UnavailableStyleException ()
519 // Marked NotWorking because it is dependent on what fonts/styles are available
520 // on the OS. This test is written for Windows.
521 Font f = new Font ("Monotype Corsiva", 8, FontStyle.Regular);
525 public void GetHeight_Float ()
527 using (Font f = new Font (name, 12.5f)) {
528 Assert.AreEqual (0, f.GetHeight (0), "0");
533 public void GetHeight_Graphics ()
535 using (Bitmap bmp = new Bitmap (10, 10)) {
536 using (Graphics g = Graphics.FromImage (bmp)) {
537 using (Font f = new Font (name, 12.5f)) {
538 float expected = f.GetHeight (g.DpiY);
539 Assert.AreEqual (expected, f.GetHeight (g), 0.01f, "Default");
540 g.ScaleTransform (2, 4);
541 Assert.AreEqual (expected, f.GetHeight (g), 0.01f, "ScaleTransform");
543 Assert.AreEqual (expected, f.GetHeight (g), 0.01f, "PageScale");
550 [ExpectedException (typeof (ArgumentNullException))]
551 public void GetHeight_Graphics_Null ()
553 using (Font f = new Font (name, 12.5f)) {
554 Assert.AreEqual (0, f.GetHeight (null), "0");
559 public void FontUniqueHashCode ()
561 Font f1 = new Font ("Arial", 14);
562 Font f2 = new Font ("Arial", 12);
563 Font f3 = new Font (f1, FontStyle.Bold);
565 Assert.IsFalse (f1.GetHashCode () == f2.GetHashCode (), "1) Fonts with different sizes should have different HashCodes");
566 Assert.IsFalse (f1.GetHashCode () == f3.GetHashCode (), "2) Fonts with different styles should have different HashCodes");
570 public void GetHashCode_UnitDiffers_HashesNotEqual()
572 Font f1 = new Font("Arial", 8.25F, GraphicsUnit.Point);
573 Font f2 = new Font("Arial", 8.25F, GraphicsUnit.Pixel);
575 Assert.IsFalse(f1.GetHashCode() == f2.GetHashCode(),
576 "Hashcodes should differ if _unit member differs");
580 public void GetHashCode_NameDiffers_HashesNotEqual()
582 Font f1 = new Font("Arial", 8.25F, GraphicsUnit.Point);
583 Font f2 = new Font("Courier New", 8.25F, GraphicsUnit.Point);
585 if (f1.Name != f2.Name) {
586 Assert.IsFalse(f1.GetHashCode() == f2.GetHashCode(),
587 "Hashcodes should differ if _name member differs");
592 public void GetHashCode_StyleEqualsGdiCharSet_HashesNotEqual()
594 Font f1 = new Font("Arial", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
595 Font f2 = new Font("Arial", 8.25F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(1)));
597 Assert.IsFalse(f1.GetHashCode() == f2.GetHashCode(),
598 "Hashcodes should differ if _style member differs");