Skip to content

Commit 02e5599

Browse files
committed
Add html tests after improve LayoutResult.NOTHING processing of the cells and a container itself and adding proper forced placement logic
DEVSIX-8329
1 parent 751dad4 commit 02e5599

File tree

61 files changed

+647
-10
lines changed

Some content is hidden

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

61 files changed

+647
-10
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ This file is part of the iText (R) project.
2424

2525
import com.itextpdf.html2pdf.attach.ITagWorker;
2626
import com.itextpdf.html2pdf.attach.ProcessorContext;
27+
import com.itextpdf.layout.IPropertyContainer;
2728
import com.itextpdf.layout.element.GridContainer;
29+
import com.itextpdf.layout.element.IElement;
2830
import com.itextpdf.styledxmlparser.node.IElementNode;
2931

3032
/**
@@ -41,4 +43,17 @@ public class DisplayGridTagWorker extends DivTagWorker {
4143
public DisplayGridTagWorker(IElementNode element, ProcessorContext context) {
4244
super(element, context, new GridContainer());
4345
}
46+
47+
/**
48+
* {@inheritDoc}
49+
*/
50+
@Override
51+
public boolean processTagChild(ITagWorker childTagWorker, ProcessorContext context) {
52+
final IPropertyContainer element = childTagWorker.getElementResult();
53+
if (childTagWorker instanceof BrTagWorker) {
54+
return super.processTagChild(childTagWorker, context);
55+
} else {
56+
return addBlockChild((IElement) element);
57+
}
58+
}
4459
}

