Skip to content

Commit 90a7d91

Browse files
committed
Fix layout table min width calculation in case of predefined width
DEVSIX-9301
1 parent c079562 commit 90a7d91

File tree

9 files changed

+56
-8
lines changed

9 files changed

+56
-8
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ This file is part of the iText (R) project.
4141
import java.io.IOException;
4242
import org.junit.jupiter.api.Assertions;
4343
import org.junit.jupiter.api.BeforeAll;
44-
import org.junit.jupiter.api.Test;
4544
import org.junit.jupiter.api.Tag;
45+
import org.junit.jupiter.api.Test;
4646

4747
@Tag("IntegrationTest")
4848
public class DisplayTest extends ExtendedHtmlConversionITextTest {
@@ -108,6 +108,9 @@ public void displayTable05aTest() throws IOException, InterruptedException {
108108
}
109109

110110
@Test
111+
@LogMessages(messages = {
112+
@LogMessage(messageTemplate = IoLogMessageConstant.TABLE_WIDTH_IS_MORE_THAN_EXPECTED_DUE_TO_MIN_WIDTH),
113+
})
111114
public void displayTable06Test() throws IOException, InterruptedException {
112115
convertToPdfAndCompare("display_table06", SOURCE_FOLDER, DESTINATION_FOLDER);
113116
}

src/test/java/com/itextpdf/html2pdf/element/TableTest.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,15 @@ This file is part of the iText (R) project.
4141
import com.itextpdf.test.annotations.LogMessage;
4242
import com.itextpdf.test.annotations.LogMessages;
4343

44-
import org.junit.jupiter.api.Assertions;
45-
import org.junit.jupiter.api.BeforeAll;
46-
import org.junit.jupiter.api.Disabled;
47-
import org.junit.jupiter.api.Test;
48-
import org.junit.jupiter.api.Tag;
49-
5044
import java.io.FileInputStream;
5145
import java.io.FileOutputStream;
5246
import java.io.IOException;
5347
import java.util.List;
48+
import org.junit.jupiter.api.Assertions;
49+
import org.junit.jupiter.api.BeforeAll;
50+
import org.junit.jupiter.api.Disabled;
51+
import org.junit.jupiter.api.Tag;
52+
import org.junit.jupiter.api.Test;
5453

5554
@Tag("IntegrationTest")
5655
public class TableTest extends ExtendedITextTest {
@@ -646,6 +645,14 @@ public void breakRendererTreeOnSplitupTest() throws IOException, InterruptedExce
646645
runTest("breakRendererTreeOnSplitup");
647646
}
648647

648+
@Test
649+
@LogMessages(messages = {
650+
@LogMessage(messageTemplate = IoLogMessageConstant.TABLE_WIDTH_IS_MORE_THAN_EXPECTED_DUE_TO_MIN_WIDTH, count = 2)
651+
})
652+
public void nestedTableWithSpecifiedWidthTest() throws IOException, InterruptedException {
653+
runTest("nestedTableWithSpecifiedWidth");
654+
}
655+
649656
private void runTest(String testName) throws IOException, InterruptedException {
650657
runTest(testName, false);
651658
}
Binary file not shown.
Binary file not shown.

src/test/resources/com/itextpdf/html2pdf/css/grid/GridTemplateNestedTest/grid-nested-3-levels-tables.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
border-collapse: collapse;
5757
border-spacing: 0;
5858
background-color: darkcyan;
59-
width: 245px;
59+
width: 255px;
6060
border-radius: 10px;
6161
margin: 10px;
6262
}
Binary file not shown.
Binary file not shown.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<html xmlns="http://www.w3.org/1999/xhtml">
2+
3+
<body>
4+
<table>
5+
<tr>
6+
<td style="border:solid gray 2px;" >
7+
<table width="563" height="70" >
8+
<tr>
9+
<td>
10+
<p style="border:solid green 2px;">Hello</p>
11+
</td>
12+
</tr>
13+
</table>
14+
</td>
15+
<td style="border:solid yellow 2px;">
16+
<img src="100x100placeholder.png" height="10" width="542"/>
17+
</td>
18+
</tr>
19+
</table>
20+
<p>Parent table with width</p>
21+
<table width="700">
22+
<tr>
23+
<td style="border:solid gray 2px;" >
24+
<table width="563" height="70" >
25+
<tr>
26+
<td>
27+
<p style="border:solid green 2px;">Hello</p>
28+
</td>
29+
</tr>
30+
</table>
31+
</td>
32+
<td style="border:solid yellow 2px;">
33+
<img src="100x100placeholder.png" height="10" width="542"/>
34+
</td>
35+
</tr>
36+
</table>
37+
</body>
38+
</html>

0 commit comments

Comments
 (0)