minor fixes to junit after r819469
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@820120 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c11f67fd74
commit
c2d66a280f
@ -22,8 +22,11 @@ import junit.framework.TestSuite;
|
|||||||
|
|
||||||
import org.apache.poi.xwpf.extractor.TestXWPFWordExtractor;
|
import org.apache.poi.xwpf.extractor.TestXWPFWordExtractor;
|
||||||
import org.apache.poi.xwpf.model.TestXWPFHeaderFooterPolicy;
|
import org.apache.poi.xwpf.model.TestXWPFHeaderFooterPolicy;
|
||||||
|
import org.apache.poi.xwpf.usermodel.TestXWPFHeader;
|
||||||
|
import org.apache.poi.xwpf.usermodel.TestXWPFHeadings;
|
||||||
import org.apache.poi.xwpf.usermodel.TestXWPFParagraph;
|
import org.apache.poi.xwpf.usermodel.TestXWPFParagraph;
|
||||||
import org.apache.poi.xwpf.usermodel.TestXWPFRun;
|
import org.apache.poi.xwpf.usermodel.TestXWPFRun;
|
||||||
|
import org.apache.poi.xwpf.usermodel.TestXWPFTable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collects all tests for <tt>org.apache.poi.xwpf</tt> and sub-packages.
|
* Collects all tests for <tt>org.apache.poi.xwpf</tt> and sub-packages.
|
||||||
@ -35,10 +38,13 @@ public final class AllXWPFTests {
|
|||||||
public static Test suite() {
|
public static Test suite() {
|
||||||
TestSuite result = new TestSuite(AllXWPFTests.class.getName());
|
TestSuite result = new TestSuite(AllXWPFTests.class.getName());
|
||||||
result.addTestSuite(TestXWPFDocument.class);
|
result.addTestSuite(TestXWPFDocument.class);
|
||||||
|
result.addTestSuite(TestXWPFWordExtractor.class);
|
||||||
result.addTestSuite(TestXWPFHeaderFooterPolicy.class);
|
result.addTestSuite(TestXWPFHeaderFooterPolicy.class);
|
||||||
|
result.addTestSuite(TestXWPFHeader.class);
|
||||||
|
result.addTestSuite(TestXWPFHeadings.class);
|
||||||
result.addTestSuite(TestXWPFParagraph.class);
|
result.addTestSuite(TestXWPFParagraph.class);
|
||||||
result.addTestSuite(TestXWPFRun.class);
|
result.addTestSuite(TestXWPFRun.class);
|
||||||
result.addTestSuite(TestXWPFWordExtractor.class);
|
result.addTestSuite(TestXWPFTable.class);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,11 @@ public final class TestXWPFDocument extends TestCase {
|
|||||||
if(part.getContentType().equals(XWPFRelation.DOCUMENT.getContentType())) {
|
if(part.getContentType().equals(XWPFRelation.DOCUMENT.getContentType())) {
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
if (false) {
|
||||||
|
// successful tests should be silent
|
||||||
System.out.println(part);
|
System.out.println(part);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
assertTrue(found);
|
assertTrue(found);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,15 +7,21 @@ import java.io.OutputStream;
|
|||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
import org.apache.poi.util.TempFile;
|
||||||
import org.apache.poi.xwpf.XWPFTestDataSamples;
|
import org.apache.poi.xwpf.XWPFTestDataSamples;
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSdtBlock;
|
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSdtBlock;
|
||||||
|
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTStyle;
|
||||||
|
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTStyles;
|
||||||
|
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STStyleType;
|
||||||
|
|
||||||
public class TestXWPFHeadings extends TestCase{
|
/**
|
||||||
|
* @author Paolo Mottadelli
|
||||||
|
*/
|
||||||
|
public final class TestXWPFHeadings extends TestCase{
|
||||||
private static final String HEADING1 = "Heading1";
|
private static final String HEADING1 = "Heading1";
|
||||||
|
|
||||||
public void testSetParagraphStyle() throws IOException, XmlException, InvalidFormatException {
|
public void testSetParagraphStyle() throws IOException, XmlException {
|
||||||
//new clean instance of paragraph
|
//new clean instance of paragraph
|
||||||
XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("heading123.docx");
|
XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("heading123.docx");
|
||||||
XWPFParagraph p = doc.createParagraph();
|
XWPFParagraph p = doc.createParagraph();
|
||||||
@ -30,15 +36,19 @@ public class TestXWPFHeadings extends TestCase{
|
|||||||
|
|
||||||
doc.createTOC();
|
doc.createTOC();
|
||||||
|
|
||||||
// CTStyles styles = doc.getStyle();
|
// TODO - finish this test
|
||||||
// CTStyle style = styles.addNewStyle();
|
if (false) {
|
||||||
// style.setType(STStyleType.PARAGRAPH);
|
CTStyles styles = doc.getStyle();
|
||||||
// style.setStyleId("Heading1");
|
CTStyle style = styles.addNewStyle();
|
||||||
|
style.setType(STStyleType.PARAGRAPH);
|
||||||
|
style.setStyleId("Heading1");
|
||||||
|
}
|
||||||
|
|
||||||
File file = new File("/Users/paolomoz/Desktop/testHeaders.docx");
|
if (false) {
|
||||||
|
File file = TempFile.createTempFile("testHeaders", ".docx");
|
||||||
OutputStream out = new FileOutputStream(file);
|
OutputStream out = new FileOutputStream(file);
|
||||||
doc.write(out);
|
doc.write(out);
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user