[bug-64348] partial fix for IndexOutOfBoundsException

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1876512 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2020-04-14 12:53:17 +00:00
parent 531e4fee2e
commit fde6f81305
1 changed files with 30 additions and 0 deletions

View File

@ -25,6 +25,7 @@ import java.io.IOException;
import org.apache.poi.xwpf.XWPFTestDataSamples; import org.apache.poi.xwpf.XWPFTestDataSamples;
import org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy; import org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR;
@ -205,21 +206,50 @@ public final class TestXWPFHeader {
} }
} }
public void testSetWatermarkOnEmptyDoc() throws IOException {
try (XWPFDocument sampleDoc = new XWPFDocument()) {
// No header is set (yet)
XWPFHeaderFooterPolicy policy = sampleDoc.getHeaderFooterPolicy();
assertNull(policy.getDefaultHeader());
assertNull(policy.getFirstPageHeader());
assertNull(policy.getDefaultFooter());
policy.createWatermark("DRAFT");
assertNotNull(policy.getDefaultHeader());
assertNotNull(policy.getFirstPageHeader());
assertNotNull(policy.getEvenPageHeader());
// Re-open, and check
XWPFDocument reopened = XWPFTestDataSamples.writeOutAndReadBack(sampleDoc);
policy = reopened.getHeaderFooterPolicy();
assertNotNull(policy.getDefaultHeader());
assertNotNull(policy.getFirstPageHeader());
assertNotNull(policy.getEvenPageHeader());
}
}
@Ignore
@Test @Test
public void testAddPictureData() { public void testAddPictureData() {
// TODO // TODO
} }
@Ignore
@Test @Test
public void testGetAllPictures() { public void testGetAllPictures() {
// TODO // TODO
} }
@Ignore
@Test @Test
public void testGetAllPackagePictures() { public void testGetAllPackagePictures() {
// TODO // TODO
} }
@Ignore
@Test @Test
public void testGetPictureDataById() { public void testGetPictureDataById() {
// TODO // TODO