Skip to content

Commit 6474261

Browse files
ars18wrwiText-CI
authored andcommitted
Add a test with a chain of css-imports.
DEVSIX-2264
1 parent 939159a commit 6474261

File tree

6 files changed

+35
-0
lines changed

6 files changed

+35
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ This file is part of the iText (R) project.
4242
*/
4343
package com.itextpdf.html2pdf.css;
4444

45+
import com.itextpdf.html2pdf.ConverterProperties;
4546
import com.itextpdf.html2pdf.HtmlConverter;
4647
import com.itextpdf.kernel.utils.CompareTool;
4748
import com.itextpdf.test.ExtendedITextTest;
@@ -78,4 +79,9 @@ public void relativeCssPath02Test() throws IOException, InterruptedException {
7879
Assert.assertNull(new CompareTool().compareByContent(destinationFolder + "css_relative_base64.pdf", sourceFolder + "cmp_css_relative_base64.pdf", destinationFolder, "diff02_"));
7980
}
8081

82+
@Test
83+
public void relativeImports01Test() throws IOException, InterruptedException {
84+
HtmlConverter.convertToPdf(new File(sourceFolder + "root/html/test.html"), new File(destinationFolder + "relativeImportsTest.pdf"), new ConverterProperties().setBaseUri(sourceFolder + "root/html/"));
85+
Assert.assertNull(new CompareTool().compareByContent(destinationFolder + "relativeImportsTest.pdf", sourceFolder + "cmp_relativeImportsTest.pdf", destinationFolder));
86+
}
8187
}
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
@import url("extra02.css");
3+
4+
div {
5+
border-style: dashed;
6+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
div {
2+
border-color: blue;
3+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@import url("../css/extra01.css");
2+
3+
div {
4+
border-width: 10px;
5+
opacity: 0.5;
6+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<html>
2+
<head>
3+
<link rel="stylesheet" type="text/css" href="test.css">
4+
<style>
5+
@import url("test.css");
6+
div {
7+
background-color: red;
8+
}
9+
</style>
10+
</head>
11+
<body>
12+
<div style="width: 100px; height: 100px;"></div>
13+
</body>
14+
</html>

0 commit comments

Comments
 (0)