System.Drawing.Tests.FontTests.ToHfont_SimpleFont_Roundtrips C# (CSharp) Method

ToHfont_SimpleFont_Roundtrips() private method

private ToHfont_SimpleFont_Roundtrips ( ) : void
return void
        public void ToHfont_SimpleFont_Roundtrips()
        {
            using (FontFamily family = FontFamily.GenericSansSerif)
            using (var font = new Font(family, 10))
            {
                IntPtr hfont = font.ToHfont();
                Assert.NotEqual(IntPtr.Zero, hfont);
                Assert.NotEqual(hfont, font.ToHfont());

                Font newFont = Font.FromHfont(hfont);
                Assert.Equal(font.Name, newFont.Name);
            }
        }
FontTests