Skip to content

Commit 5ebd561

Browse files
committed
Add test. DEVSIX-2024
1 parent b267f90 commit 5ebd561

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,27 @@ This file is part of the iText (R) project.
4747
import com.itextpdf.html2pdf.HtmlConverter;
4848
import com.itextpdf.html2pdf.css.media.MediaDeviceDescription;
4949
import com.itextpdf.html2pdf.css.media.MediaType;
50+
import com.itextpdf.io.LogMessageConstant;
5051
import com.itextpdf.kernel.utils.CompareTool;
52+
import com.itextpdf.test.annotations.LogMessage;
53+
import com.itextpdf.test.annotations.LogMessages;
5154
import com.itextpdf.test.annotations.type.IntegrationTest;
5255
import org.junit.Assert;
5356
import org.junit.BeforeClass;
57+
import org.junit.Rule;
5458
import org.junit.Test;
5559
import org.junit.experimental.categories.Category;
60+
import org.junit.rules.ExpectedException;
5661

5762
import java.io.File;
5863
import java.io.IOException;
5964

6065
@Category(IntegrationTest.class)
6166
public class PageBreakTest extends ExtendedHtmlConversionITextTest {
6267

68+
@Rule
69+
public ExpectedException junitExpectedException = ExpectedException.none(); //Member of testing class. Add if it isn't there.
70+
6371
public static final String sourceFolder = "./src/test/resources/com/itextpdf/html2pdf/css/PageBreakTest/";
6472
public static final String destinationFolder = "./target/test/com/itextpdf/html2pdf/css/PageBreakTest/";
6573

@@ -123,6 +131,14 @@ public void pageBreakBeforeTable01Test() throws IOException, InterruptedExceptio
123131
runTest("page-break-before-table01");
124132
}
125133

134+
@Test
135+
@LogMessages(messages = {@LogMessage(messageTemplate = LogMessageConstant.CLIP_ELEMENT)})
136+
/* Test will fail after fix in DEVSIX-2024 */
137+
public void pageBreakInConstrainedDivTest() throws IOException, InterruptedException {
138+
junitExpectedException.expect(UnsupportedOperationException.class);
139+
runTest("pageBreakInConstrainedDivTest");
140+
}
141+
126142
private void runTest(String name) throws IOException, InterruptedException {
127143
String htmlPath = sourceFolder + name + ".html";
128144
String pdfPath = destinationFolder + name + ".pdf";
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<div>
2+
<div style="height: 396px;">
3+
<p>Foo</p>
4+
5+
<div style="page-break-before: always"></div>
6+
<p>Bar</p>
7+
</div>
8+
</div>

0 commit comments

Comments
 (0)