ASF Bugzilla – Attachment 27268 Details for
Bug 51134
[PATCH] XWPFNumbering and XWPFStyles classes lack a constructor that doesn't call onDocumentRead
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Unit tests for creating and adding Numberings and Styles to a new document.
numberingStyles_tests.patch (text/plain), 2.05 KB, created by
Mike McEuen
on 2011-07-06 20:12:31 UTC
(
hide
)
Description:
Unit tests for creating and adding Numberings and Styles to a new document.
Filename:
MIME Type:
Creator:
Mike McEuen
Created:
2011-07-06 20:12:31 UTC
Size:
2.05 KB
patch
obsolete
>Index: TestXWPFNumbering.java >=================================================================== >--- TestXWPFNumbering.java (revision 1130123) >+++ TestXWPFNumbering.java (working copy) >@@ -38,4 +38,22 @@ > 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); >+ } >+ > } >Index: TestXWPFStyles.java >=================================================================== >--- TestXWPFStyles.java (revision 1130123) >+++ TestXWPFStyles.java (working copy) >@@ -20,11 +20,14 @@ > 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 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(); > // }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 51134
:
27042
|
27043
| 27268