poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r820120 - in /poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf: AllXWPFTests.java TestXWPFDocument.java usermodel/TestXWPFHeadings.java
Date Tue, 29 Sep 2009 23:01:48 GMT
Author: josh
Date: Tue Sep 29 23:01:48 2009
New Revision: 820120

URL: http://svn.apache.org/viewvc?rev=820120&view=rev
Log:
minor fixes to junit after r819469

Modified:
    poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/AllXWPFTests.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/TestXWPFDocument.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFHeadings.java

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/AllXWPFTests.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/AllXWPFTests.java?rev=820120&r1=820119&r2=820120&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/AllXWPFTests.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/AllXWPFTests.java Tue Sep 29 23:01:48
2009
@@ -22,12 +22,15 @@
 
 import org.apache.poi.xwpf.extractor.TestXWPFWordExtractor;
 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.TestXWPFRun;
+import org.apache.poi.xwpf.usermodel.TestXWPFTable;
 
 /**
  * Collects all tests for <tt>org.apache.poi.xwpf</tt> and sub-packages.
- * 
+ *
  * @author Josh Micich
  */
 public final class AllXWPFTests {
@@ -35,10 +38,13 @@
 	public static Test suite() {
 		TestSuite result = new TestSuite(AllXWPFTests.class.getName());
 		result.addTestSuite(TestXWPFDocument.class);
+		result.addTestSuite(TestXWPFWordExtractor.class);
 		result.addTestSuite(TestXWPFHeaderFooterPolicy.class);
+		result.addTestSuite(TestXWPFHeader.class);
+		result.addTestSuite(TestXWPFHeadings.class);
 		result.addTestSuite(TestXWPFParagraph.class);
 		result.addTestSuite(TestXWPFRun.class);
-		result.addTestSuite(TestXWPFWordExtractor.class);
+		result.addTestSuite(TestXWPFTable.class);
 		return result;
 	}
 }

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/TestXWPFDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/TestXWPFDocument.java?rev=820120&r1=820119&r2=820120&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/TestXWPFDocument.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/TestXWPFDocument.java Tue Sep 29 23:01:48
2009
@@ -36,7 +36,10 @@
 			if(part.getContentType().equals(XWPFRelation.DOCUMENT.getContentType())) {
 				found = true;
 			}
-			System.out.println(part);
+			if (false) {
+				// successful tests should be silent
+				System.out.println(part);
+			}
 		}
 		assertTrue(found);
 	}

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFHeadings.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFHeadings.java?rev=820120&r1=820119&r2=820120&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFHeadings.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFHeadings.java Tue
Sep 29 23:01:48 2009
@@ -7,38 +7,48 @@
 
 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.xmlbeans.XmlException;
 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";
-	
-	public void testSetParagraphStyle() throws IOException, XmlException, InvalidFormatException
{
-        //new clean instance of paragraph
+
+	public void testSetParagraphStyle() throws IOException, XmlException {
+		//new clean instance of paragraph
 		XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("heading123.docx");
-        XWPFParagraph p = doc.createParagraph();
-        XWPFRun run = p.createRun();
-        run.setText("Heading 1");
-        
-        CTSdtBlock block = doc.getDocument().getBody().addNewSdt();
-        
-        assertNull(p.getStyle());
-        p.setStyle(HEADING1);
-        assertEquals(HEADING1, p.getCTP().getPPr().getPStyle().getVal());
-        
-        doc.createTOC();
-        
-//        CTStyles styles = doc.getStyle();
-//        CTStyle style = styles.addNewStyle();
-//        style.setType(STStyleType.PARAGRAPH);
-//        style.setStyleId("Heading1");
-        
-        File file = new File("/Users/paolomoz/Desktop/testHeaders.docx");
-        OutputStream out = new FileOutputStream(file);
-        doc.write(out);
-        out.close();
-    }
+		XWPFParagraph p = doc.createParagraph();
+		XWPFRun run = p.createRun();
+		run.setText("Heading 1");
+
+		CTSdtBlock block = doc.getDocument().getBody().addNewSdt();
+
+		assertNull(p.getStyle());
+		p.setStyle(HEADING1);
+		assertEquals(HEADING1, p.getCTP().getPPr().getPStyle().getVal());
+
+		doc.createTOC();
+
+		// TODO - finish this test
+		if (false) {
+			CTStyles styles = doc.getStyle();
+			CTStyle style = styles.addNewStyle();
+			style.setType(STStyleType.PARAGRAPH);
+			style.setStyleId("Heading1");
+		}
 
+		if (false) {
+			File file = TempFile.createTempFile("testHeaders", ".docx");
+			OutputStream out = new FileOutputStream(file);
+			doc.write(out);
+			out.close();
+		}
+	}
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message