Skip to content

Commit a12c53d

Browse files
JonPReillyars18wrw
authored andcommitted
Add some new min/max width test. Update cmps.
DEVSIX-1947
1 parent 50aa7ab commit a12c53d

File tree

12 files changed

+80
-12
lines changed

12 files changed

+80
-12
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@ public void displayTable05Test() throws IOException, InterruptedException {
114114
convertToPdfAndCompare("display_table05", sourceFolder, destinationFolder);
115115
}
116116

117+
@Test
118+
@LogMessages(messages = {
119+
@LogMessage(messageTemplate = LogMessageConstant.TABLE_WIDTH_IS_MORE_THAN_EXPECTED_DUE_TO_MIN_WIDTH)
120+
})
121+
public void displayTable05aTest() throws IOException, InterruptedException {
122+
convertToPdfAndCompare("display_table05a", sourceFolder, destinationFolder);
123+
}
124+
117125
@Test
118126
public void displayTable06Test() throws IOException, InterruptedException {
119127
convertToPdfAndCompare("display_table06", sourceFolder, destinationFolder);

src/test/java/com/itextpdf/html2pdf/css/w3c/css21/normal_flow/MinWidthAppliesTo005Test.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ This file is part of the iText (R) project.
4646
import com.itextpdf.test.annotations.LogMessage;
4747
import com.itextpdf.test.annotations.LogMessages;
4848

49-
@LogMessages(messages = {@LogMessage(messageTemplate = com.itextpdf.io.LogMessageConstant.RECTANGLE_HAS_NEGATIVE_OR_ZERO_SIZES)})
5049
public class MinWidthAppliesTo005Test extends W3CCssTest {
5150
@Override
5251
protected String getHtmlFileName() {

src/test/java/com/itextpdf/html2pdf/css/w3c/css21/normal_flow/MinWidthAppliesTo006Test.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ This file is part of the iText (R) project.
4646
import com.itextpdf.test.annotations.LogMessage;
4747
import com.itextpdf.test.annotations.LogMessages;
4848

49-
@LogMessages(messages = {@LogMessage(messageTemplate = com.itextpdf.io.LogMessageConstant.RECTANGLE_HAS_NEGATIVE_OR_ZERO_SIZES)})
5049
public class MinWidthAppliesTo006Test extends W3CCssTest {
5150
@Override
5251
protected String getHtmlFileName() {

src/test/java/com/itextpdf/html2pdf/css/w3c/css21/normal_flow/MinWidthAppliesTo007Test.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,7 @@ This file is part of the iText (R) project.
4646
import com.itextpdf.test.annotations.LogMessage;
4747
import com.itextpdf.test.annotations.LogMessages;
4848

49-
@LogMessages(messages = {
50-
@LogMessage(messageTemplate = com.itextpdf.io.LogMessageConstant.RECTANGLE_HAS_NEGATIVE_OR_ZERO_SIZES),
51-
})
5249
public class MinWidthAppliesTo007Test extends W3CCssTest {
53-
// NOTE iText sets cellWidth on cell renderer after cell layout.
54-
// It causes applied min-width to be overwritten and thus results are wrong.
5550
@Override
5651
protected String getHtmlFileName() {
5752
return "min-width-applies-to-007.xht";

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,15 @@ This file is part of the iText (R) project.
5656
import com.itextpdf.test.annotations.LogMessage;
5757
import com.itextpdf.test.annotations.LogMessages;
5858
import com.itextpdf.test.annotations.type.IntegrationTest;
59-
60-
61-
import java.io.FileInputStream;
62-
import java.io.IOException;
63-
6459
import org.junit.Assert;
6560
import org.junit.BeforeClass;
6661
import org.junit.Ignore;
6762
import org.junit.Test;
6863
import org.junit.experimental.categories.Category;
6964

65+
import java.io.FileInputStream;
66+
import java.io.IOException;
67+
7068
@Category(IntegrationTest.class)
7169
public class TableTest extends ExtendedITextTest {
7270

@@ -370,6 +368,11 @@ public void plainTextTest() throws IOException, InterruptedException {
370368
runConvertToElements("plainTextTest", false);
371369
}
372370

371+
@Test
372+
public void tableCellMinWidthRightAlignmentTest() throws IOException, InterruptedException {
373+
runConvertToElements("tableCellMinWidthRightAlignmentTest", false);
374+
}
375+
373376
private void runTest(String testName) throws IOException, InterruptedException {
374377
runTest(testName, false);
375378
}
Binary file not shown.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<style>
5+
.table {
6+
display: table;
7+
max-width:100px;
8+
}
9+
.table-row {
10+
display: table-row;
11+
width: 400px; /* - */
12+
height: 400px; /* + */
13+
background-color: green; /* + */
14+
border: 20px solid yellow; /* - */
15+
}
16+
17+
.table-cell {
18+
display: table-cell;
19+
background-color: blue;
20+
border: 5px solid pink;
21+
max-width:50px;
22+
}
23+
</style>
24+
</head>
25+
<body>
26+
<table class="table">
27+
<tr class="table-row">
28+
<td>Ceaaaaaaaaaaaaaaddddddddddddddddll 1 1</td>
29+
<td class="table-cell">Cellaaaaaaaaaaaaaaaaa 1 2</td>
30+
<td>Cedddddddddddddddddddddll 1 1</td>
31+
</tr>
32+
</table>
33+
34+
</body>
35+
</html>
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)