@@ -24,29 +24,30 @@ This file is part of the iText (R) project.
24
24
25
25
import com .itextpdf .html2pdf .ConverterProperties ;
26
26
import com .itextpdf .html2pdf .HtmlConverter ;
27
- import com .itextpdf .html2pdf .logs .Html2PdfLogMessageConstant ;
28
27
import com .itextpdf .html2pdf .exceptions .Html2PdfException ;
28
+ import com .itextpdf .html2pdf .logs .Html2PdfLogMessageConstant ;
29
29
import com .itextpdf .html2pdf .resolver .font .DefaultFontProvider ;
30
30
import com .itextpdf .io .logs .IoLogMessageConstant ;
31
31
import com .itextpdf .io .util .UrlUtil ;
32
32
import com .itextpdf .kernel .utils .CompareTool ;
33
33
import com .itextpdf .layout .font .FontProvider ;
34
+ import com .itextpdf .layout .font .selectorstrategy .BestMatchFontSelectorStrategy .BestMatchFontSelectorStrategyFactory ;
34
35
import com .itextpdf .styledxmlparser .css .media .MediaDeviceDescription ;
35
36
import com .itextpdf .styledxmlparser .css .media .MediaType ;
36
37
import com .itextpdf .test .ExtendedITextTest ;
37
38
import com .itextpdf .test .annotations .LogMessage ;
38
39
import com .itextpdf .test .annotations .LogMessages ;
39
40
import com .itextpdf .test .annotations .type .IntegrationTest ;
41
+
42
+ import java .io .ByteArrayOutputStream ;
43
+ import java .io .File ;
44
+ import java .io .IOException ;
40
45
import org .junit .Assert ;
41
46
import org .junit .BeforeClass ;
42
47
import org .junit .Ignore ;
43
48
import org .junit .Test ;
44
49
import org .junit .experimental .categories .Category ;
45
50
46
- import java .io .ByteArrayOutputStream ;
47
- import java .io .File ;
48
- import java .io .IOException ;
49
-
50
51
@ Category (IntegrationTest .class )
51
52
public class FontFaceTest extends ExtendedITextTest {
52
53
public static final String sourceFolder = "./src/test/resources/com/itextpdf/html2pdf/css/FontFaceTest/" ;
@@ -290,19 +291,20 @@ public void doNotDownloadUnusedFontTest() throws IOException, InterruptedExcepti
290
291
}
291
292
292
293
@ Test
293
- //TODO: update after DEVSIX-2052
294
294
public void correctUrlWithUsedUnicodeRangeTest () throws IOException , InterruptedException {
295
- runTest ("correctUrlWithUsedUnicodeRangeTest" );
295
+ FontProvider fontProvider = new DefaultFontProvider ();
296
+ fontProvider .setFontSelectorStrategyFactory (new BestMatchFontSelectorStrategyFactory ());
297
+ runTest ("correctUrlWithUsedUnicodeRangeTest" , fontProvider );
296
298
}
297
299
298
300
@ Test
299
- //TODO: update after DEVSIX-2052
300
301
public void correctUnicodeRangeSignificantTest () throws IOException , InterruptedException {
301
- runTest ("correctUnicodeRangeSignificantTest" );
302
+ FontProvider fontProvider = new DefaultFontProvider ();
303
+ fontProvider .setFontSelectorStrategyFactory (new BestMatchFontSelectorStrategyFactory ());
304
+ runTest ("correctUnicodeRangeSignificantTest" , fontProvider );
302
305
}
303
306
304
307
@ Test
305
- // TODO DEVSIX-2052
306
308
public void overwrittenUnicodeRangeTextInLineTest () throws IOException , InterruptedException {
307
309
runTest ("overwrittenUnicodeRangeTextInLineTest" );
308
310
}
@@ -327,7 +329,7 @@ public void unusedFontWithUnicodeRangeTest() throws IOException, InterruptedExce
327
329
runTest ("unusedFontWithUnicodeRangeTest" );
328
330
}
329
331
330
- private void runTest (String name ) throws IOException , InterruptedException {
332
+ private void runTest (String name , FontProvider fontProvider ) throws IOException , InterruptedException {
331
333
String htmlPath = sourceFolder + name + ".html" ;
332
334
String pdfPath = destinationFolder + name + ".pdf" ;
333
335
String cmpPdfPath = sourceFolder + "cmp_" + name + ".pdf" ;
@@ -336,9 +338,13 @@ private void runTest(String name) throws IOException, InterruptedException {
336
338
337
339
ConverterProperties converterProperties = new ConverterProperties ()
338
340
.setMediaDeviceDescription (new MediaDeviceDescription (MediaType .PRINT ))
339
- .setFontProvider (new DefaultFontProvider () );
341
+ .setFontProvider (fontProvider );
340
342
HtmlConverter .convertToPdf (new File (htmlPath ), new File (pdfPath ), converterProperties );
341
343
Assert .assertFalse ("Temporary font was found." , converterProperties .getFontProvider ().getFontSet ().contains ("droid serif" ));
342
344
Assert .assertNull (new CompareTool ().compareByContent (pdfPath , cmpPdfPath , destinationFolder , diffPrefix ));
343
345
}
346
+
347
+ private void runTest (String name ) throws IOException , InterruptedException {
348
+ runTest (name , new DefaultFontProvider ());
349
+ }
344
350
}
0 commit comments