Skip to content

Commit 13de009

Browse files
author
Dmitry Radchuk
committed
Replace cmp after changing ColumnContainerRenderer balancing algorithm
DEVSIX-7587
1 parent c176a2c commit 13de009

File tree

235 files changed

+241
-133
lines changed

Some content is hidden

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

235 files changed

+241
-133
lines changed

src/main/java/com/itextpdf/html2pdf/attach/impl/tags/DivTagWorker.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ This file is part of the iText (R) project.
3030
import com.itextpdf.html2pdf.css.CssConstants;
3131
import com.itextpdf.layout.IPropertyContainer;
3232
import com.itextpdf.layout.element.AreaBreak;
33-
import com.itextpdf.layout.element.ColumnContainer;
33+
import com.itextpdf.layout.element.MulticolContainer;
3434
import com.itextpdf.layout.element.Div;
3535
import com.itextpdf.layout.element.IBlockElement;
3636
import com.itextpdf.layout.element.IElement;
@@ -48,7 +48,7 @@ public class DivTagWorker implements ITagWorker, IDisplayAware {
4848
/**
4949
* Column container element.
5050
*/
51-
private ColumnContainer columnContainer;
51+
private MulticolContainer columnContainer;
5252

5353
/** The div element. */
5454
private Div div;
@@ -69,7 +69,7 @@ public DivTagWorker(IElementNode element, ProcessorContext context) {
6969
div = new Div();
7070
Map<String, String> styles = element.getStyles();
7171
if (styles != null && styles.containsKey(CssConstants.COLUMN_COUNT)) {
72-
columnContainer = new ColumnContainer();
72+
columnContainer = new MulticolContainer();
7373
columnContainer.add(div);
7474
}
7575
inlineHelper = new WaitingInlineElementsHelper(styles == null ? null : styles.get(CssConstants.WHITE_SPACE),

src/main/java/com/itextpdf/html2pdf/attach/impl/tags/PTagWorker.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This file is part of the iText (R) project.
2828
import com.itextpdf.html2pdf.attach.util.WaitingInlineElementsHelper;
2929
import com.itextpdf.html2pdf.css.CssConstants;
3030
import com.itextpdf.layout.IPropertyContainer;
31-
import com.itextpdf.layout.element.ColumnContainer;
31+
import com.itextpdf.layout.element.MulticolContainer;
3232
import com.itextpdf.layout.element.Div;
3333
import com.itextpdf.layout.element.IBlockElement;
3434
import com.itextpdf.layout.element.IElement;
@@ -74,7 +74,7 @@ public PTagWorker(IElementNode element, ProcessorContext context) {
7474
lastParagraph = new Paragraph();
7575

7676
if (element.getStyles().get(CssConstants.COLUMN_COUNT) != null ) {
77-
elementsContainer = new ColumnContainer();
77+
elementsContainer = new MulticolContainer();
7878
elementsContainer.add(lastParagraph);
7979
}
8080
inlineHelper = new WaitingInlineElementsHelper(element.getStyles().get(CssConstants.WHITE_SPACE),

src/main/java/com/itextpdf/html2pdf/attach/impl/tags/UlOlTagWorker.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ This file is part of the iText (R) project.
2929
import com.itextpdf.html2pdf.css.CssConstants;
3030
import com.itextpdf.html2pdf.html.AttributeConstants;
3131
import com.itextpdf.layout.IPropertyContainer;
32-
import com.itextpdf.layout.element.ColumnContainer;
32+
import com.itextpdf.layout.element.MulticolContainer;
3333
import com.itextpdf.layout.element.Div;
3434
import com.itextpdf.layout.element.IBlockElement;
3535
import com.itextpdf.layout.element.ILeafElement;
@@ -67,7 +67,7 @@ public UlOlTagWorker(IElementNode element, ProcessorContext context) {
6767
list = new List().setListSymbol("");
6868

6969
if (element.getStyles().get(CssConstants.COLUMN_COUNT) != null ) {
70-
elementsContainer = new ColumnContainer();
70+
elementsContainer = new MulticolContainer();
7171
elementsContainer.add(list);
7272
}
7373

src/main/java/com/itextpdf/html2pdf/css/apply/impl/UlOlTagCssApplier.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This file is part of the iText (R) project.
2828
import com.itextpdf.html2pdf.css.apply.ICssApplier;
2929
import com.itextpdf.html2pdf.css.apply.util.ListStyleApplierUtil;
3030
import com.itextpdf.layout.IPropertyContainer;
31-
import com.itextpdf.layout.element.ColumnContainer;
31+
import com.itextpdf.layout.element.MulticolContainer;
3232
import com.itextpdf.layout.element.List;
3333
import com.itextpdf.layout.properties.BaseDirection;
3434
import com.itextpdf.layout.properties.ListSymbolPosition;
@@ -49,7 +49,7 @@ public class UlOlTagCssApplier extends BlockCssApplier {
4949
*/
5050
@Override
5151
public void apply(ProcessorContext context, IStylesContainer stylesContainer, ITagWorker tagWorker) {
52-
if (!(tagWorker.getElementResult() instanceof List || tagWorker.getElementResult() instanceof ColumnContainer)) {
52+
if (!(tagWorker.getElementResult() instanceof List || tagWorker.getElementResult() instanceof MulticolContainer)) {
5353
return;
5454
}
5555
Map<String, String> css = stylesContainer.getStyles();

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

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ This file is part of the iText (R) project.
2828

2929
import java.io.IOException;
3030

31-
import org.junit.Assert;
3231
import org.junit.BeforeClass;
3332
import org.junit.Test;
3433
import org.junit.experimental.categories.Category;
@@ -43,34 +42,30 @@ public static void beforeClass() {
4342
createOrClearDestinationFolder(DESTINATION_FOLDER);
4443
}
4544

46-
//TODO: DEVSIX-7587 adjust approximate height calculation
4745
@Test
4846
public void convertBasicArticleTest() throws IOException, InterruptedException {
49-
Assert.assertThrows(IllegalStateException.class, () -> convertToPdfAndCompare("basicArticleTest",
47+
convertToPdfAndCompare("basicArticleTest",
5048
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true)
51-
.setBaseUri(SOURCE_FOLDER)));
49+
.setBaseUri(SOURCE_FOLDER));
5250
}
5351

54-
//TODO: DEVSIX-7587 adjust approximate height calculation
5552
@Test
5653
public void convertBasicDivTest() throws IOException, InterruptedException {
57-
Assert.assertThrows(IllegalStateException.class, () -> convertToPdfAndCompare("basicDivTest",
58-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true)));
54+
convertToPdfAndCompare("basicDivTest",
55+
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
5956
}
6057

61-
//TODO: DEVSIX-7587 adjust approximate height calculation
6258
@Test
6359
public void convertBasicDivWithImageTest() throws IOException, InterruptedException {
64-
Assert.assertThrows(IllegalStateException.class, () -> convertToPdfAndCompare("basicDivWithImageTest",
60+
convertToPdfAndCompare("basicDivWithImageTest",
6561
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true)
66-
.setBaseUri(SOURCE_FOLDER)));
62+
.setBaseUri(SOURCE_FOLDER));
6763
}
6864

69-
//TODO: DEVSIX-7587 adjust approximate height calculation
7065
@Test
7166
public void convertBasicPTest() throws IOException, InterruptedException {
72-
Assert.assertThrows(IllegalStateException.class, () -> convertToPdfAndCompare("basicPTest",
73-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true)));
67+
convertToPdfAndCompare("basicPTest",
68+
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
7469
}
7570

7671
//TODO: DEVSIX-7592 add support for forms
@@ -80,14 +75,13 @@ public void convertBasicFormTest() throws IOException, InterruptedException {
8075
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
8176
}
8277

83-
//TODO: DEVSIX-7591, DEVSIX-7587
8478
@Test
8579
public void convertBasicUlTest() throws IOException, InterruptedException {
8680
convertToPdfAndCompare("basicUlTest",
8781
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
8882
}
8983

90-
//TODO: DEVSIX-7591, DEVSIX-7587
84+
//TODO: DEVSIX-7591
9185
@Test
9286
public void convertBasicOlTest() throws IOException, InterruptedException {
9387
convertToPdfAndCompare("basicOlTest",
@@ -97,8 +91,8 @@ public void convertBasicOlTest() throws IOException, InterruptedException {
9791
//TODO: DEVSIX-7592
9892
@Test
9993
public void convertBasicTableTest() throws IOException, InterruptedException {
100-
Assert.assertThrows(IllegalStateException.class, () -> convertToPdfAndCompare("basicTableTest",
101-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true)));
94+
convertToPdfAndCompare("basicTableTest",
95+
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
10296
}
10397

10498
//TODO: DEVSIX-7584 add multipage support
@@ -111,8 +105,8 @@ public void convertBasicSectionTest() throws IOException, InterruptedException {
111105
//TODO: DEVSIX-7584 add multipage support
112106
@Test
113107
public void convertBasicDivMultiPageDocumentsTest() throws IOException, InterruptedException {
114-
Assert.assertThrows(IllegalStateException.class, () -> convertToPdfAndCompare("basicDivMultiPageTest",
115-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true)));
108+
convertToPdfAndCompare("basicDivMultiPageTest",
109+
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
116110
}
117111

118112
//TODO: DEVSIX-7592 add support for forms
@@ -122,11 +116,10 @@ public void convertBasicFormMultiPageDocumentsTest() throws IOException, Interru
122116
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
123117
}
124118

125-
//TODO: DEVSIX-7587 adjust approximate height calculation algorithm
126119
@Test
127120
public void convertBasicDisplayPropertyTest() throws IOException, InterruptedException {
128-
Assert.assertThrows(IllegalStateException.class, () -> convertToPdfAndCompare("basicDisplayPropertyTest",
129-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true)));
121+
convertToPdfAndCompare("basicDisplayPropertyTest",
122+
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
130123
}
131124

132125
//TODO: DEVSIX-7591
@@ -139,11 +132,10 @@ public void convertBasicDisplayPropertyWithNestedColumnsTest() throws IOExceptio
139132
//TODO: DEVSIX-7556
140133
@Test
141134
public void convertBasicFloatPropertyTest() throws IOException, InterruptedException {
142-
Assert.assertThrows(IllegalStateException.class, () -> convertToPdfAndCompare("basicFloatPropertyTest",
143-
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true)));
135+
convertToPdfAndCompare("basicFloatPropertyTest",
136+
SOURCE_FOLDER, DESTINATION_FOLDER, false, new ConverterProperties().setMulticolEnabled(true));
144137
}
145138

146-
//TODO: DEVSIX-7587 adjust approximate height calculation algorithm
147139
@Test
148140
public void convertBasicFlexPropertyTest() throws IOException, InterruptedException {
149141
convertToPdfAndCompare("basicFlexPropertyTest",

src/test/java/com/itextpdf/html2pdf/css/w3c/css_multicol/BalanceGridContainerRefTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ This file is part of the iText (R) project.
2626

2727
import org.junit.Ignore;
2828

29-
@Ignore("DEVSIX-7587")
3029
public class BalanceGridContainerRefTest extends W3CCssMulticolTest {
3130
@Override
3231
protected String getHtmlFileName() {

src/test/java/com/itextpdf/html2pdf/css/w3c/css_multicol/BalanceGridContainerTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ This file is part of the iText (R) project.
2626

2727
import org.junit.Ignore;
2828

29-
@Ignore("DEVSIX-7587")
3029
public class BalanceGridContainerTest extends W3CCssMulticolTest {
3130
@Override
3231
protected String getHtmlFileName() {

src/test/java/com/itextpdf/html2pdf/css/w3c/css_multicol/ColumnfillAutoMaxHeight002Test.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ This file is part of the iText (R) project.
2626

2727
import org.junit.Ignore;
2828

29-
@Ignore("DEVSIX-7587")
3029
public class ColumnfillAutoMaxHeight002Test extends W3CCssMulticolTest {
3130
@Override
3231
protected String getHtmlFileName() {

src/test/java/com/itextpdf/html2pdf/css/w3c/css_multicol/FixedInNestedMulticolWithTransformContainerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ This file is part of the iText (R) project.
2626

2727
import org.junit.Ignore;
2828

29-
@Ignore("DEVSIX-7587")
29+
3030
public class FixedInNestedMulticolWithTransformContainerTest extends W3CCssMulticolTest {
3131
@Override
3232
protected String getHtmlFileName() {

src/test/java/com/itextpdf/html2pdf/css/w3c/css_multicol/FixedposStaticPosWithViewportCB003Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ This file is part of the iText (R) project.
2626

2727
import org.junit.Ignore;
2828

29-
@Ignore("DEVSIX-7587")
29+
3030
public class FixedposStaticPosWithViewportCB003Test extends W3CCssMulticolTest {
3131
@Override
3232
protected String getHtmlFileName() {

0 commit comments

Comments
 (0)