Skip to content

Commit cf54906

Browse files
nikitakovaliov92iText-CI
authored andcommitted
Add unit test to check monospaceness
DEVSIX-6039
1 parent f5c6ea5 commit cf54906

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

layout/src/test/java/com/itextpdf/layout/FontSelectorTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,24 @@ public void openSansOutOfNotBoldFontWeightTest() {
10631063
new FontSelector(set.getFonts(), fontFamilies, fc).bestMatch().getDescriptor().getFontName());
10641064
}
10651065

1066+
@Test
1067+
//TODO DEVSIX-6077 FontSelector: iText checks monospaceness before looking at font-family
1068+
public void monospaceFontIsNotSelectedInPreferenceToTestFamilyTest() {
1069+
FontSet set = new FontSet();
1070+
set.addFont(StandardFonts.COURIER);
1071+
set.addFont(StandardFonts.HELVETICA);
1072+
1073+
List<String> fontFamilies = new ArrayList<>();
1074+
fontFamilies.add("test");
1075+
fontFamilies.add("monospace");
1076+
1077+
FontCharacteristics fc = new FontCharacteristics();
1078+
1079+
//Expected font is Courier
1080+
Assert.assertEquals("Helvetica",
1081+
new FontSelector(set.getFonts(), fontFamilies, fc).bestMatch().getDescriptor().getFontName());
1082+
}
1083+
10661084
private void checkSelector(Collection<FontInfo> fontInfoCollection, String fontFamily,
10671085
String expectedNormal, String expectedBold, String expectedItalic, String expectedBoldItalic) {
10681086
List<String> fontFamilies = new ArrayList<>();

0 commit comments

Comments
 (0)