@@ -24,29 +24,30 @@ This file is part of the iText (R) project.
2424
2525import com .itextpdf .html2pdf .ConverterProperties ;
2626import com .itextpdf .html2pdf .HtmlConverter ;
27- import com .itextpdf .html2pdf .logs .Html2PdfLogMessageConstant ;
2827import com .itextpdf .html2pdf .exceptions .Html2PdfException ;
28+ import com .itextpdf .html2pdf .logs .Html2PdfLogMessageConstant ;
2929import com .itextpdf .html2pdf .resolver .font .DefaultFontProvider ;
3030import com .itextpdf .io .logs .IoLogMessageConstant ;
3131import com .itextpdf .io .util .UrlUtil ;
3232import com .itextpdf .kernel .utils .CompareTool ;
3333import com .itextpdf .layout .font .FontProvider ;
34+ import com .itextpdf .layout .font .selectorstrategy .BestMatchFontSelectorStrategy .BestMatchFontSelectorStrategyFactory ;
3435import com .itextpdf .styledxmlparser .css .media .MediaDeviceDescription ;
3536import com .itextpdf .styledxmlparser .css .media .MediaType ;
3637import com .itextpdf .test .ExtendedITextTest ;
3738import com .itextpdf .test .annotations .LogMessage ;
3839import com .itextpdf .test .annotations .LogMessages ;
3940import com .itextpdf .test .annotations .type .IntegrationTest ;
41+
42+ import java .io .ByteArrayOutputStream ;
43+ import java .io .File ;
44+ import java .io .IOException ;
4045import org .junit .Assert ;
4146import org .junit .BeforeClass ;
4247import org .junit .Ignore ;
4348import org .junit .Test ;
4449import org .junit .experimental .categories .Category ;
4550
46- import java .io .ByteArrayOutputStream ;
47- import java .io .File ;
48- import java .io .IOException ;
49-
5051@ Category (IntegrationTest .class )
5152public class FontFaceTest extends ExtendedITextTest {
5253 public static final String sourceFolder = "./src/test/resources/com/itextpdf/html2pdf/css/FontFaceTest/" ;
@@ -290,19 +291,20 @@ public void doNotDownloadUnusedFontTest() throws IOException, InterruptedExcepti
290291 }
291292
292293 @ Test
293- //TODO: update after DEVSIX-2052
294294 public void correctUrlWithUsedUnicodeRangeTest () throws IOException , InterruptedException {
295- runTest ("correctUrlWithUsedUnicodeRangeTest" );
295+ FontProvider fontProvider = new DefaultFontProvider ();
296+ fontProvider .setFontSelectorStrategyFactory (new BestMatchFontSelectorStrategyFactory ());
297+ runTest ("correctUrlWithUsedUnicodeRangeTest" , fontProvider );
296298 }
297299
298300 @ Test
299- //TODO: update after DEVSIX-2052
300301 public void correctUnicodeRangeSignificantTest () throws IOException , InterruptedException {
301- runTest ("correctUnicodeRangeSignificantTest" );
302+ FontProvider fontProvider = new DefaultFontProvider ();
303+ fontProvider .setFontSelectorStrategyFactory (new BestMatchFontSelectorStrategyFactory ());
304+ runTest ("correctUnicodeRangeSignificantTest" , fontProvider );
302305 }
303306
304307 @ Test
305- // TODO DEVSIX-2052
306308 public void overwrittenUnicodeRangeTextInLineTest () throws IOException , InterruptedException {
307309 runTest ("overwrittenUnicodeRangeTextInLineTest" );
308310 }
@@ -327,7 +329,7 @@ public void unusedFontWithUnicodeRangeTest() throws IOException, InterruptedExce
327329 runTest ("unusedFontWithUnicodeRangeTest" );
328330 }
329331
330- private void runTest (String name ) throws IOException , InterruptedException {
332+ private void runTest (String name , FontProvider fontProvider ) throws IOException , InterruptedException {
331333 String htmlPath = sourceFolder + name + ".html" ;
332334 String pdfPath = destinationFolder + name + ".pdf" ;
333335 String cmpPdfPath = sourceFolder + "cmp_" + name + ".pdf" ;
@@ -336,9 +338,13 @@ private void runTest(String name) throws IOException, InterruptedException {
336338
337339 ConverterProperties converterProperties = new ConverterProperties ()
338340 .setMediaDeviceDescription (new MediaDeviceDescription (MediaType .PRINT ))
339- .setFontProvider (new DefaultFontProvider () );
341+ .setFontProvider (fontProvider );
340342 HtmlConverter .convertToPdf (new File (htmlPath ), new File (pdfPath ), converterProperties );
341343 Assert .assertFalse ("Temporary font was found." , converterProperties .getFontProvider ().getFontSet ().contains ("droid serif" ));
342344 Assert .assertNull (new CompareTool ().compareByContent (pdfPath , cmpPdfPath , destinationFolder , diffPrefix ));
343345 }
346+
347+ private void runTest (String name ) throws IOException , InterruptedException {
348+ runTest (name , new DefaultFontProvider ());
349+ }
344350}
0 commit comments