Skip to content

Commit 2c296ec

Browse files
committed
Move tests from Html2PdfTest to their corresponding elements
This also removes several assets that werend used anymore. DEVSIX-6183
1 parent afccde5 commit 2c296ec

39 files changed

+217
-212
lines changed

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

Lines changed: 0 additions & 144 deletions
This file was deleted.

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

Lines changed: 7 additions & 1 deletion
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.element;
4444

45+
import com.itextpdf.html2pdf.ExtendedHtmlConversionITextTest;
4546
import com.itextpdf.html2pdf.HtmlConverter;
4647
import com.itextpdf.kernel.utils.CompareTool;
4748
import com.itextpdf.test.ExtendedITextTest;
@@ -56,7 +57,7 @@ This file is part of the iText (R) project.
5657
import org.junit.experimental.categories.Category;
5758

5859
@Category(IntegrationTest.class)
59-
public class BodyTest extends ExtendedITextTest {
60+
public class BodyTest extends ExtendedHtmlConversionITextTest {
6061

6162
public static final String sourceFolder = "./src/test/resources/com/itextpdf/html2pdf/element/BodyTest/";
6263
public static final String destinationFolder = "./target/test/com/itextpdf/html2pdf/element/BodyTest/";
@@ -122,4 +123,9 @@ public void body09Test() throws IOException, InterruptedException {
122123
HtmlConverter.convertToPdf(new File(sourceFolder + "bodyTest09.html"), new File(destinationFolder + "bodyTest09.pdf"));
123124
Assert.assertNull(new CompareTool().compareByContent(destinationFolder + "bodyTest09.pdf", sourceFolder + "cmp_bodyTest09.pdf", destinationFolder, "diff09_"));
124125
}
126+
@Test
127+
public void helloMalformedDocumentTest() throws IOException, InterruptedException {
128+
convertToPdfAndCompare("hello_malformed", sourceFolder, destinationFolder);
129+
}
130+
125131
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,9 @@ public void divInTableDataCellTest() throws IOException, InterruptedException {
9595
public void divColumnCountTest() throws IOException, InterruptedException {
9696
convertToPdfAndCompare("divColumnCount", SOURCE_FOLDER, DESTINATION_FOLDER);
9797
}
98+
@Test
99+
public void helloDivDocumentTest() throws IOException, InterruptedException {
100+
convertToPdfAndCompare("hello_div", SOURCE_FOLDER, DESTINATION_FOLDER);
101+
}
102+
98103
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,10 @@ public void sourceMediaTest() throws IOException, InterruptedException {
175175
public void resolutionInfoStructOf8bimHeaderImageTest() throws IOException, InterruptedException {
176176
convertToPdfAndCompare("resolutionInfoStructOf8bimHeaderImage", SOURCE_FOLDER, DESTINATION_FOLDER);
177177
}
178+
179+
@Test
180+
public void htmlImgBase64SVGTest() throws IOException, InterruptedException {
181+
convertToPdfAndCompare("imgTag_base64svg", SOURCE_FOLDER, DESTINATION_FOLDER);
182+
}
183+
178184
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package com.itextpdf.html2pdf.element;
2+
3+
import com.itextpdf.html2pdf.ExtendedHtmlConversionITextTest;
4+
import com.itextpdf.html2pdf.logs.Html2PdfLogMessageConstant;
5+
import com.itextpdf.styledxmlparser.logs.StyledXmlParserLogMessageConstant;
6+
import com.itextpdf.test.annotations.LogMessage;
7+
import com.itextpdf.test.annotations.LogMessages;
8+
import com.itextpdf.test.annotations.type.IntegrationTest;
9+
10+
import java.io.IOException;
11+
import org.junit.BeforeClass;
12+
import org.junit.Test;
13+
import org.junit.experimental.categories.Category;
14+
15+
@Category(IntegrationTest.class)
16+
public class ObjectTest extends ExtendedHtmlConversionITextTest {
17+
18+
public static final String sourceFolder = "./src/test/resources/com/itextpdf/html2pdf/element/ObjectTest/";
19+
public static final String destinationFolder = "./target/test/com/itextpdf/html2pdf/element/ObjectTest/";
20+
21+
22+
@BeforeClass
23+
public static void beforeClass() {
24+
createDestinationFolder(destinationFolder);
25+
}
26+
27+
@Test
28+
public void base64svgTest() throws IOException, InterruptedException {
29+
convertToPdfAndCompare("objectTag_base64svg", sourceFolder, destinationFolder);
30+
}
31+
32+
@Test
33+
@LogMessages(messages = {
34+
@LogMessage(messageTemplate =
35+
StyledXmlParserLogMessageConstant.UNABLE_TO_RETRIEVE_STREAM_WITH_GIVEN_BASE_URI, count = 1),
36+
@LogMessage(messageTemplate = Html2PdfLogMessageConstant.WORKER_UNABLE_TO_PROCESS_OTHER_WORKER, count = 1)})
37+
public void htmlObjectIncorrectBase64Test() throws IOException, InterruptedException {
38+
convertToPdfAndCompare("objectTag_incorrectBase64svg", sourceFolder, destinationFolder);
39+
}
40+
41+
@Test
42+
//TODO: update after DEVSIX-1346
43+
@LogMessages(messages = {
44+
@LogMessage(messageTemplate = Html2PdfLogMessageConstant.WORKER_UNABLE_TO_PROCESS_IT_S_TEXT_CONTENT,
45+
count = 1),
46+
@LogMessage(messageTemplate = Html2PdfLogMessageConstant.WORKER_UNABLE_TO_PROCESS_OTHER_WORKER, count = 2),
47+
})
48+
public void htmlObjectAltTextTest() throws IOException, InterruptedException {
49+
convertToPdfAndCompare("objectTag_altText", sourceFolder, destinationFolder);
50+
}
51+
52+
@Test
53+
@LogMessages(messages = {
54+
@LogMessage(messageTemplate = Html2PdfLogMessageConstant.WORKER_UNABLE_TO_PROCESS_OTHER_WORKER,
55+
count = 1),})
56+
public void htmlObjectNestedObjectTest() throws IOException, InterruptedException {
57+
convertToPdfAndCompare("objectTag_nestedTag", sourceFolder, destinationFolder);
58+
}
59+
60+
}

0 commit comments

Comments
 (0)