Skip to content

Commit e624c46

Browse files
committed
Add tests demonstrating background bug for inner inline elements
DEVSIX-2118
1 parent 37c12a5 commit e624c46

File tree

5 files changed

+39
-9
lines changed

5 files changed

+39
-9
lines changed

src/main/java/com/itextpdf/html2pdf/css/apply/impl/SpanTagCssApplier.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public void apply(ProcessorContext context, IStylesContainer stylesContainer, IT
117117
*/
118118
protected void applyChildElementStyles(IPropertyContainer element, Map<String, String> css, ProcessorContext context, IStylesContainer stylesContainer) {
119119
FontStyleApplierUtil.applyFontStyles(css, context, stylesContainer, element);
120-
//TODO: Background-applying currently doesn't work in html way for spans inside other spans.
120+
//TODO DEVSIX-2118: Background-applying currently doesn't work in html way for spans inside other spans.
121121
BackgroundApplierUtil.applyBackground(css, context, element);
122122
//TODO: Border-applying currently doesn't work in html way for spans inside other spans.
123123
BorderStyleApplierUtil.applyBorders(css, context, element);

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ This file is part of the iText (R) project.
4646
import com.itextpdf.kernel.utils.CompareTool;
4747
import com.itextpdf.test.ExtendedITextTest;
4848
import com.itextpdf.test.annotations.type.IntegrationTest;
49-
50-
import java.io.File;
51-
import java.io.IOException;
52-
5349
import org.junit.Assert;
5450
import org.junit.BeforeClass;
51+
import org.junit.Ignore;
5552
import org.junit.Test;
5653
import org.junit.experimental.categories.Category;
5754

55+
import java.io.File;
56+
import java.io.IOException;
57+
5858
@Category(IntegrationTest.class)
5959
public class LabelTest extends ExtendedITextTest {
6060

@@ -84,4 +84,11 @@ public void labelDisplayBlock02Test() throws IOException, InterruptedException {
8484
Assert.assertNull(new CompareTool().compareByContent(destinationFolder + "labelDisplayBlockTest02.pdf", sourceFolder + "cmp_labelDisplayBlockTest02.pdf", destinationFolder, "diffBlock02_"));
8585
}
8686

87+
@Test
88+
@Ignore("DEVSIX-2118")
89+
public void labelBackground01Test() throws IOException, InterruptedException {
90+
HtmlConverter.convertToPdf(new File(sourceFolder + "labelBackground01Test.html"), new File(destinationFolder + "labelBackground01Test.pdf"));
91+
Assert.assertNull(new CompareTool().compareByContent(destinationFolder + "labelBackground01Test.pdf", sourceFolder + "cmp_labelBackground01Test.pdf", destinationFolder, "diffBackground01_"));
92+
}
93+
8794
}

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ This file is part of the iText (R) project.
4646
import com.itextpdf.kernel.utils.CompareTool;
4747
import com.itextpdf.test.ExtendedITextTest;
4848
import com.itextpdf.test.annotations.type.IntegrationTest;
49-
50-
import java.io.File;
51-
import java.io.IOException;
52-
5349
import org.junit.Assert;
5450
import org.junit.BeforeClass;
51+
import org.junit.Ignore;
5552
import org.junit.Test;
5653
import org.junit.experimental.categories.Category;
5754

55+
import java.io.File;
56+
import java.io.IOException;
57+
5858
@Category(IntegrationTest.class)
5959
public class SpanTest extends ExtendedITextTest {
6060

@@ -133,4 +133,11 @@ public void spanTest11() throws IOException, InterruptedException {
133133
Assert.assertNull(new CompareTool().compareByContent(destinationFolder + "spanTest11.pdf", sourceFolder + "cmp_spanTest11.pdf", destinationFolder, "diff11_"));
134134
}
135135

136+
@Test
137+
@Ignore("DEVSIX-2118")
138+
public void spanTest12() throws IOException, InterruptedException {
139+
HtmlConverter.convertToPdf(new File(sourceFolder + "spanTest12.html"), new File(destinationFolder + "spanTest12.pdf"));
140+
Assert.assertNull(new CompareTool().compareByContent(destinationFolder + "spanTest12.pdf", sourceFolder + "cmp_spanTest12.pdf", destinationFolder, "diff12_"));
141+
}
142+
136143
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<html>
2+
3+
<body>
4+
<label style="background-color:red">
5+
<span>545545454545454</span>
6+
</label>
7+
</body>
8+
</html>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<html>
2+
3+
<body>
4+
<span style="background-color:red">
5+
<span>545545454545454</span>
6+
</span>
7+
</body>
8+
</html>

0 commit comments

Comments
 (0)