Skip to content

Commit 5703d4d

Browse files
committed
Support min-width and max-width
DEVSIX-1195
1 parent e4ed917 commit 5703d4d

File tree

5 files changed

+47
-0
lines changed

5 files changed

+47
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ public void percentTest() throws IOException, InterruptedException {
7171
runTest("percentTest");
7272
}
7373

74+
@Test
75+
public void maxWidthTest01() throws IOException, InterruptedException {
76+
runTest("maxWidthTest01");
77+
}
78+
79+
@Test
80+
public void minWidthTest01() throws IOException, InterruptedException {
81+
runTest("minWidthTest01");
82+
}
83+
7484
@Test
7585
//Todo: the width for table currently set incorrect.
7686
public void percentMarginTest() throws IOException, InterruptedException {
Binary file not shown.

src/test/resources/com/itextpdf/html2pdf/css/WidthTest/cmp_minWidthTest01.pdf

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<style>
5+
p {
6+
max-width: 150px;
7+
background-color: yellow;
8+
}
9+
</style>
10+
</head>
11+
<body>
12+
13+
<p>Paragraph</p>
14+
<div style="width: 150px;background-color: yellow">150px</div>
15+
16+
</body>
17+
</html>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<style>
5+
p {
6+
min-width: 150px;
7+
background-color: yellow;
8+
}
9+
</style>
10+
</head>
11+
<body>
12+
<div style="width: 100px; overflow-x:hidden;">
13+
<p>The minimum width of this paragraph is set to 150px. But div has width 100px and overflow-x:hidden</p>
14+
</div>
15+
16+
<div style="width: 100px;background-color: yellow;">
17+
100px
18+
</div>
19+
</body>
20+
</html>

0 commit comments

Comments
 (0)