Skip to content

Commit 3493321

Browse files
author
Andrei Stryhelski
committed
Add ColumnWidthTest, ColumnsTest
DEVSIX-7557
1 parent a83cfae commit 3493321

File tree

271 files changed

+4865
-35
lines changed

Some content is hidden

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

271 files changed

+4865
-35
lines changed

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

Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This file is part of the iText (R) project.
2020
You should have received a copy of the GNU Affero General Public License
2121
along with this program. If not, see <https://www.gnu.org/licenses/>.
2222
*/
23-
package com.itextpdf.html2pdf.css;
23+
package com.itextpdf.html2pdf.css.multicol;
2424

2525
import com.itextpdf.html2pdf.ConverterProperties;
2626
import com.itextpdf.html2pdf.ExtendedHtmlConversionITextTest;
@@ -34,8 +34,8 @@ This file is part of the iText (R) project.
3434

3535
@Category(IntegrationTest.class)
3636
public class ColumnCountTest extends ExtendedHtmlConversionITextTest {
37-
public static final String SOURCE_FOLDER = "./src/test/resources/com/itextpdf/html2pdf/css/ColumnCountTest/";
38-
public static final String DESTINATION_FOLDER = "./target/test/com/itextpdf/html2pdf/css/ColumnCountTest/";
37+
public static final String SOURCE_FOLDER = "./src/test/resources/com/itextpdf/html2pdf/css/multicol/ColumnCountTest/";
38+
public static final String DESTINATION_FOLDER = "./target/test/com/itextpdf/html2pdf/css/multicol/ColumnCountTest/";
3939

4040
@BeforeClass
4141
public static void beforeClass() {
@@ -44,102 +44,97 @@ public static void beforeClass() {
4444

4545
@Test
4646
public void convertBasicArticleTest() throws IOException, InterruptedException {
47-
convertToPdfAndCompare("basicArticleTest",
48-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true)
49-
.setBaseUri(SOURCE_FOLDER));
47+
runTest("basicArticleTest");
5048
}
5149

5250
@Test
5351
public void convertBasicDivTest() throws IOException, InterruptedException {
54-
convertToPdfAndCompare("basicDivTest",
55-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
52+
runTest("basicDivTest");
5653
}
5754

5855
@Test
5956
public void convertBasicDivWithImageTest() throws IOException, InterruptedException {
60-
convertToPdfAndCompare("basicDivWithImageTest",
61-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true)
62-
.setBaseUri(SOURCE_FOLDER));
57+
runTest("basicDivWithImageTest");
6358
}
6459

6560
@Test
6661
public void convertBasicPTest() throws IOException, InterruptedException {
67-
convertToPdfAndCompare("basicPTest",
68-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
62+
runTest("basicPTest");
6963
}
7064

7165
//TODO: DEVSIX-7592 add support for forms
7266
@Test
7367
public void convertBasicFormTest() throws IOException, InterruptedException {
74-
convertToPdfAndCompare("basicFormTest",
75-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
68+
runTest("basicFormTest");
7669
}
7770

7871
@Test
7972
public void convertBasicUlTest() throws IOException, InterruptedException {
80-
convertToPdfAndCompare("basicUlTest",
81-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
73+
runTest("basicUlTest");
8274
}
8375

8476
//TODO: DEVSIX-7591
8577
@Test
8678
public void convertBasicOlTest() throws IOException, InterruptedException {
87-
convertToPdfAndCompare("basicOlTest",
88-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
79+
runTest("basicOlTest");
8980
}
9081

9182
//TODO: DEVSIX-7592
9283
@Test
9384
public void convertBasicTableTest() throws IOException, InterruptedException {
94-
convertToPdfAndCompare("basicTableTest",
95-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
85+
runTest("basicTableTest");
9686
}
9787

9888
//TODO: DEVSIX-7584 add multipage support
9989
@Test
10090
public void convertBasicSectionTest() throws IOException, InterruptedException {
101-
convertToPdfAndCompare("basicSectionTest",
102-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
91+
runTest("basicSectionTest");
10392
}
10493

10594
//TODO: DEVSIX-7584 add multipage support
10695
@Test
10796
public void convertBasicDivMultiPageDocumentsTest() throws IOException, InterruptedException {
108-
convertToPdfAndCompare("basicDivMultiPageTest",
109-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
97+
runTest("basicDivMultiPageTest");
11098
}
11199

112100
//TODO: DEVSIX-7592 add support for forms
113101
@Test
114102
public void convertBasicFormMultiPageDocumentsTest() throws IOException, InterruptedException {
115-
convertToPdfAndCompare("basicFormMultiPageTest",
116-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
103+
runTest("basicFormMultiPageTest");
117104
}
118105

119106
@Test
120107
public void convertBasicDisplayPropertyTest() throws IOException, InterruptedException {
121-
convertToPdfAndCompare("basicDisplayPropertyTest",
122-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
108+
runTest("basicDisplayPropertyTest");
123109
}
124110

125111
//TODO: DEVSIX-7591
126112
@Test
127113
public void convertBasicDisplayPropertyWithNestedColumnsTest() throws IOException, InterruptedException {
128-
convertToPdfAndCompare("basicDisplayPropertyWithNestedColumnsTest",
129-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
114+
runTest("basicDisplayPropertyWithNestedColumnsTest");
130115
}
131116

132117
//TODO: DEVSIX-7556
133118
@Test
134119
public void convertBasicFloatPropertyTest() throws IOException, InterruptedException {
135-
convertToPdfAndCompare("basicFloatPropertyTest",
136-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
120+
runTest("basicFloatPropertyTest");
137121
}
138122

139123
@Test
140124
public void convertBasicFlexPropertyTest() throws IOException, InterruptedException {
141-
convertToPdfAndCompare("basicFlexPropertyTest",
142-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
125+
runTest("basicFlexPropertyTest");
126+
}
127+
128+
//TODO: DEVSIX-7587 adjust approximate height calculation
129+
@Test
130+
public void convertImagesWithDifferentColValuesTest() throws IOException, InterruptedException {
131+
runTest("imagesWithDifferentColValuesTest");
132+
}
133+
134+
private void runTest(String testName) throws IOException, InterruptedException {
135+
convertToPdfAndCompare(testName,
136+
SOURCE_FOLDER, DESTINATION_FOLDER, false,
137+
new ConverterProperties().setMulticolEnabled(true).setBaseUri(SOURCE_FOLDER));
143138
}
144139

145140

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
/*
2+
This file is part of the iText (R) project.
3+
Copyright (c) 1998-2023 Apryse Group NV
4+
Authors: Apryse Software.
5+
6+
This program is offered under a commercial and under the AGPL license.
7+
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below.
8+
9+
AGPL licensing:
10+
This program is free software: you can redistribute it and/or modify
11+
it under the terms of the GNU Affero General Public License as published by
12+
the Free Software Foundation, either version 3 of the License, or
13+
(at your option) any later version.
14+
15+
This program is distributed in the hope that it will be useful,
16+
but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
GNU Affero General Public License for more details.
19+
20+
You should have received a copy of the GNU Affero General Public License
21+
along with this program. If not, see <https://www.gnu.org/licenses/>.
22+
*/
23+
package com.itextpdf.html2pdf.css.multicol;
24+
25+
import com.itextpdf.html2pdf.ConverterProperties;
26+
import com.itextpdf.html2pdf.ExtendedHtmlConversionITextTest;
27+
import com.itextpdf.test.annotations.type.IntegrationTest;
28+
29+
import java.io.IOException;
30+
import org.junit.BeforeClass;
31+
import org.junit.Test;
32+
import org.junit.experimental.categories.Category;
33+
34+
@Category(IntegrationTest.class)
35+
public class ColumnWidthTest extends ExtendedHtmlConversionITextTest {
36+
public static final String SOURCE_FOLDER = "./src/test/resources/com/itextpdf/html2pdf/css/multicol/ColumnWidthTest/";
37+
public static final String DESTINATION_FOLDER = "./target/test/com/itextpdf/html2pdf/css/multicol/ColumnWidthTest/";
38+
39+
@BeforeClass
40+
public static void beforeClass() {
41+
createOrClearDestinationFolder(DESTINATION_FOLDER);
42+
}
43+
44+
@Test
45+
public void convertSimpleDivTest() throws IOException, InterruptedException {
46+
runTest("simpleDivTest");
47+
}
48+
49+
@Test
50+
public void convertColumnWidthAutoTest() throws IOException, InterruptedException {
51+
runTest("columnWidthAutoTest");
52+
}
53+
54+
@Test
55+
public void convertDifferentUnitsTest() throws IOException, InterruptedException {
56+
runTest("differentUnitsTest");
57+
}
58+
59+
@Test
60+
public void convertParagraphsInsideContainerTest() throws IOException, InterruptedException {
61+
runTest("paragraphsInsideContainer");
62+
}
63+
64+
@Test
65+
public void convertOneParagraphSpecifiedWithDifferentWidthTest() throws IOException, InterruptedException {
66+
runTest("oneParagraphSpecifiedWithDifferentWidthTest");
67+
}
68+
69+
@Test
70+
public void convertMixedElementsInContainerTest() throws IOException, InterruptedException {
71+
runTest("mixedElementsInContainer");
72+
}
73+
74+
@Test
75+
public void convertNarrowColumnsTest() throws IOException, InterruptedException {
76+
runTest("narrowColumns");
77+
}
78+
79+
@Test
80+
public void convertLargeColumnsTest() throws IOException, InterruptedException {
81+
runTest("largeColumns");
82+
}
83+
84+
@Test
85+
public void convertBasicArticleTest() throws IOException, InterruptedException {
86+
runTest("basicArticleTest");
87+
}
88+
89+
@Test
90+
public void convertBasicDivMultiPageTest() throws IOException, InterruptedException {
91+
runTest("basicDivMultiPageTest");
92+
}
93+
94+
@Test
95+
public void convertBasicDivTest() throws IOException, InterruptedException {
96+
runTest("basicDivTest");
97+
}
98+
99+
@Test
100+
public void convertNestedElementsTest() throws IOException, InterruptedException {
101+
runTest("nestedElementsTest");
102+
}
103+
104+
@Test
105+
public void convertBasicDisplayPropertyTest() throws IOException, InterruptedException {
106+
runTest("basicDisplayPropertyTest");
107+
}
108+
109+
@Test
110+
public void convertDisplayPropertyWithNestedColumnsTest() throws IOException, InterruptedException {
111+
runTest("displayPropertyWithNestedColumnsTest");
112+
}
113+
114+
@Test
115+
public void convertBasicDivWithImageTest() throws IOException, InterruptedException {
116+
runTest("basicDivWithImageTest");
117+
}
118+
119+
@Test
120+
public void convertOverlaidContentInDivWithImageTest() throws IOException, InterruptedException {
121+
runTest("overlaidContentInDivWithImageTest");
122+
}
123+
124+
@Test
125+
public void convertBasicFlexPropertyTest() throws IOException, InterruptedException {
126+
runTest("basicFlexPropertyTest");
127+
}
128+
129+
@Test
130+
public void convertOverlaidFlexContentInColumnContainerTest() throws IOException, InterruptedException {
131+
runTest("overlaidFlexContentInColumnContainerTest");
132+
}
133+
134+
@Test
135+
public void convertBasicFloatPropertyTest() throws IOException, InterruptedException {
136+
runTest("basicFloatPropertyTest");
137+
}
138+
139+
@Test
140+
public void convertBasicFormTest() throws IOException, InterruptedException {
141+
runTest("basicFormTest");
142+
}
143+
144+
@Test
145+
public void convertFormWithNestedElementsTest() throws IOException, InterruptedException {
146+
runTest("formWithNestedElementsTest");
147+
}
148+
149+
@Test
150+
public void convertFormMultiPageTest() throws IOException, InterruptedException {
151+
runTest("formMultiPageTest");
152+
}
153+
154+
@Test
155+
public void convertFormWithNestedElementsMultiPageTest() throws IOException, InterruptedException {
156+
runTest("formWithNestedElementsMultiPageTest");
157+
}
158+
159+
@Test
160+
public void convertBasicOlTest() throws IOException, InterruptedException {
161+
runTest("basicOlTest");
162+
}
163+
164+
@Test
165+
public void convertOlWithTestedElementsTest() throws IOException, InterruptedException {
166+
runTest("olWithNestedElementsTest");
167+
}
168+
169+
@Test
170+
public void convertBasicSectionTest() throws IOException, InterruptedException {
171+
runTest("basicSectionTest");
172+
}
173+
174+
@Test
175+
public void convertColumnizedShortParagraphsInTableCellTest() throws IOException, InterruptedException {
176+
runTest("columnizedShortParagraphsInTableCellTest");
177+
}
178+
179+
@Test
180+
public void convertColumnizedShortPInTableCellWithHeightTest() throws IOException, InterruptedException {
181+
runTest("columnizedShortPInTableCellWithHeightTest");
182+
}
183+
184+
@Test
185+
public void convertColumnizedSpanInTableCellTest() throws IOException, InterruptedException {
186+
runTest("columnizedSpanInTableCellTest");
187+
}
188+
189+
@Test
190+
public void convertColumnizedContentInTableTest() throws IOException, InterruptedException {
191+
runTest("columnizedContentInTableTest");
192+
}
193+
194+
@Test
195+
public void convertBasicUlTest() throws IOException, InterruptedException {
196+
runTest("basicUlTest");
197+
}
198+
199+
@Test
200+
public void convertUlWithNestedElementsTest() throws IOException, InterruptedException {
201+
runTest("ulWithNestedElementsTest");
202+
}
203+
204+
@Test
205+
public void convertImagesTest() throws IOException, InterruptedException {
206+
runTest("imagesTest");
207+
}
208+
209+
@Test
210+
public void convertImagesWithDifferentHeightsTest() throws IOException, InterruptedException {
211+
runTest("imagesWithDifferentHeightsTest");
212+
}
213+
214+
@Test
215+
public void convertColumnWidthEqualsImagesTest() throws IOException, InterruptedException {
216+
runTest("columnWidthEqualsImagesTest");
217+
}
218+
219+
private void runTest(String testName) throws IOException, InterruptedException {
220+
convertToPdfAndCompare(testName,
221+
SOURCE_FOLDER, DESTINATION_FOLDER, false,
222+
new ConverterProperties().setMulticolEnabled(true).setBaseUri(SOURCE_FOLDER));
223+
}
224+
}

0 commit comments

Comments
 (0)