Skip to content

Commit aeb45e4

Browse files
author
Kate Ivanova
committed
Move tests from FT repository
DEVSIX-3038
1 parent 26ee10d commit aeb45e4

File tree

11 files changed

+290
-3
lines changed

11 files changed

+290
-3
lines changed

src/test/java/com/itextpdf/html2pdf/attribute/DirAttributeTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ This file is part of the iText (R) project.
4747

4848
import java.io.IOException;
4949

50+
import org.junit.Assert;
5051
import org.junit.BeforeClass;
5152
import org.junit.Test;
5253
import org.junit.experimental.categories.Category;
@@ -64,10 +65,11 @@ public static void beforeClass() {
6465

6566
@Test
6667
public void rtlDir01Test() throws IOException, InterruptedException {
67-
convertToPdfAndCompare("rtlDirTest01", sourceFolder, destinationFolder);}
68+
convertToPdfAndCompare("rtlDirTest01", sourceFolder, destinationFolder);
69+
}
6870

6971
@Test
7072
public void rtlDir02Test() throws IOException, InterruptedException {
71-
convertToPdfAndCompare("rtlDirTest02", sourceFolder, destinationFolder);}
72-
73+
convertToPdfAndCompare("rtlDirTest02", sourceFolder, destinationFolder);
74+
}
7375
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,10 @@ public void overflowAndAlignment01() throws IOException, InterruptedException {
8686
public void overflowAndAlignment02() throws IOException, InterruptedException {
8787
convertToPdfAndCompare("overflowAndAlignment02", sourceFolder, destinationFolder);
8888
}
89+
90+
@Test
91+
//TODO: update after DEVSIX-2502 fix
92+
public void displayOverflowAutoScroll() throws IOException, InterruptedException {
93+
convertToPdfAndCompare("displayOverflowAutoScroll", sourceFolder, destinationFolder);
94+
}
8995
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ This file is part of the iText (R) project.
4747
import com.itextpdf.test.annotations.LogMessage;
4848
import com.itextpdf.test.annotations.LogMessages;
4949
import com.itextpdf.test.annotations.type.IntegrationTest;
50+
import org.junit.Assert;
5051
import org.junit.BeforeClass;
5152
import org.junit.Ignore;
5253
import org.junit.Test;
@@ -131,6 +132,13 @@ public void whiteSpaceTest03() throws IOException, InterruptedException {
131132
convertToPdfAndCompare("whiteSpaceTest03", sourceFolder, destinationFolder);
132133
}
133134

135+
@Test
136+
@LogMessages(messages = @LogMessage(messageTemplate = com.itextpdf.io.LogMessageConstant.TABLE_WIDTH_IS_MORE_THAN_EXPECTED_DUE_TO_MIN_WIDTH))
137+
//TODO: fix after DEVSIX-2447. To reproduce without error, remove "white-space: pre;" (pre-wrap, pre-line)
138+
public void checkWhiteSpaceCss() throws IOException, InterruptedException {
139+
convertToPdfAndCompare("checkWhiteSpaceCss", sourceFolder, destinationFolder);
140+
}
141+
134142
@Test
135143
public void whiteSpaceNowrapBasicTest01() throws IOException, InterruptedException {
136144
convertToPdfAndCompare("whiteSpaceNowrapBasicTest01", sourceFolder, destinationFolder);

src/test/java/com/itextpdf/html2pdf/element/ImageTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,10 @@ public void imagesWithWidePaddingsBordersMargins() throws IOException, Interrupt
9898
Assert.assertNull(new CompareTool().compareByContent(destinationFolder + "imagesWithWidePaddingsBordersMargins.pdf", sourceFolder + "cmp_imagesWithWidePaddingsBordersMargins.pdf", destinationFolder));
9999
}
100100

101+
@Test
102+
public void checkImageBorderRadius() throws IOException, InterruptedException {
103+
HtmlConverter.convertToPdf(new File(sourceFolder + "checkImageBorderRadius.html"), new File(destinationFolder + "checkImageBorderRadius.pdf"));
104+
Assert.assertNull(new CompareTool().compareByContent(destinationFolder + "checkImageBorderRadius.pdf", sourceFolder + "cmp_checkImageBorderRadius.pdf", destinationFolder));
105+
}
106+
101107
}
Binary file not shown.
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<style>
5+
div.ex1 {
6+
background-color: lightblue;
7+
width: 200px;
8+
height: 220px;
9+
overflow: scroll;
10+
}
11+
12+
div.ex2 {
13+
background-color: lightblue;
14+
width: 200px;
15+
height: 220px;
16+
overflow: hidden;
17+
}
18+
19+
div.ex3 {
20+
background-color: lightblue;
21+
width: 200px;
22+
height: 220px;
23+
overflow: auto;
24+
}
25+
26+
div.ex4 {
27+
background-color: lightblue;
28+
width: 200px;
29+
height: 220px;
30+
overflow: visible;
31+
}
32+
span.internalScroll {
33+
background-color: magenta;
34+
overflow: scroll;
35+
}
36+
span.internalAuto {
37+
background-color: magenta;
38+
overflow: auto;
39+
}
40+
span.internalHidden {
41+
background-color: magenta;
42+
overflow: hidden;
43+
}
44+
span.internalVisible {
45+
background-color: magenta;
46+
overflow: visible;
47+
}
48+
</style>
49+
</head>
50+
<body>
51+
<h1>The overflow Property</h1>
52+
53+
<p>The overflow property specifies whether to clip content or to add scrollbars when an element's content is too big to fit in a specified area.</p>
54+
<ul><li>div.ex1 {
55+
background-color: lightblue;
56+
width: 200px;
57+
height: 220px;
58+
overflow: scroll;
59+
}</li><li>
60+
61+
div.ex2 {
62+
background-color: lightblue;
63+
width: 200px;
64+
height: 220px;
65+
overflow: hidden;
66+
}</li><li>
67+
68+
div.ex3 {
69+
background-color: lightblue;
70+
width: 200px;
71+
height: 220px;
72+
overflow: auto;
73+
}</li><li>
74+
75+
div.ex4 {
76+
background-color: lightblue;
77+
width: 200px;
78+
height: 220px;
79+
overflow: visible;
80+
}</li><li>
81+
span.internalScroll {
82+
background-color: magenta;
83+
overflow: scroll;
84+
}</li><li>
85+
span.internalAuto {
86+
background-color: magenta;
87+
overflow: auto;
88+
}</li><li>
89+
span.internalHidden {
90+
background-color: magenta;
91+
overflow: hidden;
92+
}</li><li>
93+
span.internalVisible {
94+
background-color: magenta;
95+
overflow: visible;
96+
}</li></ul>
97+
<h2>overflow: scroll for div, </h2>
98+
<div class="ex1">internal span Scroll: <span class="internalScroll">Some text is hereherehereherehereherehhhhhhhh 1 and hereherehereherehereherehhhhhhhh</span> should be magenta color for internal span, lightblue for parent div </div>
99+
100+
<br><div class="ex1">internal span Auto: <span class="internalAuto">Some text is hereherehereherehereherehhhhhhhh 1 and hereherehereherehereherehhhhhhhh</span> should be magenta color for internal span, lightblue for parent div </div>
101+
<br><div class="ex1">internal span Hidden: <span class="internalHidden">Some text is hereherehereherehereherehhhhhhhh 1 and hereherehereherehereherehhhhhhhh</span> should be magenta color for internal span, lightblue for parent div </div>
102+
<br><div class="ex1">internal span Visible: <span class="internalVisible">Some text is hereherehereherehereherehhhhhhhh 1 and hereherehereherehereherehhhhhhhh</span> should be magenta color for internal span, lightblue for parent div </div>
103+
104+
<h2>overflow: hidden:</h2>
105+
<div class="ex2">internal span Scroll: <span class="internalScroll">Some text is hereherehereherehereherehhhhhhhh 1 and hereherehereherehereherehhhhhhhh</span> should be magenta color for internal span, lightblue for parent div </div>
106+
107+
<br><div class="ex2">internal span Auto: <span class="internalAuto">Some text is hereherehereherehereherehhhhhhhh 1 and hereherehereherehereherehhhhhhhh</span> should be magenta color for internal span, lightblue for parent div </div>
108+
<br><div class="ex2">internal span Hidden: <span class="internalHidden">Some text is hereherehereherehereherehhhhhhhh 1 and hereherehereherehereherehhhhhhhh</span> should be magenta color for internal span, lightblue for parent div </div>
109+
<br><div class="ex2">internal span Visible: <span class="internalVisible">Some text is hereherehereherehereherehhhhhhhh 1 and hereherehereherehereherehhhhhhhh</span> should be magenta color for internal span, lightblue for parent div </div>
110+
111+
<h2>overflow: auto:</h2>
112+
<div class="ex3">internal span Scroll: <span class="internalScroll">Some text is hereherehereherehereherehhhhhhhh 1 and hereherehereherehereherehhhhhhhh</span> should be magenta color for internal span, lightblue for parent div </div>
113+
114+
<br><div class="ex3">internal span Auto: <span class="internalAuto">Some text is hereherehereherehereherehhhhhhhh 1 and hereherehereherehereherehhhhhhhh</span> should be magenta color for internal span, lightblue for parent div </div>
115+
<br><div class="ex3">internal span Hidden: <span class="internalHidden">Some text is hereherehereherehereherehhhhhhhh 1 and hereherehereherehereherehhhhhhhh</span> should be magenta color for internal span, lightblue for parent div </div>
116+
<br><div class="ex3">internal span Visible: <span class="internalVisible">Some text is hereherehereherehereherehhhhhhhh 1 and hereherehereherehereherehhhhhhhh</span> should be magenta color for internal span, lightblue for parent div </div>
117+
118+
<h2>overflow: visible (default):</h2>
119+
<div class="ex4">internal span Scroll: <span class="internalScroll">Some text is hereherehereherehereherehhhhhhhh 1 and hereherehereherehereherehhhhhhhh</span> should be magenta color for internal span, lightblue for parent div </div>
120+
<br>
121+
<br><br><div class="ex4">internal span Auto: <span class="internalAuto">Some text is hereherehereherehereherehhhhhhhh 1 and hereherehereherehereherehhhhhhhh</span> should be magenta color for internal span, lightblue for parent div </div>
122+
<br><br><br><div class="ex4">internal span Hidden: <span class="internalHidden">Some text is hereherehereherehereherehhhhhhhh 1 and hereherehereherehereherehhhhhhhh</span> should be magenta color for internal span, lightblue for parent div </div>
123+
<br><br><br><div class="ex4">internal span Visible: <span class="internalVisible">Some text is hereherehereherehereherehhhhhhhh 1 and hereherehereherehereherehhhhhhhh</span> should be magenta color for internal span, lightblue for parent div </div>
124+
125+
</body>
126+
</html>
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>White Space example</title>
5+
<style>
6+
table, tr, td {
7+
border: solid black;
8+
background:#ccf;
9+
font-size: 10pt;
10+
}
11+
12+
</style>
13+
</head>
14+
<body>
15+
<p>NORMAL: Sequences of white space are collapsed. Newline characters in the source are handled the same as other white space. Lines are broken as necessary to fill line boxes.</p>
16+
<table style="width: 400pt;">
17+
<tr>
18+
<td width="99%">white-space: normal;</td>
19+
<td style="white-space: normal;"> Whitespace character is <&#32;> here. non-breaking space <&#160;> here. OGHAM
20+
SPACE MARK <&#5760;> here. 2BR <<br><br>> here. CR(Carriage return (slash r) <&#13;>) and LF(Line feed
21+
(slash n) or <&#10;> here).
22+
CR LF <&#13;&#10;> here. LF CR <&#10;&#13;> here.Some very long text is here also. Some very long text is
23+
here also. Some very long text is here also.
24+
</td>
25+
</tr>
26+
</table>
27+
<br>
28+
<p>NOWRAP: Collapses white space as for normal, but suppresses line breaks (text wrapping) within the source.</p>
29+
<table style="width: 400pt;">
30+
<tr>
31+
<td style="width: 99%">white-space: nowrap;</td>
32+
<td style="white-space: nowrap;">Whitespace character is <&#32;> here. non-breaking space <&#160;> here. OGHAM
33+
SPACE MARK <&#5760;> here. 2BR <<br><br>> here. CR(Carriage return (slash r) <&#13;>) and LF(Line feed
34+
(slash n) or <&#10;> here).
35+
CR LF <&#13;&#10;> here. LF CR <&#10;&#13;> here.Some very long text is here also. Some very long text is
36+
here also. Some very long text is here also.
37+
</td>
38+
</tr>
39+
</table>
40+
<br>
41+
<p>PRE: Sequences of white space are preserved. Lines are only broken at newline characters in the source and at br elements.</p>
42+
<table style="width: 400pt;">
43+
<tr>
44+
<td width="99%">white-space: pre;</td>
45+
<td style="white-space: pre;"> Whitespace character is <&#32;> here. non-breaking space <&#160;> here. OGHAM
46+
SPACE MARK <&#5760;> here. 2BR <<br><br>> here. CR(Carriage return (slash r) <&#13;>) and LF(Line feed
47+
(slash n) or <&#10;> here).
48+
CR LF <&#13;&#10;> here. LF CR <&#10;&#13;> here.Some very long text is here also. Some very long text is
49+
here also. Some very long text is here also.
50+
</td>
51+
</tr>
52+
</table>
53+
<br>
54+
<p>PRE-WRAP: Sequences of white space are preserved. Lines are broken at newline characters, at br, and as necessary to fill line boxes.</p>
55+
<table style="width: 400pt;">
56+
<tr>
57+
<td width="99%">white-space: pre-wrap;</td>
58+
<td style="white-space: pre-wrap;"> Whitespace character is <&#32;> here. non-breaking space <&#160;> here. OGHAM
59+
SPACE MARK <&#5760;> here. 2BR <<br><br>> here. CR(Carriage return (slash r) <&#13;>) and LF(Line feed
60+
(slash n) or <&#10;> here).
61+
CR LF <&#13;&#10;> here. LF CR <&#10;&#13;> here.Some very long text is here also. Some very long text is
62+
here also. Some very long text is here also.
63+
</td>
64+
</tr>
65+
</table>
66+
<br>
67+
<p>PRE-LINE: Sequences of white space are collapsed. Lines are broken at newline characters, at br, and as necessary to fill line boxes.</p>
68+
<table style="width: 400pt;">
69+
<tr>
70+
<td width="99%">white-space: pre-line;</td>
71+
<td style="white-space: pre-line;"> Whitespace character is <&#32;> here. non-breaking space <&#160;> here.
72+
OGHAM SPACE MARK <&#5760;> here. 2BR <<br><br>> here. CR(Carriage return (slash r) <&#13;>) and LF(Line feed
73+
(slash n) or <&#10;> here).
74+
CR LF <&#13;&#10;> here. LF CR <&#10;&#13;> here.Some very long text is here also. Some very long text is
75+
here also. Some very long
76+
text is here also.
77+
</td>
78+
</tr>
79+
</table>
80+
</body>
81+
</html>
Binary file not shown.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Check image border radius</title>
6+
<style>
7+
.solid {
8+
border: 1pt solid black;
9+
}
10+
div {
11+
float: left;
12+
}
13+
14+
</style>
15+
</head>
16+
<body>
17+
<div>border-radius: 5pt 10pt 15pt 20pt; /* top left, top right, bottom right, bottom left */ </div>
18+
<img src="placeholder_100x100.png" style="border-radius: 5pt 10pt 15pt 20pt;" class="solid">
19+
<br>
20+
21+
<div>border-radius: 5px 10px 15px 20px; /* top left, top right, bottom right, bottom left */ </div>
22+
<img src="placeholder_100x100.png" style="border-radius: 5px 10px 15px 20px;" class="solid">
23+
<br>
24+
<div>border-top-left-radius: 15px;</div>
25+
<img src="placeholder_100x100.png" style="border-top-left-radius: 15px;" class="solid">
26+
<br>
27+
<div>border-bottom-right-radius: 70%</div>
28+
<img src="placeholder_100x100.png" style="border-bottom-right-radius: 70%;" class="solid">
29+
<br>
30+
<div>border-radius: 5% 10% 15% 20%; /* top left, top right, bottom right, bottom left */ </div>
31+
<img src="placeholder_100x100.png" style="border-radius: 5% 10% 15% 20%;" class="solid">
32+
<br>
33+
<div>border-radius: 5px 20px 35px; /* The second value applies to top-right and also bottom-left. */ </div>
34+
<img src="placeholder_100x100.png" style="border-radius: 5px 20px 35px;" class="solid">
35+
<br>
36+
<div>border-radius: 5px 20px; /* the first applies to top-left and bottom-right corner, the second - to top-right and bottom-left corner. */ </div>
37+
<img src="placeholder_100x100.png" style="border-radius: 5px 20px;" class="solid">
38+
<br>
39+
<div>border-radius: 40% 5px; /* the first applies to top-left and bottom-right corner, the second - to top-right and bottom-left corner. */ </div>
40+
<img src="placeholder_100x100.png" style="border-radius: 40% 5px;" class="solid">
41+
<br>
42+
<div>border-radius: 20px; /* this radius applies to all 4 corners. */ </div>
43+
<img src="placeholder_100x100.png" style="border-radius: 20px;" class="solid">
44+
<br>
45+
<div>border-radius: 40%; /* this radius applies to all 4 corners. */ </div>
46+
<img src="placeholder_100x100.png" style="border-radius: 40%;" class="solid">
47+
<br>
48+
<div>border-radius: 10px/30px; /* horizontal radius / vertical radius */ </div>
49+
<img src="placeholder_100x100.png" style="border-radius: 10px/30px;" class="solid">
50+
<br>
51+
<div>border-radius: 30px/10px; /* horizontal radius / vertical radius */ </div>
52+
<img src="placeholder_100x100.png" style="border-radius: 30px/10px;" class="solid">
53+
<br>
54+
<div>border-radius: 60px 45px 30px 15px/15px 30px 45px 60px;</div>
55+
<img src="placeholder_100x100.png" style="border-radius: 60px 45px 30px 15px/15px 30px 45px 60px;" class="solid">
56+
<br>
57+
</body>
58+
</html>
Binary file not shown.

0 commit comments

Comments
 (0)