Skip to content

Commit 50a5816

Browse files
Add functional ranges tests from html2pdf private
1 parent 05dd49d commit 50a5816

7 files changed

+137
-0
lines changed

src/test/java/com/itextpdf/html2pdf/css/FontFaceTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,24 @@ public void texFonts01() throws IOException, InterruptedException {
275275
runTest("texFonts01");
276276
}
277277

278+
@Test
279+
//TODO: update/refactor after DEVSIX-2054 fix
280+
public void correctUrlWithNotUsedUnicodeRangeTest() throws IOException, InterruptedException {
281+
runTest("correctUrlWithNotUsedUnicodeRangeTest");
282+
}
283+
284+
@Test
285+
//TODO: update after DEVSIX-2052 and probably DEVSIX-2034 fix
286+
public void correctUrlWithUsedUnicodeRangeTest() throws IOException, InterruptedException {
287+
runTest("correctUrlWithUsedUnicodeRangeTest");
288+
}
289+
290+
@Test
291+
//TODO: update after DEVSIX-2052 and probably DEVSIX-2034 fix
292+
public void correctUnicodeRangeSignificantTest() throws IOException, InterruptedException {
293+
runTest("correctUnicodeRangeSignificantTest");
294+
}
295+
278296
private void runTest(String name) throws IOException, InterruptedException {
279297
String htmlPath = sourceFolder + name + ".html";
280298
String pdfPath = destinationFolder + name + ".pdf";
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<style>
6+
7+
/*numbers*/
8+
@font-face {
9+
font-family: 'WithRanges';
10+
src: url("web-fonts/droid-serif-italic.ttf");
11+
unicode-range: U+0030-0039;
12+
}
13+
14+
/*capital letters*/
15+
@font-face {
16+
font-family: 'WithRanges';
17+
src: url("web-fonts/droid-serif-bold.ttf");
18+
unicode-range: U+0041-005A;
19+
}
20+
21+
/*letters*/
22+
@font-face {
23+
font-family: 'WithRanges';
24+
src: url("web-fonts/droid-serif-regular.ttf");
25+
unicode-range: U+0061-007A;
26+
}
27+
28+
div {
29+
font-family: 'WithRanges';
30+
font-size: 10pt;
31+
}
32+
33+
</style>
34+
</head>
35+
<body>
36+
<div>In demographics, <br>
37+
the world population <br>
38+
is the total number <br>
39+
of humans currently living, <br>
40+
and was estimated <br>
41+
to have reached <br>
42+
7.6 billion people <br>
43+
as of May 2018.</div>
44+
</body>
45+
</html>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<style>
6+
7+
@font-face {
8+
font-family: 'Droid1';
9+
src: url("web-fonts/droid-serif-italic.ttf") ;
10+
unicode-range:U+6d;
11+
}
12+
13+
@font-face {
14+
font-family: 'Droid2';
15+
src: url("web-fonts/droid-serif-bold.ttf") ;
16+
unicode-range:U+6d;
17+
}
18+
19+
div.droid1 {
20+
font-family: 'Droid1';
21+
}
22+
23+
div.droid2 {
24+
font-family: 'Droid2';
25+
}
26+
27+
div {
28+
font-size: 4em;
29+
}
30+
</style>
31+
</head>
32+
<body>
33+
<div class="droid1">a</div>
34+
<div class="droid2">a</div>
35+
36+
</body>
37+
</html>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<style>
6+
7+
@font-face {
8+
font-family: 'Droid1';
9+
src: url("web-fonts/droid-serif-italic.ttf") ;
10+
unicode-range:U+6d;
11+
}
12+
13+
@font-face {
14+
font-family: 'Droid2';
15+
src: url("web-fonts/droid-serif-bold.ttf") ;
16+
unicode-range:U+6d;
17+
}
18+
19+
div.droid1 {
20+
font-family: 'Droid1';
21+
}
22+
23+
div.droid2 {
24+
font-family: 'Droid2';
25+
}
26+
27+
div {
28+
font-size: 4em;
29+
}
30+
</style>
31+
</head>
32+
<body>
33+
<div class="droid1">m letter<br> corresponds to u+6d only </div>
34+
<div class="droid2">m>> letter<br> corresponds to u+6d only</div>
35+
36+
</body>
37+
</html>

0 commit comments

Comments
 (0)