Skip to content

Commit 64fa962

Browse files
committed
Verify that nested multicol layouting works as expected and add tests
DEVSIX-7591
1 parent ee7763b commit 64fa962

File tree

8 files changed

+134
-18
lines changed

8 files changed

+134
-18
lines changed

src/test/java/com/itextpdf/html2pdf/css/multicol/ColumnCountTest.java

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ public void diffElementsInsidePTest() throws IOException, InterruptedException {
7171
runTest("diffElementsInsidePTest");
7272
}
7373

74-
//TODO: DEVSIX-7591 support nested multicol layouting
7574
@Test
7675
public void convertBasicFormTest() throws IOException, InterruptedException {
7776
runTest("basicFormTest");
@@ -82,7 +81,6 @@ public void convertBasicUlTest() throws IOException, InterruptedException {
8281
runTest("basicUlTest");
8382
}
8483

85-
//TODO: DEVSIX-7591 Support nested multicol layouting
8684
@Test
8785
public void convertBasicOlTest() throws IOException, InterruptedException {
8886
runTest("basicOlTest");
@@ -108,7 +106,6 @@ public void tableColspanRowspanTest() throws IOException, InterruptedException {
108106
runTest("tableColspanRowspanTest");
109107
}
110108

111-
//TODO: DEVSIX-7591 Support nested multicol layouting
112109
@Test
113110
public void convertBasicSectionTest() throws IOException, InterruptedException {
114111
runTest("basicSectionTest");
@@ -134,7 +131,6 @@ public void convertBasicDisplayPropertyTest() throws IOException, InterruptedExc
134131
runTest("basicDisplayPropertyTest");
135132
}
136133

137-
//TODO: DEVSIX-7591 Support nested multicol layouting
138134
@Test
139135
public void convertBasicDisplayPropertyWithNestedColumnsTest() throws IOException, InterruptedException {
140136
runTest("basicDisplayPropertyWithNestedColumnsTest");
@@ -217,6 +213,22 @@ public void basicFooterHeaderTest() throws IOException, InterruptedException {
217213
runTest("basicFooterHeaderTest");
218214
}
219215

216+
@Test
217+
public void tripleNestingTest() throws IOException, InterruptedException {
218+
runTest("tripleNestingTest");
219+
}
220+
221+
@Test
222+
public void nestingBetweenPagesTest() throws IOException, InterruptedException {
223+
runTest("nestingBetweenPagesTest");
224+
}
225+
226+
@Test
227+
// TODO DEVSIX-7628 Investigate problem with border near to end of the page in multicol layouting
228+
public void tripleNestingBetweenPagesTest() throws IOException, InterruptedException {
229+
runTest("tripleNestingBetweenPagesTest");
230+
}
231+
220232
@Test
221233
public void basicDlTest() throws IOException, InterruptedException {
222234
runTest("basicDlTest");
@@ -232,12 +244,6 @@ public void basicBlockquoteTest() throws IOException, InterruptedException {
232244
runTest("basicBlockquoteTest");
233245
}
234246

235-
private void runTest(String testName) throws IOException, InterruptedException {
236-
convertToPdfAndCompare(testName,
237-
SOURCE_FOLDER, DESTINATION_FOLDER, false,
238-
new ConverterProperties().setMulticolEnabled(true).setBaseUri(SOURCE_FOLDER));
239-
}
240-
241247
@Test
242248
public void imagesMultipageTest() throws IOException, InterruptedException {
243249
runTest("imagesMultipageTest");
@@ -250,28 +256,30 @@ public void imagesWithParagraphMultipageTest() throws IOException, InterruptedEx
250256

251257
@Test
252258
public void basicOrphans1Test() throws IOException, InterruptedException {
253-
convertToPdfAndCompare("basicOrphans1Test",
254-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
259+
runTest("basicOrphans1Test");
255260
}
256261

257262
@Test
258263
public void basicOrphans2Test() throws IOException, InterruptedException {
259-
convertToPdfAndCompare("basicOrphans2Test",
260-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
264+
runTest("basicOrphans2Test");
261265
}
262266

263267
@Test
264268
@LogMessages(messages = {
265269
@LogMessage(messageTemplate = IoLogMessageConstant.WIDOWS_CONSTRAINT_VIOLATED, logLevel = LogLevelConstants.WARN, count = 2)
266270
})
267271
public void basicWidows1Test() throws IOException, InterruptedException {
268-
convertToPdfAndCompare("basicWidows1Test",
269-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
272+
runTest("basicWidows1Test");
270273
}
271274

272275
@Test
273276
public void basicWidows2Test() throws IOException, InterruptedException {
274-
convertToPdfAndCompare("basicWidows2Test",
275-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
277+
runTest("basicWidows2Test");
278+
}
279+
280+
private void runTest(String testName) throws IOException, InterruptedException {
281+
convertToPdfAndCompare(testName,
282+
SOURCE_FOLDER, DESTINATION_FOLDER, false,
283+
new ConverterProperties().setMulticolEnabled(true).setBaseUri(SOURCE_FOLDER));
276284
}
277285
}
Binary file not shown.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<body>
4+
<div style="width: 400px; height: 670px; background-color: green"></div>
5+
<div style="column-count: 2">
6+
<h3>Columnized Content</h3>
7+
<p>This is the first paragraph of the columnized content.</p>
8+
<p>This is the second paragraph of the columnized content.</p>
9+
<p>This is the third paragraph of the columnized content.</p>
10+
<p>This is the fourth paragraph of the columnized content.</p>
11+
<p>This is the fifth paragraph of the columnized content.</p>
12+
<p>This is the sixth paragraph of the columnized content.</p>
13+
<p>This is the seventh paragraph of the columnized content.</p>
14+
<p>This is the eighth paragraph of the columnized content.</p>
15+
<p>This is the ninth paragraph of the columnized content.</p>
16+
<p>This is the tenth paragraph of the columnized content.</p>
17+
18+
<div style="column-count: 2; background-color: lightgreen;">
19+
<h3>Columnized Div 1</h3>
20+
<p>This is the first paragraph of the columnized div.</p>
21+
<p>This is the fifth paragraph of the columnized div.</p>
22+
<p>This is the sixth paragraph of the columnized div.</p>
23+
</div>
24+
25+
<div style="column-count: 2; background-color: lightsalmon;">
26+
<h3>Columnized Div 2</h3>
27+
<p>This is the first paragraph of the second columnized div.</p>
28+
<p>This is the second paragraph of the second columnized div.</p>
29+
<p>This is the third paragraph of the second columnized div.</p>
30+
</div>
31+
</div>
32+
</body>
33+
</html>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<body>
4+
<div style="width: 400px; height: 630px; background-color: green"></div>
5+
<div style="column-count: 2">
6+
<h3>Columnized Content</h3>
7+
<p>This is the first paragraph of the columnized content.</p>
8+
<p>This is the second paragraph of the columnized content.</p>
9+
<p>This is the third paragraph of the columnized content.</p>
10+
<p>This is the fourth paragraph of the columnized content.</p>
11+
<p>This is the fifth paragraph of the columnized content.</p>
12+
<p>This is the sixth paragraph of the columnized content.</p>
13+
<p>This is the seventh paragraph of the columnized content.</p>
14+
<p>This is the eighth paragraph of the columnized content.</p>
15+
<p>This is the ninth paragraph of the columnized content.</p>
16+
<p>This is the tenth paragraph of the columnized content.</p>
17+
18+
<div style="column-count: 2; background-color: lightgreen;border: solid gray 10px;">
19+
<h3>Columnized Div 1</h3>
20+
<p>This is the first paragraph of the columnized div.</p>
21+
<div style="column-count: 2; background-color: lightcoral;">
22+
<p>This is the second paragraph of the columnized div.</p>
23+
<p style="border: solid red 10px;">This is the third paragraph of the columnized div.</p>
24+
<p>This is the fourth paragraph of the columnized div.</p>
25+
</div>
26+
<p>This is the fifth paragraph of the columnized div.</p>
27+
<p>This is the sixth paragraph of the columnized div.</p>
28+
</div>
29+
30+
<div style="column-count: 2; background-color: lightsalmon;">
31+
<h3>Columnized Div 2</h3>
32+
<p>This is the first paragraph of the second columnized div.</p>
33+
<p>This is the second paragraph of the second columnized div.</p>
34+
<p>This is the third paragraph of the second columnized div.</p>
35+
</div>
36+
</div>
37+
</body>
38+
</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+
<body>
4+
<div style="column-count: 2">
5+
<h3>Columnized Content</h3>
6+
<p>This is the first paragraph of the columnized content.</p>
7+
<p>This is the second paragraph of the columnized content.</p>
8+
<p>This is the third paragraph of the columnized content.</p>
9+
<p>This is the fourth paragraph of the columnized content.</p>
10+
<p>This is the fifth paragraph of the columnized content.</p>
11+
<p>This is the sixth paragraph of the columnized content.</p>
12+
<p>This is the seventh paragraph of the columnized content.</p>
13+
<p>This is the eighth paragraph of the columnized content.</p>
14+
<p>This is the ninth paragraph of the columnized content.</p>
15+
<p>This is the tenth paragraph of the columnized content.</p>
16+
17+
<div style="column-count: 2; background-color: lightgreen;">
18+
<h3>Columnized Div 1</h3>
19+
<p>This is the first paragraph of the columnized div.</p>
20+
<div style="column-count: 2; background-color: lightcoral;">
21+
<p>This is the second paragraph of the columnized div.</p>
22+
<p style="border: solid red 10px;">This is the third paragraph of the columnized div.</p>
23+
<p>This is the fourth paragraph of the columnized div.</p>
24+
</div>
25+
<p>This is the fifth paragraph of the columnized div.</p>
26+
<p>This is the sixth paragraph of the columnized div.</p>
27+
</div>
28+
29+
<div style="column-count: 2; background-color: lightsalmon;">
30+
<h3>Columnized Div 2</h3>
31+
<p>This is the first paragraph of the second columnized div.</p>
32+
<p>This is the second paragraph of the second columnized div.</p>
33+
<p>This is the third paragraph of the second columnized div.</p>
34+
</div>
35+
</div>
36+
</body>
37+
</html>

0 commit comments

Comments
 (0)