Skip to content

Commit 5a2b571

Browse files
author
Andrei Stryhelski
committed
Add Break tests
DEVSIX-7576
1 parent 9b62d2e commit 5a2b571

File tree

104 files changed

+1803
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+1803
-0
lines changed
Lines changed: 325 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,325 @@
1+
package com.itextpdf.html2pdf.css.multicol;
2+
3+
import com.itextpdf.html2pdf.ConverterProperties;
4+
import com.itextpdf.html2pdf.ExtendedHtmlConversionITextTest;
5+
import com.itextpdf.html2pdf.logs.Html2PdfLogMessageConstant;
6+
import com.itextpdf.test.annotations.LogMessage;
7+
import com.itextpdf.test.annotations.LogMessages;
8+
import com.itextpdf.test.annotations.type.IntegrationTest;
9+
10+
import java.io.IOException;
11+
import org.junit.BeforeClass;
12+
import org.junit.Test;
13+
import org.junit.experimental.categories.Category;
14+
15+
@Category(IntegrationTest.class)
16+
public class BreakTest extends ExtendedHtmlConversionITextTest {
17+
public static final String SOURCE_FOLDER = "./src/test/resources/com/itextpdf/html2pdf/css/multicol/BreakTest/";
18+
public static final String DESTINATION_FOLDER = "./target/test/com/itextpdf/html2pdf/css/multicol/BreakTest/";
19+
20+
@BeforeClass
21+
public static void beforeClass() {
22+
createOrClearDestinationFolder(DESTINATION_FOLDER);
23+
}
24+
25+
@Test
26+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
27+
public void convertBreakBeforeAutoTest() throws IOException, InterruptedException {
28+
runTest("breakBeforeAutoTest");
29+
}
30+
31+
@Test
32+
public void convertPageBreakBeforeAutoTest() throws IOException, InterruptedException {
33+
runTest("pageBreakBeforeAutoTest");
34+
}
35+
36+
@Test
37+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
38+
public void convertBreakBeforeAutoInsideColTest() throws IOException, InterruptedException {
39+
runTest("breakBeforeAutoInsideColTest");
40+
}
41+
42+
@Test
43+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
44+
public void convertBreakBeforeAlwaysTest() throws IOException, InterruptedException {
45+
runTest("breakBeforeAlwaysTest");
46+
}
47+
48+
@Test
49+
public void convertPageBreakBeforeAlwaysTest() throws IOException, InterruptedException {
50+
runTest("pageBreakBeforeAlwaysTest");
51+
}
52+
53+
@Test
54+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
55+
public void convertBreakBeforeAvoidTest() throws IOException, InterruptedException {
56+
runTest("breakBeforeAvoidTest");
57+
}
58+
59+
@Test
60+
public void convertPageBreakBeforeAvoidTest() throws IOException, InterruptedException {
61+
runTest("pageBreakBeforeAvoidTest");
62+
}
63+
@Test
64+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
65+
public void convertBreakBeforeAvoidInsideColTest() throws IOException, InterruptedException {
66+
runTest("breakBeforeAvoidInsideColTest");
67+
}
68+
69+
@Test
70+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
71+
public void convertBreakBeforeAllTest() throws IOException, InterruptedException {
72+
runTest("breakBeforeAllTest");
73+
}
74+
75+
@Test
76+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
77+
public void convertBreakBeforeAvoidPageTest() throws IOException, InterruptedException {
78+
runTest("breakBeforeAvoidPageTest");
79+
}
80+
81+
@Test
82+
public void convertPageBreakBeforeAvoidPageTest() throws IOException, InterruptedException {
83+
runTest("pageBreakBeforeAvoidPageTest");
84+
}
85+
86+
@Test
87+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
88+
public void convertBreakBeforeAvoidPageInsideColumnTest() throws IOException, InterruptedException {
89+
runTest("breakBeforeAvoidPageInsideColumnTest");
90+
}
91+
92+
@Test
93+
public void convertPageBreakBeforeAvoidInsideColumnTest() throws IOException, InterruptedException {
94+
runTest("pageBreakBeforeAvoidInsideColumnTest");
95+
}
96+
97+
@Test
98+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
99+
public void convertBreakBeforePageTest() throws IOException, InterruptedException {
100+
runTest("breakBeforePageTest");
101+
}
102+
103+
@Test
104+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
105+
public void convertBreakBeforePageInsideColumnTest() throws IOException, InterruptedException {
106+
runTest("breakBeforePageInsideColumnTest");
107+
}
108+
109+
@Test
110+
// TODO DEVSIX-7552 Column-count: support break-inside, break-after and break-before properties
111+
@LogMessages(messages = {
112+
@LogMessage(messageTemplate = Html2PdfLogMessageConstant.ELEMENT_DOES_NOT_FIT_CURRENT_AREA)})
113+
public void convertPageBreakBeforePageInsideColumnTest() throws IOException, InterruptedException {
114+
runTest("pageBreakBeforePageInsideColumnTest");
115+
}
116+
117+
@Test
118+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
119+
public void convertBreakBeforeLeftTest() throws IOException, InterruptedException {
120+
runTest("breakBeforeLeftTest");
121+
}
122+
123+
@Test
124+
public void convertPageBreakBeforeLeftTest() throws IOException, InterruptedException {
125+
runTest("pageBreakBeforeLeftTest");
126+
}
127+
128+
@Test
129+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
130+
public void convertBreakBeforeRightTest() throws IOException, InterruptedException {
131+
runTest("breakBeforeRightTest");
132+
}
133+
134+
@Test
135+
public void convertPageBreakBeforeRightTest() throws IOException, InterruptedException {
136+
runTest("pageBreakBeforeRightTest");
137+
}
138+
139+
@Test
140+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
141+
public void convertBreakBeforeAvoidColumnTest() throws IOException, InterruptedException {
142+
runTest("breakBeforeAvoidColumnTest");
143+
}
144+
145+
@Test
146+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
147+
public void convertBreakBeforeColumnTest() throws IOException, InterruptedException {
148+
runTest("breakBeforeColumnTest");
149+
}
150+
151+
@Test
152+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
153+
public void convertBreakAfterAutoTest() throws IOException, InterruptedException {
154+
runTest("breakAfterAutoTest");
155+
}
156+
157+
@Test
158+
public void convertPageBreakAfterAutoTest() throws IOException, InterruptedException {
159+
runTest("pageBreakAfterAutoTest");
160+
}
161+
162+
@Test
163+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
164+
public void convertBreakAfterAutoInsideColTest() throws IOException, InterruptedException {
165+
runTest("breakAfterAutoInsideColTest");
166+
}
167+
168+
@Test
169+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
170+
public void convertBreakAfterAlwaysTest() throws IOException, InterruptedException {
171+
runTest("breakAfterAlwaysTest");
172+
}
173+
174+
@Test
175+
public void convertPageBreakAfterAlwaysTest() throws IOException, InterruptedException {
176+
runTest("pageBreakAfterAlwaysTest");
177+
}
178+
179+
@Test
180+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
181+
public void convertBreakAfterAvoidTest() throws IOException, InterruptedException {
182+
runTest("breakAfterAvoidTest");
183+
}
184+
185+
@Test
186+
// TODO DEVSIX-7552 Column-count: support break-inside, break-after and break-before properties
187+
public void convertPageBreakAfterAvoidTest() throws IOException, InterruptedException {
188+
runTest("pageBreakAfterAvoidTest");
189+
}
190+
191+
@Test
192+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
193+
public void convertBreakAfterAvoidInsideColTest() throws IOException, InterruptedException {
194+
runTest("breakAfterAvoidInsideColTest");
195+
}
196+
197+
@Test
198+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
199+
public void convertBreakAfterAllTest() throws IOException, InterruptedException {
200+
runTest("breakAfterAllTest");
201+
}
202+
203+
@Test
204+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
205+
public void convertBreakAfterAvoidPageTest() throws IOException, InterruptedException {
206+
runTest("breakAfterAvoidPageTest");
207+
}
208+
209+
@Test
210+
public void convertPageBreakAfterAvoidPageTest() throws IOException, InterruptedException {
211+
runTest("pageBreakAfterAvoidPageTest");
212+
}
213+
214+
@Test
215+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
216+
public void convertBreakAfterAvoidPageInsideColumnTest() throws IOException, InterruptedException {
217+
runTest("breakAfterAvoidPageInsideColumnTest");
218+
}
219+
220+
@Test
221+
public void convertPageBreakAfterAvoidInsideColumnTest() throws IOException, InterruptedException {
222+
runTest("pageBreakAfterAvoidInsideColumnTest");
223+
}
224+
225+
@Test
226+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
227+
public void convertBreakAfterPageTest() throws IOException, InterruptedException {
228+
runTest("breakAfterPageTest");
229+
}
230+
231+
@Test
232+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
233+
public void convertBreakAfterPageInsideColumnTest() throws IOException, InterruptedException {
234+
runTest("breakAfterPageInsideColumnTest");
235+
}
236+
237+
@Test
238+
@LogMessages(messages = {
239+
@LogMessage(messageTemplate = Html2PdfLogMessageConstant.ELEMENT_DOES_NOT_FIT_CURRENT_AREA)})
240+
public void convertPageBreakAfterPageInsideColumnTest() throws IOException, InterruptedException {
241+
runTest("pageBreakAfterPageInsideColumnTest");
242+
}
243+
244+
@Test
245+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
246+
public void convertBreakAfterLeftTest() throws IOException, InterruptedException {
247+
runTest("breakAfterLeftTest");
248+
}
249+
250+
@Test
251+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
252+
public void convertPageBreakAfterLeftTest() throws IOException, InterruptedException {
253+
runTest("pageBreakAfterLeftTest");
254+
}
255+
256+
@Test
257+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
258+
public void convertBreakAfterRightTest() throws IOException, InterruptedException {
259+
runTest("breakAfterRightTest");
260+
}
261+
262+
@Test
263+
public void convertPageBreakAfterRightTest() throws IOException, InterruptedException {
264+
runTest("pageBreakAfterRightTest");
265+
}
266+
267+
@Test
268+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
269+
public void convertBreakAfterAvoidColumnTest() throws IOException, InterruptedException {
270+
runTest("breakAfterAvoidColumnTest");
271+
}
272+
273+
@Test
274+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
275+
public void convertBreakAfterColumnTest() throws IOException, InterruptedException {
276+
runTest("breakAfterColumnTest");
277+
}
278+
279+
@Test
280+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
281+
public void convertBreakInsideAutoTest() throws IOException, InterruptedException {
282+
runTest("breakInsideAutoTest");
283+
}
284+
285+
@Test
286+
public void convertPageBreakInsideAutoTest() throws IOException, InterruptedException {
287+
runTest("pageBreakInsideAutoTest");
288+
}
289+
290+
@Test
291+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
292+
public void convertBreakInsideAvoidTest() throws IOException, InterruptedException {
293+
runTest("breakInsideAvoidTest");
294+
}
295+
296+
@Test
297+
// TODO DEVSIX-7552 Column-count: support break-inside, break-after and break-before properties
298+
public void convertPageBreakInsideAvoidTest() throws IOException, InterruptedException {
299+
runTest("pageBreakInsideAvoidTest");
300+
}
301+
302+
@Test
303+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
304+
public void convertBreakInsideAvoidInsideColumnTest() throws IOException, InterruptedException {
305+
runTest("breakInsideAvoidInsideColumnTest");
306+
}
307+
308+
@Test
309+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
310+
public void convertBreakInsideAvoidPageTest() throws IOException, InterruptedException {
311+
runTest("breakInsideAvoidPageTest");
312+
}
313+
314+
@Test
315+
// TODO DEVSIX-3819 support break-after, break-before, break-inside CSS properties
316+
public void convertBreakInsideAvoidColumnTest() throws IOException, InterruptedException {
317+
runTest("breakInsideAvoidColumnTest");
318+
}
319+
320+
private void runTest(String testName) throws IOException, InterruptedException {
321+
convertToPdfAndCompare(testName,
322+
SOURCE_FOLDER, DESTINATION_FOLDER, false,
323+
new ConverterProperties().setMulticolEnabled(true).setBaseUri(SOURCE_FOLDER));
324+
}
325+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head> </head>
4+
<body>
5+
<p style="height: 500px; width: 400px; background-color: green">
6+
Test paragraph
7+
</p>
8+
<p style="column-count: 3; background-color: gray; margin-bottom: 100px">
9+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae
10+
fringilla mauris. Quisque commodo eget nisi sed pretium. Mauris luctus nec
11+
lacus in ultricies. Mauris vitae hendrerit arcu, ac scelerisque lacus.
12+
Aliquam lobortis in lacus sit amet posuere. Fusce iaculis urna id neque
13+
dapibus, eu lacinia lectus dictum.
14+
</p>
15+
<p style="column-count: 2; break-after: all; background-color: red">
16+
Praesent condimentum dui dui, sit amet rutrum diam tincidunt eu. Cras
17+
suscipit porta leo sit amet rutrum. Sed vehicula ornare tincidunt.
18+
</p>
19+
<p style="background-color: green">
20+
Curabitur a ipsum ac diam mattis volutpat ac ut elit. Nullam luctus justo
21+
non vestibulum gravida. Morbi metus libero, pharetra non porttitor a,
22+
molestie nec nisi.
23+
</p>
24+
</body>
25+
</html>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head> </head>
4+
<body>
5+
<p style="height: 700px; width: 400px; background-color: green">
6+
Test paragraph
7+
</p>
8+
<p
9+
style="
10+
column-count: 3;
11+
background-color: gray;
12+
margin-bottom: 100px;
13+
break-after: always;
14+
"
15+
>
16+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vitae
17+
fringilla mauris. Quisque commodo eget nisi sed pretium. Mauris luctus nec
18+
lacus in ultricies. Mauris vitae hendrerit arcu, ac scelerisque lacus.
19+
Aliquam lobortis in lacus sit amet posuere. Fusce iaculis urna id neque
20+
dapibus, eu lacinia lectus dictum.
21+
</p>
22+
<p style="column-count: 2; background-color: red">
23+
Praesent condimentum dui dui, sit amet rutrum diam tincidunt eu. Cras
24+
suscipit porta leo sit amet rutrum. Sed vehicula ornare tincidunt.
25+
Curabitur a ipsum ac diam mattis volutpat ac ut elit. Nullam luctus justo
26+
non vestibulum gravida. Morbi metus libero, pharetra non porttitor a,
27+
molestie nec nisi.
28+
</p>
29+
</body>
30+
</html>

0 commit comments

Comments
 (0)