Skip to content

Commit 3b56ebd

Browse files
IdamkinIiText-CI
authored andcommitted
Add test that illustrates table width problem
DEVSIX-2895
1 parent 6ce580c commit 3b56ebd

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,13 @@ public void tableCellMinWidthRightAlignmentTest() throws IOException, Interrupte
462462
runConvertToElements("tableCellMinWidthRightAlignmentTest", false);
463463
}
464464

465+
@Test
466+
@LogMessages(messages = {@LogMessage(messageTemplate = com.itextpdf.io.LogMessageConstant.SUM_OF_TABLE_COLUMNS_IS_GREATER_THAN_100, count = 4)})
467+
//TODO: DEVSIX-2895 - inconsistency in table width between pdf and html
468+
public void tableWidthMoreThan100PercentTest() throws IOException, InterruptedException {
469+
runTest("tableWidthMoreThan100Percent");
470+
}
471+
465472
private void runTest(String testName) throws IOException, InterruptedException {
466473
runTest(testName, false);
467474
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5+
<style>
6+
table {
7+
border-collapse: collapse;
8+
}
9+
body {
10+
margin: 10px
11+
}
12+
td {
13+
border: 2px solid black
14+
}
15+
div {
16+
box-sizing: border-box
17+
}
18+
</style>
19+
</head>
20+
21+
<body>
22+
23+
<table style="width:370px">
24+
<colgroup>
25+
<col style="width:20%">
26+
<col style="width:10%">
27+
<col style="width:20%">
28+
<col style="width:45%">
29+
<col style="width:15%">
30+
<col style="width:20%">
31+
</colgroup>
32+
<tbody>
33+
<tr>
34+
<td colspan="3"><div style="width:175px;background-color:rgba(228,47,47,1)"><div>175</div></div></td>
35+
<td><div style="background-color:rgba(240,152,62,1);width:85px"><div>85</div></div></td>
36+
<td colspan="2"><div style="width:85px;background-color:rgba(250,249,35,1)"><div>85</div></div></td>
37+
</tr>
38+
<tr>
39+
<td><div style="width:75px;background-color:rgba(175,253,27,1)"><div>75</div></div></td>
40+
<td><div style="width:20px;background-color:rgba(120,205,255,1)"><div>20</div></div></td>
41+
<td><div style="width:50px;background-color:rgba(23,236,55,1)"><div>50</div></div></td>
42+
<td colspan="2"><div style="width:100px;background-color:rgba(47,243,137,1)"><div>100</div></div></td>
43+
<td><div style="width:35px;background-color:rgba(107,133,253,1)"><div>35</div></div></td>
44+
</tr>
45+
</tbody>
46+
</table>
47+
48+
<table style="width:370px">
49+
<colgroup>
50+
<col style="width:90%">
51+
<col style="width:30%">
52+
<col style="width:40%">
53+
</colgroup>
54+
<tbody>
55+
<tr>
56+
<td><div style="background-color:rgba(240,152,62,1);width:170px"><div>170</div></div></td>
57+
<td colspan="2"><div style="width:170px;background-color:rgba(250,249,35,1)"><div>170</div></div></td>
58+
</tr>
59+
<tr>
60+
<td colspan="2"><div style="width:200px;background-color:rgba(47,243,137,1)"><div>200</div></div></td>
61+
<td><div style="width:70px;background-color:rgba(107,133,253,1)"><div>70</div></div></td>
62+
</tr>
63+
</tbody>
64+
</table>
65+
66+
<div style="width:370px;background-color:rgba(231,143,231,1);border:2px solid"><div>370</div></div>
67+
68+
</body>
69+
</html>

0 commit comments

Comments
 (0)