Skip to content

Commit 34681a4

Browse files
IdamkinIiText-CI
authored andcommitted
Add test that illustrates table width problem
DEVSIX-2895 Autoported commit. Original commit hash: [3b56ebd9]
1 parent d09ea54 commit 34681a4

File tree

4 files changed

+79
-1
lines changed

4 files changed

+79
-1
lines changed

itext.tests/itext.html2pdf.tests/itext/html2pdf/element/TableTest.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,15 @@ public virtual void TableCellMinWidthRightAlignmentTest() {
601601
RunConvertToElements("tableCellMinWidthRightAlignmentTest", false);
602602
}
603603

604+
/// <exception cref="System.IO.IOException"/>
605+
/// <exception cref="System.Exception"/>
606+
[NUnit.Framework.Test]
607+
[LogMessage(iText.IO.LogMessageConstant.SUM_OF_TABLE_COLUMNS_IS_GREATER_THAN_100, Count = 4)]
608+
public virtual void TableWidthMoreThan100PercentTest() {
609+
//TODO: DEVSIX-2895 - inconsistency in table width between pdf and html
610+
RunTest("tableWidthMoreThan100Percent");
611+
}
612+
604613
/// <exception cref="System.IO.IOException"/>
605614
/// <exception cref="System.Exception"/>
606615
private void RunTest(String testName) {
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>

port-hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6ce580ca7fa6ae9cba95dc5ac04e698fd3b0a1d2
1+
3b56ebd9e2a448407302a31185a94aee5059d303

0 commit comments

Comments
 (0)