mirror of https://github.com/apache/poi.git
XWPF Numbering tests from bug #51134
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1144303 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
55eb2194b1
commit
ee57263273
|
@ -38,4 +38,22 @@ public class TestXWPFNumbering extends TestCase {
|
|||
assertEquals(abstrNumId, compareAbstractNum);
|
||||
}
|
||||
|
||||
public void testAddNumberingToDoc() throws IOException{
|
||||
BigInteger abstractNumId = BigInteger.valueOf(1);
|
||||
BigInteger numId = BigInteger.valueOf(1);
|
||||
|
||||
XWPFDocument docOut = new XWPFDocument();
|
||||
XWPFNumbering numbering = docOut.createNumbering();
|
||||
numId = numbering.addNum(abstractNumId);
|
||||
|
||||
XWPFDocument docIn = XWPFTestDataSamples.writeOutAndReadBack(docOut);
|
||||
|
||||
numbering = docIn.getNumbering();
|
||||
assertTrue(numbering.numExist(numId));
|
||||
XWPFNum num = numbering.getNum(numId);
|
||||
|
||||
BigInteger compareAbstractNum = num.getCTNum().getAbstractNumId().getVal();
|
||||
assertEquals(abstractNumId, compareAbstractNum);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,11 +20,14 @@ package org.apache.poi.xwpf.usermodel;
|
|||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.lang.String;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.poi.xwpf.XWPFTestDataSamples;
|
||||
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTStyle;
|
||||
|
||||
public class TestXWPFStyles extends TestCase {
|
||||
|
||||
// protected void setUp() throws Exception {
|
||||
|
@ -48,6 +51,23 @@ public class TestXWPFStyles extends TestCase {
|
|||
|
||||
}
|
||||
|
||||
public void testAddStylesToDocument() throws IOException{
|
||||
XWPFDocument docOut = new XWPFDocument();
|
||||
XWPFStyles styles = docOut.createStyles();
|
||||
|
||||
String strStyleName = "headline1";
|
||||
CTStyle ctStyle = CTStyle.Factory.newInstance();
|
||||
|
||||
ctStyle.setStyleId(strStyleName);
|
||||
XWPFStyle s = new XWPFStyle(ctStyle);
|
||||
styles.addStyle(s);
|
||||
|
||||
XWPFDocument docIn = XWPFTestDataSamples.writeOutAndReadBack(docOut);
|
||||
|
||||
styles = docIn.getStyles();
|
||||
assertTrue(styles.styleExist(strStyleName));
|
||||
}
|
||||
|
||||
// protected void tearDown() throws Exception {
|
||||
// super.tearDown();
|
||||
// }
|
||||
|
|
Loading…
Reference in New Issue