src/test/java/com/itextpdf/html2pdf/css/grid/GridTemplateColumnTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ public class GridTemplateColumnTest extends ExtendedHtmlConversionITextTest {
3939
public static final String DESTINATION_FOLDER = "./target/test/com/itextpdf/html2pdf/css/grid/GridTemplateColumnTest/";
4040

4141

42-
//TODO DEVSIX-3340 change cmp files when GRID LAYOUT is supported
43-
4442
@BeforeAll
4543
public static void beforeClass() {
4644
createOrClearDestinationFolder(DESTINATION_FOLDER);
@@ -113,9 +111,6 @@ public void templateColumnMixedTest() throws IOException, InterruptedException {
113111
}
114112

115113
@Test
116-
@LogMessages(messages = {
117-
@LogMessage(messageTemplate = LayoutLogMessageConstant.ELEMENT_DOES_NOT_FIT_AREA)
118-
})
119114
// TODO DEVSIX-8324
120115
public void templateColumnMultiPageTest() throws IOException, InterruptedException {
121116
runTest("template-cols-enormous-size");

src/test/java/com/itextpdf/html2pdf/css/grid/GridTemplateCombinedTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ public class GridTemplateCombinedTest extends ExtendedHtmlConversionITextTest {
3535
public static final String SOURCE_FOLDER = "./src/test/resources/com/itextpdf/html2pdf/css/grid/GridTemplateCombinedTest/";
3636
public static final String DESTINATION_FOLDER = "./target/test/com/itextpdf/html2pdf/css/grid/GridTemplateCombinedTest/";
3737

38-
//TODO DEVSIX-3340 change cmp files when GRID LAYOUT is supported
39-
4038
@BeforeAll
4139
public static void beforeClass() {
4240
createOrClearDestinationFolder(DESTINATION_FOLDER);

src/test/java/com/itextpdf/html2pdf/css/grid/GridTemplateElementPropertyContainerTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ public void paddingAllToBigForWidthTest() throws IOException, InterruptedExcepti
7070
}
7171

7272
@Test
73-
@Ignore("DEVSIX-TODO")
7473
public void paddingOverflowX() throws IOException, InterruptedException {
7574
runTest("padding_overflow_x");
7675
}

src/test/java/com/itextpdf/html2pdf/css/grid/GridTemplateRowTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ public class GridTemplateRowTest extends ExtendedHtmlConversionITextTest {
3535
public static final String SOURCE_FOLDER = "./src/test/resources/com/itextpdf/html2pdf/css/grid/GridTemplateRowTest/";
3636
public static final String DESTINATION_FOLDER = "./target/test/com/itextpdf/html2pdf/css/grid/GridTemplateRowTest/";
3737

38-
//TODO DEVSIX-3340 change cmp files when GRID LAYOUT is supported
39-
4038
@BeforeAll
4139
public static void beforeClass() {
4240
createOrClearDestinationFolder(DESTINATION_FOLDER);

src/test/java/com/itextpdf/html2pdf/css/grid/GridTemplatesTest.java

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ This file is part of the iText (R) project.
2424

2525
import com.itextpdf.html2pdf.ConverterProperties;
2626
import com.itextpdf.html2pdf.ExtendedHtmlConversionITextTest;
27+
import com.itextpdf.layout.logs.LayoutLogMessageConstant;
28+
import com.itextpdf.test.LogLevelConstants;
29+
import com.itextpdf.test.annotations.LogMessage;
30+
import com.itextpdf.test.annotations.LogMessages;
2731

2832
import java.io.IOException;
2933
import org.junit.jupiter.api.BeforeAll;
@@ -253,6 +257,79 @@ public void fixedTemplatesAndCellDoesNotHaveDirectNeighborTest() throws IOExcept
253257
runTest("fixedTemplatesAndCellDoesNotHaveDirectNeighborTest");
254258
}
255259

260+
public void gridInsideGridTest() throws IOException, InterruptedException {
261+
runTest("gridInsideGridTest");
262+
}
263+
264+
@Test
265+
public void gridInsideGridOnPageBreakTest() throws IOException, InterruptedException {
266+
runTest("gridInsideGridOnPageBreakTest");
267+
}
268+
269+
@Test
270+
// TODO DEVSIX-8340 - inner grid doesn't adjust its size
271+
public void elementDoesntFitContentTest() throws IOException, InterruptedException {
272+
runTest("elementDoesntFitContentTest");
273+
}
274+
275+
@Test
276+
public void elementDoesntFitTest() throws IOException, InterruptedException {
277+
runTest("elementDoesntFitTest");
278+
}
279+
280+
@Test
281+
public void elementDoesntFitHorizontallyTest() throws IOException, InterruptedException {
282+
runTest("elementDoesntFitHorizontallyTest");
283+
}
284+
285+
@Test
286+
// TODO DEVSIX-8340 - columns are not preserved
287+
public void elementDoesntFitOverflowingToNextPageTest() throws IOException, InterruptedException {
288+
runTest("elementDoesntFitOverflowingToNextPageTest");
289+
}
290+
291+
@Test
292+
// TODO DEVSIX-8340 - We don't try to split the cell.
293+
// TODO DEVSIX-8340 - We put the original amount of rows into overflow container.
294+
public void elementDoesntFitContentOverflowingToNextPageTest() throws IOException, InterruptedException {
295+
runTest("elementDoesntFitContentOverflowingToNextPageTest");
296+
}
297+
298+
@Test
299+
@LogMessages(messages = {
300+
@LogMessage(messageTemplate = LayoutLogMessageConstant.ELEMENT_DOES_NOT_FIT_AREA, logLevel =
301+
LogLevelConstants.WARN)})
302+
public void imageElementDoesntFitTest() throws IOException, InterruptedException {
303+
runTest("imageElementDoesntFitTest");
304+
}
305+
306+
@Test
307+
public void manyImageElementsTest() throws IOException, InterruptedException {
308+
runTest("manyImageElementsTest");
309+
}
310+
311+
@Test
312+
public void imageElementsOn2ndPageTest() throws IOException, InterruptedException {
313+
runTest("imageElementsOn2ndPageTest");
314+
}
315+
316+
@Test
317+
public void gridWithBrTest() throws IOException, InterruptedException {
318+
runTest("gridWithBrTest");
319+
}
320+
321+
@Test
322+
public void gridWithPageBreakTest() throws IOException, InterruptedException {
323+
runTest("gridWithPageBreakTest");
324+
}
325+
326+
// TODO DEVSIX-8340 - table size is not recalculated on the next page
327+
// Same as in DEVSIX-8318
328+
@Test
329+
public void gridWithTableTest() throws IOException, InterruptedException {
330+
runTest("gridWithTableTest");
331+
}
332+
256333
@Test
257334
public void gridLayoutDisablingTest() throws IOException, InterruptedException {
258335
convertToPdfAndCompare("basicColumnFewDivsTest",
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)