Skip to content

Commit 7eee081

Browse files
Eugene BochiloUbuntu
authored andcommitted
Make test be autoportable
DEVSIX-6305
1 parent 88c9cb7 commit 7eee081

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

io/src/test/java/com/itextpdf/io/font/FontProgramTest.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,12 @@ public void boldTest() throws IOException {
8080
public void registerDirectoryOpenTypeTest() {
8181
FontProgramFactory.clearRegisteredFonts();
8282
FontProgramFactory.clearRegisteredFontFamilies();
83-
int cacheSize = -1;
84-
try {
85-
Field f = FontCache.class.getDeclaredField("fontCache");
86-
f.setAccessible(true);
87-
Map<FontCacheKey, FontProgram> cachedFonts = ((Map<FontCacheKey, FontProgram>) f.get(null));
88-
cachedFonts.clear();
89-
FontProgramFactory.registerFontDirectory("./src/test/resources/com/itextpdf/io/font/otf/");
90-
cacheSize = cachedFonts.size();
91-
} catch (Exception e) { }
83+
FontCache.clearSavedFonts();
84+
FontProgramFactory.registerFontDirectory("./src/test/resources/com/itextpdf/io/font/otf/");
85+
9286
Assert.assertEquals(43, FontProgramFactory.getRegisteredFonts().size());
87+
Assert.assertNull(FontCache.getFont("./src/test/resources/com/itextpdf/io/font/otf/FreeSansBold.ttf"));
9388
Assert.assertTrue(FontProgramFactory.getRegisteredFonts().contains("free sans lihavoitu"));
94-
Assert.assertEquals(0, cacheSize);
9589
}
9690

9791
@Test

0 commit comments

Comments
 (0)