Skip to content

Commit 8c460e4

Browse files
committed
Add test
DEVSIX-2085
1 parent 7a3894f commit 8c460e4

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-0
lines changed

src/test/java/com/itextpdf/html2pdf/ResourceResolverTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,20 @@ public void resourceResolverTest17() throws IOException, InterruptedException {
331331
Assert.assertNull(new CompareTool().compareByContent(outPdf, cmpPdf, destinationFolder, "diff17_"));
332332
}
333333

334+
@Test
335+
// TODO update cmp and remove logMessage after DEVSIX-2085 is done
336+
@LogMessages(messages = @LogMessage(messageTemplate = LogMessageConstant.UNABLE_TO_RETRIEVE_IMAGE_WITH_GIVEN_BASE_URI))
337+
public void resourceResolverTest18() throws IOException, InterruptedException {
338+
String baseUri = sourceFolder;
339+
String outPdf = destinationFolder + "resourceResolverTest18.pdf";
340+
String cmpPdf = sourceFolder + "cmp_resourceResolverTest18.pdf";
341+
try (FileInputStream fileInputStream = new FileInputStream(sourceFolder + "resourceResolverTest18.html");
342+
FileOutputStream fileOutputStream = new FileOutputStream(outPdf)) {
343+
HtmlConverter.convertToPdf(fileInputStream, fileOutputStream, new ConverterProperties().setBaseUri(baseUri));
344+
}
345+
Assert.assertNull(new CompareTool().compareByContent(outPdf, cmpPdf, destinationFolder, "diff18_"));
346+
}
347+
334348
// TODO test with absolute http links for resources?
335349
// TODO test with http base URI?
336350
}
Binary file not shown.
4.91 KB
Loading
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<body>
5+
<div>
6+
<img src="doggo.jpg" alt="doggo" width="250" height="250">
7+
</div>
8+
<svg xmlns="http://www.w3.org/2000/svg"
9+
xmlns:xlink="http://www.w3.org/1999/xlink" width="500" height="500">
10+
11+
<line x1="0" y1="100" x2="500" y2="100" stroke="black" stroke-width="2" />
12+
<image x="50" y="50" width="250" height="250" xlink:href="doggo.jpg" />
13+
<line x1="0" y1="200" x2="500" y2="200" stroke="black" stroke-width="2" />
14+
15+
16+
</svg>
17+
</body>
18+
19+
</html>

0 commit comments

Comments
 (0)