Beispiel #1
0
 private void AssertSelectedFont(ICollection <FontInfo> fontInfoCollection, IList <String> fontFamilies, FontCharacteristics
                                 fc, String expectedFontName)
 {
     NUnit.Framework.Assert.AreEqual(expectedFontName, new FontSelector(fontInfoCollection, fontFamilies, fc).BestMatch
                                         ().GetDescriptor().GetFontName());
 }
Beispiel #2
0
        private void CheckSelector(ICollection <FontInfo> fontInfoCollection, String fontFamily, String expectedNormal
                                   , String expectedBold, String expectedItalic, String expectedBoldItalic)
        {
            IList <String> fontFamilies = new List <String>();

            fontFamilies.Add(fontFamily);
            // Normal
            FontCharacteristics fc = new FontCharacteristics();

            AssertSelectedFont(fontInfoCollection, fontFamilies, fc, expectedNormal);
            fc = new FontCharacteristics();
            fc.SetFontWeight((short)300);
            AssertSelectedFont(fontInfoCollection, fontFamilies, fc, expectedNormal);
            fc = new FontCharacteristics();
            fc.SetFontWeight((short)100);
            AssertSelectedFont(fontInfoCollection, fontFamilies, fc, expectedNormal);
            fc = new FontCharacteristics();
            fc.SetFontWeight("normal");
            AssertSelectedFont(fontInfoCollection, fontFamilies, fc, expectedNormal);
            fc = new FontCharacteristics();
            fc.SetFontStyle("normal");
            AssertSelectedFont(fontInfoCollection, fontFamilies, fc, expectedNormal);
            // Bold
            fc = new FontCharacteristics();
            fc.SetBoldFlag(true);
            AssertSelectedFont(fontInfoCollection, fontFamilies, fc, expectedBold);
            fc = new FontCharacteristics();
            fc.SetFontWeight("bold");
            AssertSelectedFont(fontInfoCollection, fontFamilies, fc, expectedBold);
            fc = new FontCharacteristics();
            fc.SetFontWeight((short)700);
            AssertSelectedFont(fontInfoCollection, fontFamilies, fc, expectedBold);
            fc = new FontCharacteristics();
            fc.SetFontWeight((short)800);
            AssertSelectedFont(fontInfoCollection, fontFamilies, fc, expectedBold);
            // Italic
            fc = new FontCharacteristics();
            fc.SetFontStyle("italic");
            AssertSelectedFont(fontInfoCollection, fontFamilies, fc, expectedItalic);
            fc = new FontCharacteristics();
            fc.SetFontStyle("italic");
            fc.SetFontWeight("normal");
            AssertSelectedFont(fontInfoCollection, fontFamilies, fc, expectedItalic);
            fc = new FontCharacteristics();
            fc.SetFontStyle("italic");
            fc.SetFontWeight((short)300);
            AssertSelectedFont(fontInfoCollection, fontFamilies, fc, expectedItalic);
            fc = new FontCharacteristics();
            fc.SetFontStyle("italic");
            fc.SetFontWeight((short)500);
            AssertSelectedFont(fontInfoCollection, fontFamilies, fc, expectedItalic);
            fc = new FontCharacteristics();
            fc.SetFontStyle("oblique");
            AssertSelectedFont(fontInfoCollection, fontFamilies, fc, expectedItalic);
            // BoldItalic
            fc = new FontCharacteristics();
            fc.SetFontStyle("italic");
            fc.SetFontWeight("bold");
            AssertSelectedFont(fontInfoCollection, fontFamilies, fc, expectedBoldItalic);
            fc = new FontCharacteristics();
            fc.SetFontStyle("oblique");
            fc.SetFontWeight("bold");
            AssertSelectedFont(fontInfoCollection, fontFamilies, fc, expectedBoldItalic);
            fc = new FontCharacteristics();
            fc.SetFontStyle("italic");
            fc.SetFontWeight((short)700);
            AssertSelectedFont(fontInfoCollection, fontFamilies, fc, expectedBoldItalic);
            fc = new FontCharacteristics();
            fc.SetFontStyle("italic");
            fc.SetFontWeight((short)800);
            AssertSelectedFont(fontInfoCollection, fontFamilies, fc, expectedBoldItalic);
        }