poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From talli...@apache.org
Subject svn commit: r1682473 [8/8] - in /poi/trunk/src/ooxml: java/org/apache/poi/util/ java/org/apache/poi/xwpf/ java/org/apache/poi/xwpf/extractor/ java/org/apache/poi/xwpf/model/ java/org/apache/poi/xwpf/usermodel/ testcases/org/apache/poi/xwpf/ testcases/o...
Date Fri, 29 May 2015 14:01:33 GMT
Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFPictureData.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFPictureData.java?rev=1682473&r1=1682472&r2=1682473&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFPictureData.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFPictureData.java Fri May 29 14:01:31 2015
@@ -20,138 +20,129 @@ package org.apache.poi.xwpf.usermodel;
 import static org.junit.Assert.assertArrayEquals;
 
 import java.io.IOException;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
-import org.apache.poi.openxml4j.opc.PackageRelationship;
-import org.apache.poi.xssf.usermodel.XSSFRelation;
+import java.util.List;
+
+import junit.framework.TestCase;
+import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
+import org.apache.poi.openxml4j.opc.PackageRelationship;
+import org.apache.poi.xssf.usermodel.XSSFRelation;
 import org.apache.poi.xwpf.XWPFTestDataSamples;
-import org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy;
-
-public class TestXWPFPictureData extends TestCase {
-    
-    public void testRead() throws InvalidFormatException, IOException
-    {
-        XWPFDocument sampleDoc = XWPFTestDataSamples.openSampleDocument("VariousPictures.docx");
-        List<XWPFPictureData> pictures = sampleDoc.getAllPictures();
-
-        assertEquals(5,pictures.size());
-        String[] ext = {"wmf","png","emf","emf","jpeg"};
-        for (int i = 0 ; i < pictures.size() ; i++)
-        {
-            assertEquals(ext[i],pictures.get(i).suggestFileExtension());
-        }
-
-        int num = pictures.size();
-
-        byte[] pictureData = XWPFTestDataSamples.getImage("nature1.jpg");
-
-        String relationId = sampleDoc.addPictureData(pictureData,XWPFDocument.PICTURE_TYPE_JPEG);
-        // picture list was updated
-        assertEquals(num + 1,pictures.size());
-        XWPFPictureData pict = (XWPFPictureData) sampleDoc.getRelationById(relationId);
-        assertEquals("jpeg",pict.suggestFileExtension());
-        assertArrayEquals(pictureData,pict.getData());
-    }
-
-    public void testPictureInHeader() throws IOException
-    {
-        XWPFDocument sampleDoc = XWPFTestDataSamples.openSampleDocument("headerPic.docx");
-        verifyOneHeaderPicture(sampleDoc);
-        
-        XWPFDocument readBack = XWPFTestDataSamples.writeOutAndReadBack(sampleDoc);
-        verifyOneHeaderPicture(readBack);
-    }
+import org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy;
+
+public class TestXWPFPictureData extends TestCase {
+
+    public void testRead() throws InvalidFormatException, IOException {
+        XWPFDocument sampleDoc = XWPFTestDataSamples.openSampleDocument("VariousPictures.docx");
+        List<XWPFPictureData> pictures = sampleDoc.getAllPictures();
+
+        assertEquals(5, pictures.size());
+        String[] ext = {"wmf", "png", "emf", "emf", "jpeg"};
+        for (int i = 0; i < pictures.size(); i++) {
+            assertEquals(ext[i], pictures.get(i).suggestFileExtension());
+        }
+
+        int num = pictures.size();
+
+        byte[] pictureData = XWPFTestDataSamples.getImage("nature1.jpg");
+
+        String relationId = sampleDoc.addPictureData(pictureData, XWPFDocument.PICTURE_TYPE_JPEG);
+        // picture list was updated
+        assertEquals(num + 1, pictures.size());
+        XWPFPictureData pict = (XWPFPictureData) sampleDoc.getRelationById(relationId);
+        assertEquals("jpeg", pict.suggestFileExtension());
+        assertArrayEquals(pictureData, pict.getData());
+    }
+
+    public void testPictureInHeader() throws IOException {
+        XWPFDocument sampleDoc = XWPFTestDataSamples.openSampleDocument("headerPic.docx");
+        verifyOneHeaderPicture(sampleDoc);
+
+        XWPFDocument readBack = XWPFTestDataSamples.writeOutAndReadBack(sampleDoc);
+        verifyOneHeaderPicture(readBack);
+    }
 
     private void verifyOneHeaderPicture(XWPFDocument sampleDoc) {
         XWPFHeaderFooterPolicy policy = sampleDoc.getHeaderFooterPolicy();
 
-        XWPFHeader header = policy.getDefaultHeader();
-
-        List<XWPFPictureData> pictures = header.getAllPictures();
-        assertEquals(1,pictures.size());
-    }
-
-    public void testNew() throws InvalidFormatException, IOException 
-    {
-        XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("EmptyDocumentWithHeaderFooter.docx");
-        byte[] jpegData = XWPFTestDataSamples.getImage("nature1.jpg");
-        assertNotNull(jpegData);
+        XWPFHeader header = policy.getDefaultHeader();
+
+        List<XWPFPictureData> pictures = header.getAllPictures();
+        assertEquals(1, pictures.size());
+    }
+
+    public void testNew() throws InvalidFormatException, IOException {
+        XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("EmptyDocumentWithHeaderFooter.docx");
+        byte[] jpegData = XWPFTestDataSamples.getImage("nature1.jpg");
+        assertNotNull(jpegData);
         byte[] gifData = XWPFTestDataSamples.getImage("nature1.gif");
         assertNotNull(gifData);
         byte[] pngData = XWPFTestDataSamples.getImage("nature1.png");
-        assertNotNull(pngData);
-
-        List<XWPFPictureData> pictures = doc.getAllPictures();
-        assertEquals(0,pictures.size());
-
-        // Document shouldn't have any image relationships
-        assertEquals(13,doc.getPackagePart().getRelationships().size());
-        for (PackageRelationship rel : doc.getPackagePart().getRelationships())
-        {
-            if (rel.getRelationshipType().equals(XSSFRelation.IMAGE_JPEG.getRelation()))
-            {
-                fail("Shouldn't have JPEG yet");
-            }
-        }
-
-        // Add the image
-        String relationId = doc.addPictureData(jpegData,XWPFDocument.PICTURE_TYPE_JPEG);
-        assertEquals(1,pictures.size());
-        XWPFPictureData jpgPicData = (XWPFPictureData) doc.getRelationById(relationId);
-        assertEquals("jpeg",jpgPicData.suggestFileExtension());
-        assertArrayEquals(jpegData,jpgPicData.getData());
-
-        // Ensure it now has one
-        assertEquals(14,doc.getPackagePart().getRelationships().size());
-        PackageRelationship jpegRel = null;
-        for (PackageRelationship rel : doc.getPackagePart().getRelationships())
-        {
-            if (rel.getRelationshipType().equals(XWPFRelation.IMAGE_JPEG.getRelation()))
-            {
-                if (jpegRel != null)
-                    fail("Found 2 jpegs!");
-                jpegRel = rel;
-            }
-        }
-        assertNotNull("JPEG Relationship not found",jpegRel);
-
-        // Check the details
-        assertNotNull(jpegRel);
-        assertEquals(XWPFRelation.IMAGE_JPEG.getRelation(),jpegRel.getRelationshipType());
-        assertEquals("/word/document.xml",jpegRel.getSource().getPartName().toString());
-        assertEquals("/word/media/image1.jpeg",jpegRel.getTargetURI().getPath());
-
-        XWPFPictureData pictureDataByID = doc.getPictureDataByID(jpegRel.getId());
-        assertArrayEquals(jpegData, pictureDataByID.getData());
-
-        // Save an re-load, check it appears
-        doc = XWPFTestDataSamples.writeOutAndReadBack(doc);
-        assertEquals(1,doc.getAllPictures().size());
-        assertEquals(1,doc.getAllPackagePictures().size());
-
-        // verify the picture that we read back in
-        pictureDataByID = doc.getPictureDataByID(jpegRel.getId());
-        assertArrayEquals(jpegData, pictureDataByID.getData());
-        
-    }
-
-    public void testBug51770() throws InvalidFormatException, IOException {
+        assertNotNull(pngData);
+
+        List<XWPFPictureData> pictures = doc.getAllPictures();
+        assertEquals(0, pictures.size());
+
+        // Document shouldn't have any image relationships
+        assertEquals(13, doc.getPackagePart().getRelationships().size());
+        for (PackageRelationship rel : doc.getPackagePart().getRelationships()) {
+            if (rel.getRelationshipType().equals(XSSFRelation.IMAGE_JPEG.getRelation())) {
+                fail("Shouldn't have JPEG yet");
+            }
+        }
+
+        // Add the image
+        String relationId = doc.addPictureData(jpegData, XWPFDocument.PICTURE_TYPE_JPEG);
+        assertEquals(1, pictures.size());
+        XWPFPictureData jpgPicData = (XWPFPictureData) doc.getRelationById(relationId);
+        assertEquals("jpeg", jpgPicData.suggestFileExtension());
+        assertArrayEquals(jpegData, jpgPicData.getData());
+
+        // Ensure it now has one
+        assertEquals(14, doc.getPackagePart().getRelationships().size());
+        PackageRelationship jpegRel = null;
+        for (PackageRelationship rel : doc.getPackagePart().getRelationships()) {
+            if (rel.getRelationshipType().equals(XWPFRelation.IMAGE_JPEG.getRelation())) {
+                if (jpegRel != null)
+                    fail("Found 2 jpegs!");
+                jpegRel = rel;
+            }
+        }
+        assertNotNull("JPEG Relationship not found", jpegRel);
+
+        // Check the details
+        assertNotNull(jpegRel);
+        assertEquals(XWPFRelation.IMAGE_JPEG.getRelation(), jpegRel.getRelationshipType());
+        assertEquals("/word/document.xml", jpegRel.getSource().getPartName().toString());
+        assertEquals("/word/media/image1.jpeg", jpegRel.getTargetURI().getPath());
+
+        XWPFPictureData pictureDataByID = doc.getPictureDataByID(jpegRel.getId());
+        assertArrayEquals(jpegData, pictureDataByID.getData());
+
+        // Save an re-load, check it appears
+        doc = XWPFTestDataSamples.writeOutAndReadBack(doc);
+        assertEquals(1, doc.getAllPictures().size());
+        assertEquals(1, doc.getAllPackagePictures().size());
+
+        // verify the picture that we read back in
+        pictureDataByID = doc.getPictureDataByID(jpegRel.getId());
+        assertArrayEquals(jpegData, pictureDataByID.getData());
+
+    }
+
+    public void testBug51770() throws InvalidFormatException, IOException {
         XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("Bug51170.docx");
         XWPFHeaderFooterPolicy policy = doc.getHeaderFooterPolicy();
         XWPFHeader header = policy.getDefaultHeader();
         for (XWPFParagraph paragraph : header.getParagraphs()) {
             for (XWPFRun run : paragraph.getRuns()) {
                 for (XWPFPicture picture : run.getEmbeddedPictures()) {
-                    if (paragraph.getDocument() != null) {
-                        //System.out.println(picture.getCTPicture());
-                        XWPFPictureData data = picture.getPictureData();
-                        if(data != null) System.out.println(data.getFileName());
-                    }
-                }
-            }
+                    if (paragraph.getDocument() != null) {
+                        //System.out.println(picture.getCTPicture());
+                        XWPFPictureData data = picture.getPictureData();
+                        if (data != null) System.out.println(data.getFileName());
+                    }
+                }
+            }
         }
 
     }

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java?rev=1682473&r1=1682472&r2=1682473&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFRun.java Fri May 29 14:01:31 2015
@@ -20,13 +20,12 @@ import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.math.BigInteger;
 import java.util.Iterator;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.apache.poi.xwpf.XWPFTestDataSamples;
-import org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBr;
+import java.util.List;
+
+import junit.framework.TestCase;
+import org.apache.poi.xwpf.XWPFTestDataSamples;
+import org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBr;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.STBrClear;
@@ -46,28 +45,28 @@ public class TestXWPFRun extends TestCas
         p = doc.createParagraph();
 
         this.ctRun = CTR.Factory.newInstance();
-    }
-
-    public void testSetGetText() {
-        ctRun.addNewT().setStringValue("TEST STRING");	
-        ctRun.addNewT().setStringValue("TEST2 STRING");	
-        ctRun.addNewT().setStringValue("TEST3 STRING");
-
-        assertEquals(3,ctRun.sizeOfTArray());
-        XWPFRun run = new XWPFRun(ctRun, p);
-
-        assertEquals("TEST2 STRING",run.getText(1));
-
-        run.setText("NEW STRING",0);
-        assertEquals("NEW STRING",run.getText(0));
-
-        //run.setText("xxx",14);
-        //fail("Position wrong");
-    }
-  
-    public void testSetGetBold() {
-        CTRPr rpr = ctRun.addNewRPr();
-        rpr.addNewB().setVal(STOnOff.TRUE);
+    }
+
+    public void testSetGetText() {
+        ctRun.addNewT().setStringValue("TEST STRING");
+        ctRun.addNewT().setStringValue("TEST2 STRING");
+        ctRun.addNewT().setStringValue("TEST3 STRING");
+
+        assertEquals(3, ctRun.sizeOfTArray());
+        XWPFRun run = new XWPFRun(ctRun, p);
+
+        assertEquals("TEST2 STRING", run.getText(1));
+
+        run.setText("NEW STRING", 0);
+        assertEquals("NEW STRING", run.getText(0));
+
+        //run.setText("xxx",14);
+        //fail("Position wrong");
+    }
+
+    public void testSetGetBold() {
+        CTRPr rpr = ctRun.addNewRPr();
+        rpr.addNewB().setVal(STOnOff.TRUE);
 
         XWPFRun run = new XWPFRun(ctRun, p);
         assertEquals(true, run.isBold());
@@ -178,16 +177,16 @@ public class TestXWPFRun extends TestCas
         run.setText("T1");
         run.addCarriageReturn();
         run.addCarriageReturn();
-        run.setText("T2");
-        run.addCarriageReturn();
-        assertEquals(3, run.getCTR().sizeOfCrArray());
-        
-        assertEquals("T1\n\nT2\n", run.toString());
-    }
-    
-    public void testAddTabsAndLineBreaks() {
-        ctRun.addNewT().setStringValue("TEST STRING");
-        ctRun.addNewCr();
+        run.setText("T2");
+        run.addCarriageReturn();
+        assertEquals(3, run.getCTR().sizeOfCrArray());
+
+        assertEquals("T1\n\nT2\n", run.toString());
+    }
+
+    public void testAddTabsAndLineBreaks() {
+        ctRun.addNewT().setStringValue("TEST STRING");
+        ctRun.addNewCr();
         ctRun.addNewT().setStringValue("TEST2 STRING");
         ctRun.addNewTab();
         ctRun.addNewT().setStringValue("TEST3 STRING");
@@ -199,21 +198,21 @@ public class TestXWPFRun extends TestCas
         run.addCarriageReturn();
         run.setText("T2");
         run.addTab();
-        run.setText("T3");
-        assertEquals(1, run.getCTR().sizeOfCrArray());
-        assertEquals(1, run.getCTR().sizeOfTabArray());
-        
-        assertEquals("T1\nT2\tT3", run.toString());
-    }
-
+        run.setText("T3");
+        assertEquals(1, run.getCTR().sizeOfCrArray());
+        assertEquals(1, run.getCTR().sizeOfTabArray());
+
+        assertEquals("T1\nT2\tT3", run.toString());
+    }
+
     public void testAddPageBreak() {
-        ctRun.addNewT().setStringValue("TEST STRING");
-        ctRun.addNewBr();
-        ctRun.addNewT().setStringValue("TEST2 STRING");
-        CTBr breac=ctRun.addNewBr();
-        breac.setClear(STBrClear.LEFT);
-        ctRun.addNewT().setStringValue("TEST3 STRING");
-        assertEquals(2, ctRun.sizeOfBrArray());
+        ctRun.addNewT().setStringValue("TEST STRING");
+        ctRun.addNewBr();
+        ctRun.addNewT().setStringValue("TEST2 STRING");
+        CTBr breac = ctRun.addNewBr();
+        breac.setClear(STBrClear.LEFT);
+        ctRun.addNewT().setStringValue("TEST3 STRING");
+        assertEquals(2, ctRun.sizeOfBrArray());
 
         XWPFRun run = new XWPFRun(CTR.Factory.newInstance(), p);
         run.setText("TEXT1");
@@ -222,144 +221,145 @@ public class TestXWPFRun extends TestCas
         run.addBreak(BreakType.TEXT_WRAPPING);
         assertEquals(2, run.getCTR().sizeOfBrArray());
     }
-
-    /**
-     * Test that on an existing document, we do the
-     *  right thing with it
-     * @throws IOException 
-     */
-    public void testExisting() throws IOException {
-       XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("TestDocument.docx");
-       XWPFParagraph p;
-       XWPFRun run;
-       
-       
-       // First paragraph is simple
-       p = doc.getParagraphArray(0);
-       assertEquals("This is a test document.", p.getText());
-       assertEquals(2, p.getRuns().size());
-       
-       run = p.getRuns().get(0);
-       assertEquals("This is a test document", run.toString());
-       assertEquals(false, run.isBold());
-       assertEquals(false, run.isItalic());
-       assertEquals(false, run.isStrike());
-       assertEquals(null, run.getCTR().getRPr());
-       
-       run = p.getRuns().get(1);
-       assertEquals(".", run.toString());
-       assertEquals(false, run.isBold());
-       assertEquals(false, run.isItalic());
-       assertEquals(false, run.isStrike());
-       assertEquals(null, run.getCTR().getRPr());
-       
-       
-       // Next paragraph is all in one style, but a different one
-       p = doc.getParagraphArray(1);
-       assertEquals("This bit is in bold and italic", p.getText());
-       assertEquals(1, p.getRuns().size());
-       
-       run = p.getRuns().get(0);
-       assertEquals("This bit is in bold and italic", run.toString());
-       assertEquals(true, run.isBold());
-       assertEquals(true, run.isItalic());
-       assertEquals(false, run.isStrike());
-       assertEquals(true, run.getCTR().getRPr().isSetB());
-       assertEquals(false, run.getCTR().getRPr().getB().isSetVal());
-       
-       
-       // Back to normal
-       p = doc.getParagraphArray(2);
-       assertEquals("Back to normal", p.getText());
-       assertEquals(1, p.getRuns().size());
-       
-       run = p.getRuns().get(0);
-       assertEquals("Back to normal", run.toString());
-       assertEquals(false, run.isBold());
-       assertEquals(false, run.isItalic());
-       assertEquals(false, run.isStrike());
-       assertEquals(null, run.getCTR().getRPr());
-       
-       
-       // Different styles in one paragraph
-       p = doc.getParagraphArray(3);
-       assertEquals("This contains BOLD, ITALIC and BOTH, as well as RED and YELLOW text.", p.getText());
-       assertEquals(11, p.getRuns().size());
-       
-       run = p.getRuns().get(0);
-       assertEquals("This contains ", run.toString());
-       assertEquals(false, run.isBold());
-       assertEquals(false, run.isItalic());
-       assertEquals(false, run.isStrike());
-       assertEquals(null, run.getCTR().getRPr());
-       
-       run = p.getRuns().get(1);
-       assertEquals("BOLD", run.toString());
-       assertEquals(true, run.isBold());
-       assertEquals(false, run.isItalic());
-       assertEquals(false, run.isStrike());
-       
-       run = p.getRuns().get(2);
-       assertEquals(", ", run.toString());
-       assertEquals(false, run.isBold());
-       assertEquals(false, run.isItalic());
-       assertEquals(false, run.isStrike());
-       assertEquals(null, run.getCTR().getRPr());
-       
-       run = p.getRuns().get(3);
-       assertEquals("ITALIC", run.toString());
-       assertEquals(false, run.isBold());
-       assertEquals(true, run.isItalic());
-       assertEquals(false, run.isStrike());
-       
-       run = p.getRuns().get(4);
-       assertEquals(" and ", run.toString());
-       assertEquals(false, run.isBold());
-       assertEquals(false, run.isItalic());
-       assertEquals(false, run.isStrike());
-       assertEquals(null, run.getCTR().getRPr());
-       
-       run = p.getRuns().get(5);
-       assertEquals("BOTH", run.toString());
-       assertEquals(true, run.isBold());
-       assertEquals(true, run.isItalic());
-       assertEquals(false, run.isStrike());
-       
-       run = p.getRuns().get(6);
-       assertEquals(", as well as ", run.toString());
-       assertEquals(false, run.isBold());
-       assertEquals(false, run.isItalic());
-       assertEquals(false, run.isStrike());
-       assertEquals(null, run.getCTR().getRPr());
-       
-       run = p.getRuns().get(7);
-       assertEquals("RED", run.toString());
-       assertEquals(false, run.isBold());
-       assertEquals(false, run.isItalic());
-       assertEquals(false, run.isStrike());
-       
-       run = p.getRuns().get(8);
-       assertEquals(" and ", run.toString());
-       assertEquals(false, run.isBold());
-       assertEquals(false, run.isItalic());
-       assertEquals(false, run.isStrike());
-       assertEquals(null, run.getCTR().getRPr());
-       
-       run = p.getRuns().get(9);
-       assertEquals("YELLOW", run.toString());
-       assertEquals(false, run.isBold());
-       assertEquals(false, run.isItalic());
-       assertEquals(false, run.isStrike());
-       
-       run = p.getRuns().get(10);
-       assertEquals(" text.", run.toString());
-       assertEquals(false, run.isBold());
-       assertEquals(false, run.isItalic());
-       assertEquals(false, run.isStrike());
-       assertEquals(null, run.getCTR().getRPr());
-    }
-
-    public void testPictureInHeader() throws IOException {
+
+    /**
+     * Test that on an existing document, we do the
+     * right thing with it
+     *
+     * @throws IOException
+     */
+    public void testExisting() throws IOException {
+        XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("TestDocument.docx");
+        XWPFParagraph p;
+        XWPFRun run;
+
+
+        // First paragraph is simple
+        p = doc.getParagraphArray(0);
+        assertEquals("This is a test document.", p.getText());
+        assertEquals(2, p.getRuns().size());
+
+        run = p.getRuns().get(0);
+        assertEquals("This is a test document", run.toString());
+        assertEquals(false, run.isBold());
+        assertEquals(false, run.isItalic());
+        assertEquals(false, run.isStrike());
+        assertEquals(null, run.getCTR().getRPr());
+
+        run = p.getRuns().get(1);
+        assertEquals(".", run.toString());
+        assertEquals(false, run.isBold());
+        assertEquals(false, run.isItalic());
+        assertEquals(false, run.isStrike());
+        assertEquals(null, run.getCTR().getRPr());
+
+
+        // Next paragraph is all in one style, but a different one
+        p = doc.getParagraphArray(1);
+        assertEquals("This bit is in bold and italic", p.getText());
+        assertEquals(1, p.getRuns().size());
+
+        run = p.getRuns().get(0);
+        assertEquals("This bit is in bold and italic", run.toString());
+        assertEquals(true, run.isBold());
+        assertEquals(true, run.isItalic());
+        assertEquals(false, run.isStrike());
+        assertEquals(true, run.getCTR().getRPr().isSetB());
+        assertEquals(false, run.getCTR().getRPr().getB().isSetVal());
+
+
+        // Back to normal
+        p = doc.getParagraphArray(2);
+        assertEquals("Back to normal", p.getText());
+        assertEquals(1, p.getRuns().size());
+
+        run = p.getRuns().get(0);
+        assertEquals("Back to normal", run.toString());
+        assertEquals(false, run.isBold());
+        assertEquals(false, run.isItalic());
+        assertEquals(false, run.isStrike());
+        assertEquals(null, run.getCTR().getRPr());
+
+
+        // Different styles in one paragraph
+        p = doc.getParagraphArray(3);
+        assertEquals("This contains BOLD, ITALIC and BOTH, as well as RED and YELLOW text.", p.getText());
+        assertEquals(11, p.getRuns().size());
+
+        run = p.getRuns().get(0);
+        assertEquals("This contains ", run.toString());
+        assertEquals(false, run.isBold());
+        assertEquals(false, run.isItalic());
+        assertEquals(false, run.isStrike());
+        assertEquals(null, run.getCTR().getRPr());
+
+        run = p.getRuns().get(1);
+        assertEquals("BOLD", run.toString());
+        assertEquals(true, run.isBold());
+        assertEquals(false, run.isItalic());
+        assertEquals(false, run.isStrike());
+
+        run = p.getRuns().get(2);
+        assertEquals(", ", run.toString());
+        assertEquals(false, run.isBold());
+        assertEquals(false, run.isItalic());
+        assertEquals(false, run.isStrike());
+        assertEquals(null, run.getCTR().getRPr());
+
+        run = p.getRuns().get(3);
+        assertEquals("ITALIC", run.toString());
+        assertEquals(false, run.isBold());
+        assertEquals(true, run.isItalic());
+        assertEquals(false, run.isStrike());
+
+        run = p.getRuns().get(4);
+        assertEquals(" and ", run.toString());
+        assertEquals(false, run.isBold());
+        assertEquals(false, run.isItalic());
+        assertEquals(false, run.isStrike());
+        assertEquals(null, run.getCTR().getRPr());
+
+        run = p.getRuns().get(5);
+        assertEquals("BOTH", run.toString());
+        assertEquals(true, run.isBold());
+        assertEquals(true, run.isItalic());
+        assertEquals(false, run.isStrike());
+
+        run = p.getRuns().get(6);
+        assertEquals(", as well as ", run.toString());
+        assertEquals(false, run.isBold());
+        assertEquals(false, run.isItalic());
+        assertEquals(false, run.isStrike());
+        assertEquals(null, run.getCTR().getRPr());
+
+        run = p.getRuns().get(7);
+        assertEquals("RED", run.toString());
+        assertEquals(false, run.isBold());
+        assertEquals(false, run.isItalic());
+        assertEquals(false, run.isStrike());
+
+        run = p.getRuns().get(8);
+        assertEquals(" and ", run.toString());
+        assertEquals(false, run.isBold());
+        assertEquals(false, run.isItalic());
+        assertEquals(false, run.isStrike());
+        assertEquals(null, run.getCTR().getRPr());
+
+        run = p.getRuns().get(9);
+        assertEquals("YELLOW", run.toString());
+        assertEquals(false, run.isBold());
+        assertEquals(false, run.isItalic());
+        assertEquals(false, run.isStrike());
+
+        run = p.getRuns().get(10);
+        assertEquals(" text.", run.toString());
+        assertEquals(false, run.isBold());
+        assertEquals(false, run.isItalic());
+        assertEquals(false, run.isStrike());
+        assertEquals(null, run.getCTR().getRPr());
+    }
+
+    public void testPictureInHeader() throws IOException {
         XWPFDocument sampleDoc = XWPFTestDataSamples.openSampleDocument("headerPic.docx");
         XWPFHeaderFooterPolicy policy = sampleDoc.getHeaderFooterPolicy();
 
@@ -373,47 +373,47 @@ public class TestXWPFRun extends TestCas
 
                 for (XWPFPicture pic : pictures) {
                     assertNotNull(pic.getPictureData());
-                    assertEquals("DOZOR", pic.getDescription());
-                }
-
-                count+= pictures.size();
-            }
-        }
-
-        assertEquals(1, count);
-    }
-    
-    public void testAddPicture() throws Exception {
-       XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("TestDocument.docx");
-       XWPFParagraph p = doc.getParagraphArray(2);
-       XWPFRun r = p.getRuns().get(0);
-       
-       assertEquals(0, doc.getAllPictures().size());
-       assertEquals(0, r.getEmbeddedPictures().size());
-       
-       r.addPicture(new ByteArrayInputStream(new byte[0]), Document.PICTURE_TYPE_JPEG, "test.jpg", 21, 32);
-       
-       assertEquals(1, doc.getAllPictures().size());
-       assertEquals(1, r.getEmbeddedPictures().size());
-    }
-    
-    /**
-     * Bugzilla #52288 - setting the font family on the
-     *  run mustn't NPE
-     */
-    public void testSetFontFamily_52288() throws Exception {
-       XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("52288.docx");
-       final Iterator<XWPFParagraph> paragraphs = doc.getParagraphsIterator();
-       while (paragraphs.hasNext()) {
-          final XWPFParagraph paragraph = paragraphs.next();
-          for (final XWPFRun run : paragraph.getRuns()) {
-             if (run != null) {
-                final String text = run.getText(0);
-                if (text != null) {
-                   run.setFontFamily("Times New Roman");
-                }
-             }
-          }
-       }
-    }
-}
+                    assertEquals("DOZOR", pic.getDescription());
+                }
+
+                count += pictures.size();
+            }
+        }
+
+        assertEquals(1, count);
+    }
+
+    public void testAddPicture() throws Exception {
+        XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("TestDocument.docx");
+        XWPFParagraph p = doc.getParagraphArray(2);
+        XWPFRun r = p.getRuns().get(0);
+
+        assertEquals(0, doc.getAllPictures().size());
+        assertEquals(0, r.getEmbeddedPictures().size());
+
+        r.addPicture(new ByteArrayInputStream(new byte[0]), Document.PICTURE_TYPE_JPEG, "test.jpg", 21, 32);
+
+        assertEquals(1, doc.getAllPictures().size());
+        assertEquals(1, r.getEmbeddedPictures().size());
+    }
+
+    /**
+     * Bugzilla #52288 - setting the font family on the
+     * run mustn't NPE
+     */
+    public void testSetFontFamily_52288() throws Exception {
+        XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("52288.docx");
+        final Iterator<XWPFParagraph> paragraphs = doc.getParagraphsIterator();
+        while (paragraphs.hasNext()) {
+            final XWPFParagraph paragraph = paragraphs.next();
+            for (final XWPFRun run : paragraph.getRuns()) {
+                if (run != null) {
+                    final String text = run.getText(0);
+                    if (text != null) {
+                        run.setFontFamily("Times New Roman");
+                    }
+                }
+            }
+        }
+    }
+}

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java?rev=1682473&r1=1682472&r2=1682473&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSDT.java Fri May 29 14:01:31 2015
@@ -15,48 +15,46 @@
    limitations under the License.
 ==================================================================== */
 
-package org.apache.poi.xwpf.usermodel;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import junit.framework.TestCase;
-
-import org.apache.poi.xwpf.XWPFTestDataSamples;
-
-public final class TestXWPFSDT extends TestCase {
-
-    /**
-     * Test simple tag and title extraction from SDT
-     * @throws Exception
-     */
-    public void testTagTitle() throws Exception {
-        XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("Bug54849.docx");
-        String tag = null;
-        String title= null;
-        List<AbstractXWPFSDT> sdts = extractAllSDTs(doc);
-        for (AbstractXWPFSDT sdt :sdts){
-            if (sdt.getContent().toString().equals("Rich_text")){
-                tag = "MyTag";
-                title = "MyTitle";
-                break;
-            }
-            
-        }
-        assertEquals("controls size", 13, sdts.size());
-
+package org.apache.poi.xwpf.usermodel;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestCase;
+import org.apache.poi.xwpf.XWPFTestDataSamples;
+
+public final class TestXWPFSDT extends TestCase {
+
+    /**
+     * Test simple tag and title extraction from SDT
+     *
+     * @throws Exception
+     */
+    public void testTagTitle() throws Exception {
+        XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("Bug54849.docx");
+        String tag = null;
+        String title = null;
+        List<AbstractXWPFSDT> sdts = extractAllSDTs(doc);
+        for (AbstractXWPFSDT sdt : sdts) {
+            if (sdt.getContent().toString().equals("Rich_text")) {
+                tag = "MyTag";
+                title = "MyTitle";
+                break;
+            }
+
+        }
+        assertEquals("controls size", 13, sdts.size());
+
         assertEquals("tag", "MyTag", tag);
         assertEquals("title", "MyTitle", title);
-    }
-
-
-    public void testGetSDTs() throws Exception{
-        String[] contents = new String[]{
-                "header_rich_text",
-                "Rich_text",
+    }
+
+
+    public void testGetSDTs() throws Exception {
+        String[] contents = new String[]{
+                "header_rich_text",
+                "Rich_text",
                 "Rich_text_pre_table\nRich_text_cell1\t\t\t\n\t\t\t\n\t\t\t\n\nRich_text_post_table",
                 "Plain_text_no_newlines",
                 "Plain_text_with_newlines1\nplain_text_with_newlines2",
@@ -72,125 +70,126 @@ public final class TestXWPFSDT extends T
         };
         XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("Bug54849.docx");
         List<AbstractXWPFSDT> sdts = extractAllSDTs(doc);
-
-        assertEquals("number of sdts", contents.length, sdts.size());
-
-        for (int i = 0; i < contents.length; i++){
-            AbstractXWPFSDT sdt = sdts.get(i);
-            assertEquals(i+ ": " + contents[i], contents[i], sdt.getContent().toString());
-        } 
-    }
-    /**
-     * POI-54771 and TIKA-1317
-     */
+
+        assertEquals("number of sdts", contents.length, sdts.size());
+
+        for (int i = 0; i < contents.length; i++) {
+            AbstractXWPFSDT sdt = sdts.get(i);
+            assertEquals(i + ": " + contents[i], contents[i], sdt.getContent().toString());
+        }
+    }
+
+    /**
+     * POI-54771 and TIKA-1317
+     */
     public void testSDTAsCell() throws Exception {
         //Bug54771a.docx and Bug54771b.docx test slightly 
         //different recursion patterns. Keep both!
-        XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("Bug54771a.docx");
-        List<AbstractXWPFSDT> sdts = extractAllSDTs(doc);
-        String text = sdts.get(0).getContent().getText();
-        assertEquals(2, sdts.size()); 
-        assertTrue(text.indexOf("Test") > -1);
-
-        text = sdts.get(1).getContent().getText();
+        XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("Bug54771a.docx");
+        List<AbstractXWPFSDT> sdts = extractAllSDTs(doc);
+        String text = sdts.get(0).getContent().getText();
+        assertEquals(2, sdts.size());
+        assertTrue(text.indexOf("Test") > -1);
+
+        text = sdts.get(1).getContent().getText();
         assertTrue(text.indexOf("Test Subtitle") > -1);
         assertTrue(text.indexOf("Test User") > -1);
         assertTrue(text.indexOf("Test") < text.indexOf("Test Subtitle"));
-
-        doc = XWPFTestDataSamples.openSampleDocument("Bug54771b.docx");
-        sdts = extractAllSDTs(doc);
-        assertEquals(3, sdts.size()); 
-        assertTrue(sdts.get(0).getContent().getText().indexOf("Test") > -1);
-
-        assertTrue(sdts.get(1).getContent().getText().indexOf("Test Subtitle") > -1);
-        assertTrue(sdts.get(2).getContent().getText().indexOf("Test User") > -1);
-
-    }
-    
-    /**
-     * POI-55142 and Tika 1130
-     */
-    public void testNewLinesBetweenRuns() throws Exception{
-       XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("Bug55142.docx");
-       List<AbstractXWPFSDT> sdts = extractAllSDTs(doc);
-       List<String> targs = new ArrayList<String>();
-       //these test newlines and tabs in paragraphs/body elements
-       targs.add("Rich-text1 abcdefghi");
-       targs.add("Rich-text2 abcd\t\tefgh");
-       targs.add("Rich-text3 abcd\nefg");
-       targs.add("Rich-text4 abcdefg");
-       targs.add("Rich-text5 abcdefg\nhijk");
-       targs.add("Plain-text1 abcdefg");
-       targs.add("Plain-text2 abcdefg\nhijk\nlmnop");
-       //this tests consecutive runs within a cell (not a paragraph)
-       //this test case was triggered by Tika-1130
-       targs.add("sdt_incell2 abcdefg");
-       
-       for (int i = 0; i < sdts.size(); i++){
-          AbstractXWPFSDT sdt = sdts.get(i);
-          assertEquals(targs.get(i), targs.get(i), sdt.getContent().getText());
-       }
-    }
-
-    private List<AbstractXWPFSDT> extractAllSDTs(XWPFDocument doc){
-        
-        List<AbstractXWPFSDT> sdts = new ArrayList<AbstractXWPFSDT>();
-
-        List<XWPFHeader> headers = doc.getHeaderList();
-        for (XWPFHeader header : headers){
-            sdts.addAll(extractSDTsFromBodyElements(header.getBodyElements()));
-        }
-        sdts.addAll(extractSDTsFromBodyElements(doc.getBodyElements()));
-
-        List<XWPFFooter> footers = doc.getFooterList();
-        for (XWPFFooter footer : footers){
-            sdts.addAll(extractSDTsFromBodyElements(footer.getBodyElements()));
-        }
-
-        for (XWPFFootnote footnote : doc.getFootnotes()){
-            sdts.addAll(extractSDTsFromBodyElements(footnote.getBodyElements()));
-        }
-        for (Map.Entry<Integer, XWPFFootnote> e : doc.endnotes.entrySet()){
-            sdts.addAll(extractSDTsFromBodyElements(e.getValue().getBodyElements()));
-        }
-        return sdts;
-    }
-
-    private List<AbstractXWPFSDT> extractSDTsFromBodyElements(List<IBodyElement> elements){
-        List<AbstractXWPFSDT> sdts = new ArrayList<AbstractXWPFSDT>();
-        for (IBodyElement e : elements){
-            if (e instanceof XWPFSDT){
-                XWPFSDT sdt = (XWPFSDT)e;
-                sdts.add(sdt);
-            } else if (e instanceof XWPFParagraph){
-
-                XWPFParagraph p = (XWPFParagraph)e;
-                for (IRunElement e2 : p.getIRuns()){
-                    if (e2 instanceof XWPFSDT){
-                        XWPFSDT sdt = (XWPFSDT)e2;
-                        sdts.add(sdt);
-                    }
-                }
-            } else if (e instanceof XWPFTable){
-                XWPFTable table = (XWPFTable)e;
-                sdts.addAll(extractSDTsFromTable(table));
-            }
-        }
+
+        doc = XWPFTestDataSamples.openSampleDocument("Bug54771b.docx");
+        sdts = extractAllSDTs(doc);
+        assertEquals(3, sdts.size());
+        assertTrue(sdts.get(0).getContent().getText().indexOf("Test") > -1);
+
+        assertTrue(sdts.get(1).getContent().getText().indexOf("Test Subtitle") > -1);
+        assertTrue(sdts.get(2).getContent().getText().indexOf("Test User") > -1);
+
+    }
+
+    /**
+     * POI-55142 and Tika 1130
+     */
+    public void testNewLinesBetweenRuns() throws Exception {
+        XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("Bug55142.docx");
+        List<AbstractXWPFSDT> sdts = extractAllSDTs(doc);
+        List<String> targs = new ArrayList<String>();
+        //these test newlines and tabs in paragraphs/body elements
+        targs.add("Rich-text1 abcdefghi");
+        targs.add("Rich-text2 abcd\t\tefgh");
+        targs.add("Rich-text3 abcd\nefg");
+        targs.add("Rich-text4 abcdefg");
+        targs.add("Rich-text5 abcdefg\nhijk");
+        targs.add("Plain-text1 abcdefg");
+        targs.add("Plain-text2 abcdefg\nhijk\nlmnop");
+        //this tests consecutive runs within a cell (not a paragraph)
+        //this test case was triggered by Tika-1130
+        targs.add("sdt_incell2 abcdefg");
+
+        for (int i = 0; i < sdts.size(); i++) {
+            AbstractXWPFSDT sdt = sdts.get(i);
+            assertEquals(targs.get(i), targs.get(i), sdt.getContent().getText());
+        }
+    }
+
+    private List<AbstractXWPFSDT> extractAllSDTs(XWPFDocument doc) {
+
+        List<AbstractXWPFSDT> sdts = new ArrayList<AbstractXWPFSDT>();
+
+        List<XWPFHeader> headers = doc.getHeaderList();
+        for (XWPFHeader header : headers) {
+            sdts.addAll(extractSDTsFromBodyElements(header.getBodyElements()));
+        }
+        sdts.addAll(extractSDTsFromBodyElements(doc.getBodyElements()));
+
+        List<XWPFFooter> footers = doc.getFooterList();
+        for (XWPFFooter footer : footers) {
+            sdts.addAll(extractSDTsFromBodyElements(footer.getBodyElements()));
+        }
+
+        for (XWPFFootnote footnote : doc.getFootnotes()) {
+            sdts.addAll(extractSDTsFromBodyElements(footnote.getBodyElements()));
+        }
+        for (Map.Entry<Integer, XWPFFootnote> e : doc.endnotes.entrySet()) {
+            sdts.addAll(extractSDTsFromBodyElements(e.getValue().getBodyElements()));
+        }
+        return sdts;
+    }
+
+    private List<AbstractXWPFSDT> extractSDTsFromBodyElements(List<IBodyElement> elements) {
+        List<AbstractXWPFSDT> sdts = new ArrayList<AbstractXWPFSDT>();
+        for (IBodyElement e : elements) {
+            if (e instanceof XWPFSDT) {
+                XWPFSDT sdt = (XWPFSDT) e;
+                sdts.add(sdt);
+            } else if (e instanceof XWPFParagraph) {
+
+                XWPFParagraph p = (XWPFParagraph) e;
+                for (IRunElement e2 : p.getIRuns()) {
+                    if (e2 instanceof XWPFSDT) {
+                        XWPFSDT sdt = (XWPFSDT) e2;
+                        sdts.add(sdt);
+                    }
+                }
+            } else if (e instanceof XWPFTable) {
+                XWPFTable table = (XWPFTable) e;
+                sdts.addAll(extractSDTsFromTable(table));
+            }
+        }
         return sdts;
     }
 
     private List<AbstractXWPFSDT> extractSDTsFromTable(XWPFTable table) {
 
         List<AbstractXWPFSDT> sdts = new ArrayList<AbstractXWPFSDT>();
-        for (XWPFTableRow r : table.getRows()) {
-            for (ICell c : r.getTableICells()) {
-                if (c instanceof XWPFSDTCell) {
-                    sdts.add((XWPFSDTCell)c);
-                } else if (c instanceof XWPFTableCell) {
-                    sdts.addAll(extractSDTsFromBodyElements(((XWPFTableCell)c).getBodyElements()));
-                }
-            }
-        }
+        for (XWPFTableRow r : table.getRows()) {
+            for (ICell c : r.getTableICells()) {
+                if (c instanceof XWPFSDTCell) {
+                    sdts.add((XWPFSDTCell) c);
+                } else if (c instanceof XWPFTableCell) {
+                    sdts.addAll(extractSDTsFromBodyElements(((XWPFTableCell) c).getBodyElements()));
+                }
+            }
+        }
         return sdts;
     }
 }

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSmartTag.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSmartTag.java?rev=1682473&r1=1682472&r2=1682473&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSmartTag.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFSmartTag.java Fri May 29 14:01:31 2015
@@ -19,13 +19,12 @@ package org.apache.poi.xwpf.usermodel;
 import java.io.IOException;
 
 import junit.framework.TestCase;
-
 import org.apache.poi.xwpf.XWPFTestDataSamples;
 
 /**
  * Tests for reading SmartTags from Word docx.
  *
- * @author  Fabian Lange
+ * @author Fabian Lange
  */
 public final class TestXWPFSmartTag extends TestCase {
 

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFStyles.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFStyles.java?rev=1682473&r1=1682472&r2=1682473&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFStyles.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFStyles.java Fri May 29 14:01:31 2015
@@ -19,13 +19,12 @@ package org.apache.poi.xwpf.usermodel;
 
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.apache.poi.xwpf.XWPFTestDataSamples;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFonts;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTLatentStyles;
+import java.util.List;
+
+import junit.framework.TestCase;
+import org.apache.poi.xwpf.XWPFTestDataSamples;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFonts;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTLatentStyles;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTLsdException;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTStyle;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTStyles;
@@ -33,69 +32,69 @@ import org.openxmlformats.schemas.wordpr
 
 public class TestXWPFStyles extends TestCase {
 
-//	protected void setUp() throws Exception {
-//		super.setUp();
-//	}
-	
-	public void testGetUsedStyles() throws IOException{
-		XWPFDocument sampleDoc = XWPFTestDataSamples.openSampleDocument("Styles.docx");
-		List<XWPFStyle> testUsedStyleList = new ArrayList<XWPFStyle>();
-		XWPFStyles styles = sampleDoc.getStyles();
-		XWPFStyle style = styles.getStyle("berschrift1");
-		testUsedStyleList.add(style);
-		testUsedStyleList.add(styles.getStyle("Standard"));
-		testUsedStyleList.add(styles.getStyle("berschrift1Zchn"));
-		testUsedStyleList.add(styles.getStyle("Absatz-Standardschriftart"));
-		style.hasSameName(style);
-		
-		List<XWPFStyle> usedStyleList = styles.getUsedStyleList(style);
-		assertEquals(usedStyleList, testUsedStyleList);
-		
-		
-	}
-
-	public void testAddStylesToDocument() throws IOException{
-		XWPFDocument docOut = new XWPFDocument();
-		XWPFStyles styles = docOut.createStyles();
-
-		String strStyleId = "headline1";
-		CTStyle ctStyle = CTStyle.Factory.newInstance();
-
-		ctStyle.setStyleId(strStyleId);
-		XWPFStyle s = new XWPFStyle(ctStyle);
-		styles.addStyle(s);
-		
-		assertTrue(styles.styleExist(strStyleId));
-
-    	XWPFDocument docIn = XWPFTestDataSamples.writeOutAndReadBack(docOut);
-
-		styles = docIn.getStyles();
-		assertTrue(styles.styleExist(strStyleId));
-	}
-
-	/**
-	 * Bug #52449 - We should be able to write a file containing
-	 *  both regular and glossary styles without error
-	 */
-	public void test52449() throws Exception {
-      XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("52449.docx");
-      XWPFStyles styles = doc.getStyles();
-      assertNotNull(styles);
-      
-      XWPFDocument docIn = XWPFTestDataSamples.writeOutAndReadBack(doc);
-      styles = docIn.getStyles();
-      assertNotNull(styles);
-	}
-
-
-    /**
-     * YK: tests below don't make much sense,
-     * they exist only to copy xml beans to pi-ooxml-schemas.jar
-     */
-    public void testLanguages(){
-        XWPFDocument docOut = new XWPFDocument();
-        XWPFStyles styles = docOut.createStyles();
-        styles.setEastAsia("Chinese");
+//	protected void setUp() throws Exception {
+//		super.setUp();
+//	}
+
+    public void testGetUsedStyles() throws IOException {
+        XWPFDocument sampleDoc = XWPFTestDataSamples.openSampleDocument("Styles.docx");
+        List<XWPFStyle> testUsedStyleList = new ArrayList<XWPFStyle>();
+        XWPFStyles styles = sampleDoc.getStyles();
+        XWPFStyle style = styles.getStyle("berschrift1");
+        testUsedStyleList.add(style);
+        testUsedStyleList.add(styles.getStyle("Standard"));
+        testUsedStyleList.add(styles.getStyle("berschrift1Zchn"));
+        testUsedStyleList.add(styles.getStyle("Absatz-Standardschriftart"));
+        style.hasSameName(style);
+
+        List<XWPFStyle> usedStyleList = styles.getUsedStyleList(style);
+        assertEquals(usedStyleList, testUsedStyleList);
+
+
+    }
+
+    public void testAddStylesToDocument() throws IOException {
+        XWPFDocument docOut = new XWPFDocument();
+        XWPFStyles styles = docOut.createStyles();
+
+        String strStyleId = "headline1";
+        CTStyle ctStyle = CTStyle.Factory.newInstance();
+
+        ctStyle.setStyleId(strStyleId);
+        XWPFStyle s = new XWPFStyle(ctStyle);
+        styles.addStyle(s);
+
+        assertTrue(styles.styleExist(strStyleId));
+
+        XWPFDocument docIn = XWPFTestDataSamples.writeOutAndReadBack(docOut);
+
+        styles = docIn.getStyles();
+        assertTrue(styles.styleExist(strStyleId));
+    }
+
+    /**
+     * Bug #52449 - We should be able to write a file containing
+     * both regular and glossary styles without error
+     */
+    public void test52449() throws Exception {
+        XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("52449.docx");
+        XWPFStyles styles = doc.getStyles();
+        assertNotNull(styles);
+
+        XWPFDocument docIn = XWPFTestDataSamples.writeOutAndReadBack(doc);
+        styles = docIn.getStyles();
+        assertNotNull(styles);
+    }
+
+
+    /**
+     * YK: tests below don't make much sense,
+     * they exist only to copy xml beans to pi-ooxml-schemas.jar
+     */
+    public void testLanguages() {
+        XWPFDocument docOut = new XWPFDocument();
+        XWPFStyles styles = docOut.createStyles();
+        styles.setEastAsia("Chinese");
 
         styles.setSpellingLanguage("English");
 
@@ -116,82 +115,82 @@ public class TestXWPFStyles extends Test
         CTLsdException ex = latentStyles.addNewLsdException();
         ex.setName("ex1");
         XWPFLatentStyles ls = new XWPFLatentStyles(latentStyles);
-        assertEquals(true, ls.isLatentStyle("ex1"));
-        assertEquals(false, ls.isLatentStyle("notex1"));
-    }
-    
-    public void testSetStyles_Bug57254() throws IOException {
-        XWPFDocument docOut = new XWPFDocument();
-        XWPFStyles styles = docOut.createStyles();
+        assertEquals(true, ls.isLatentStyle("ex1"));
+        assertEquals(false, ls.isLatentStyle("notex1"));
+    }
+
+    public void testSetStyles_Bug57254() throws IOException {
+        XWPFDocument docOut = new XWPFDocument();
+        XWPFStyles styles = docOut.createStyles();
 
         CTStyles ctStyles = CTStyles.Factory.newInstance();
         String strStyleId = "headline1";
         CTStyle ctStyle = ctStyles.addNewStyle();
-
-        ctStyle.setStyleId(strStyleId);
-        styles.setStyles(ctStyles);
-        
-        assertTrue(styles.styleExist(strStyleId));
-
-        XWPFDocument docIn = XWPFTestDataSamples.writeOutAndReadBack(docOut);
-
-        styles = docIn.getStyles();
-        assertTrue(styles.styleExist(strStyleId));
-    }
-    
-    public void testEasyAccessToStyles() throws IOException {
-        XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("SampleDoc.docx");
-        XWPFStyles styles = doc.getStyles();
-        assertNotNull(styles);
-        
-        // Has 3 paragraphs on page one, a break, and 3 on page 2
-        assertEquals(7, doc.getParagraphs().size());
-        
-        // Check the first three have no run styles, just default paragraph style
-        for (int i=0; i<3; i++) {
-            XWPFParagraph p = doc.getParagraphs().get(i);
-            assertEquals(null, p.getStyle());
-            assertEquals(null, p.getStyleID());
-            assertEquals(1, p.getRuns().size());
-            
-            XWPFRun r = p.getRuns().get(0);
-            assertEquals(null, r.getColor());
-            assertEquals(null, r.getFontFamily());
-            assertEquals(null, r.getFontName());
-            assertEquals(-1, r.getFontSize());
-        }
-        
-        // On page two, has explicit styles, but on runs not on
-        //  the paragraph itself
-        for (int i=4; i<7; i++) {
-            XWPFParagraph p = doc.getParagraphs().get(i);
-            assertEquals(null, p.getStyle());
-            assertEquals(null, p.getStyleID());
-            assertEquals(1, p.getRuns().size());
-            
-            XWPFRun r = p.getRuns().get(0);
-            assertEquals("Arial Black", r.getFontFamily());
-            assertEquals("Arial Black", r.getFontName());
-            assertEquals(16, r.getFontSize());
-            assertEquals("548DD4", r.getColor());
-        }
-        
-        // Check the document styles
-        // Should have a style defined for each type
-        assertEquals(4, styles.getNumberOfStyles());
+
+        ctStyle.setStyleId(strStyleId);
+        styles.setStyles(ctStyles);
+
+        assertTrue(styles.styleExist(strStyleId));
+
+        XWPFDocument docIn = XWPFTestDataSamples.writeOutAndReadBack(docOut);
+
+        styles = docIn.getStyles();
+        assertTrue(styles.styleExist(strStyleId));
+    }
+
+    public void testEasyAccessToStyles() throws IOException {
+        XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("SampleDoc.docx");
+        XWPFStyles styles = doc.getStyles();
+        assertNotNull(styles);
+
+        // Has 3 paragraphs on page one, a break, and 3 on page 2
+        assertEquals(7, doc.getParagraphs().size());
+
+        // Check the first three have no run styles, just default paragraph style
+        for (int i = 0; i < 3; i++) {
+            XWPFParagraph p = doc.getParagraphs().get(i);
+            assertEquals(null, p.getStyle());
+            assertEquals(null, p.getStyleID());
+            assertEquals(1, p.getRuns().size());
+
+            XWPFRun r = p.getRuns().get(0);
+            assertEquals(null, r.getColor());
+            assertEquals(null, r.getFontFamily());
+            assertEquals(null, r.getFontName());
+            assertEquals(-1, r.getFontSize());
+        }
+
+        // On page two, has explicit styles, but on runs not on
+        //  the paragraph itself
+        for (int i = 4; i < 7; i++) {
+            XWPFParagraph p = doc.getParagraphs().get(i);
+            assertEquals(null, p.getStyle());
+            assertEquals(null, p.getStyleID());
+            assertEquals(1, p.getRuns().size());
+
+            XWPFRun r = p.getRuns().get(0);
+            assertEquals("Arial Black", r.getFontFamily());
+            assertEquals("Arial Black", r.getFontName());
+            assertEquals(16, r.getFontSize());
+            assertEquals("548DD4", r.getColor());
+        }
+
+        // Check the document styles
+        // Should have a style defined for each type
+        assertEquals(4, styles.getNumberOfStyles());
         assertNotNull(styles.getStyle("Normal"));
-        assertNotNull(styles.getStyle("DefaultParagraphFont"));
-        assertNotNull(styles.getStyle("TableNormal"));
-        assertNotNull(styles.getStyle("NoList"));
-        
-        // We can't do much yet with latent styles
-        assertEquals(137, styles.getLatentStyles().getNumberOfStyles());
-        
-        // Check the default styles
-        assertNotNull(styles.getDefaultRunStyle());
-        assertNotNull(styles.getDefaultParagraphStyle());
-        
-        assertEquals(11, styles.getDefaultRunStyle().getFontSize());
-        assertEquals(200, styles.getDefaultParagraphStyle().getSpacingAfter());
-    }
+        assertNotNull(styles.getStyle("DefaultParagraphFont"));
+        assertNotNull(styles.getStyle("TableNormal"));
+        assertNotNull(styles.getStyle("NoList"));
+
+        // We can't do much yet with latent styles
+        assertEquals(137, styles.getLatentStyles().getNumberOfStyles());
+
+        // Check the default styles
+        assertNotNull(styles.getDefaultRunStyle());
+        assertNotNull(styles.getDefaultParagraphStyle());
+
+        assertEquals(11, styles.getDefaultRunStyle().getFontSize());
+        assertEquals(200, styles.getDefaultParagraphStyle().getSpacingAfter());
+    }
 }

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTable.java?rev=1682473&r1=1682472&r2=1682473&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTable.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTable.java Fri May 29 14:01:31 2015
@@ -17,13 +17,12 @@
 package org.apache.poi.xwpf.usermodel;
 
 import java.math.BigInteger;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.apache.poi.xwpf.XWPFTestDataSamples;
-import org.apache.poi.xwpf.usermodel.XWPFTable.XWPFBorderType;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP;
+import java.util.List;
+
+import junit.framework.TestCase;
+import org.apache.poi.xwpf.XWPFTestDataSamples;
+import org.apache.poi.xwpf.usermodel.XWPFTable.XWPFBorderType;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRow;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl;
@@ -122,13 +121,13 @@ public class TestXWPFTable extends TestC
         assertEquals(1, xtab.getCTTbl().getTrArray(0).sizeOfTcArray());
     }
 
-
-    public void testSetGetWidth() {
-        XWPFDocument doc = new XWPFDocument();
-        
-        CTTbl table = CTTbl.Factory.newInstance();
-        table.addNewTblPr().addNewTblW().setW(new BigInteger("1000"));
-
+
+    public void testSetGetWidth() {
+        XWPFDocument doc = new XWPFDocument();
+
+        CTTbl table = CTTbl.Factory.newInstance();
+        table.addNewTblPr().addNewTblW().setW(new BigInteger("1000"));
+
         XWPFTable xtab = new XWPFTable(table, doc);
 
         assertEquals(1000, xtab.getWidth());
@@ -146,20 +145,20 @@ public class TestXWPFTable extends TestC
         XWPFTableRow row = xtab.createRow();
         row.setHeight(20);
         assertEquals(20, row.getHeight());
-    }
-
-    public void testSetGetMargins() {
-    	// instantiate the following class so it'll get picked up by
-    	// the XmlBean process and added to the jar file. it's required
-    	// for the following XWPFTable methods.
-    	CTTblCellMar ctm = CTTblCellMar.Factory.newInstance();
-    	assertNotNull(ctm);
-    	// create a table
-        XWPFDocument doc = new XWPFDocument();
-    	CTTbl ctTable = CTTbl.Factory.newInstance();
-        XWPFTable table = new XWPFTable(ctTable, doc);
-        // set margins
-        table.setCellMargins(50, 50, 250, 450);
+    }
+
+    public void testSetGetMargins() {
+        // instantiate the following class so it'll get picked up by
+        // the XmlBean process and added to the jar file. it's required
+        // for the following XWPFTable methods.
+        CTTblCellMar ctm = CTTblCellMar.Factory.newInstance();
+        assertNotNull(ctm);
+        // create a table
+        XWPFDocument doc = new XWPFDocument();
+        CTTbl ctTable = CTTbl.Factory.newInstance();
+        XWPFTable table = new XWPFTable(ctTable, doc);
+        // set margins
+        table.setCellMargins(50, 50, 250, 450);
         // get margin components
         int t = table.getCellMarginTop();
         assertEquals(50, t);
@@ -169,22 +168,22 @@ public class TestXWPFTable extends TestC
         assertEquals(250, b);
         int r = table.getCellMarginRight();
         assertEquals(450, r);
-    }
-
-    public void testSetGetHBorders() {
-    	// instantiate the following classes so they'll get picked up by
-    	// the XmlBean process and added to the jar file. they are required
-    	// for the following XWPFTable methods.
-    	CTTblBorders cttb = CTTblBorders.Factory.newInstance();
-    	assertNotNull(cttb);
-    	STBorder stb = STBorder.Factory.newInstance();
-    	assertNotNull(stb);
-    	// create a table
-        XWPFDocument doc = new XWPFDocument();
-    	CTTbl ctTable = CTTbl.Factory.newInstance();
-        XWPFTable table = new XWPFTable(ctTable, doc);
-        // set inside horizontal border
-        table.setInsideHBorder(XWPFBorderType.SINGLE, 4, 0, "FF0000");
+    }
+
+    public void testSetGetHBorders() {
+        // instantiate the following classes so they'll get picked up by
+        // the XmlBean process and added to the jar file. they are required
+        // for the following XWPFTable methods.
+        CTTblBorders cttb = CTTblBorders.Factory.newInstance();
+        assertNotNull(cttb);
+        STBorder stb = STBorder.Factory.newInstance();
+        assertNotNull(stb);
+        // create a table
+        XWPFDocument doc = new XWPFDocument();
+        CTTbl ctTable = CTTbl.Factory.newInstance();
+        XWPFTable table = new XWPFTable(ctTable, doc);
+        // set inside horizontal border
+        table.setInsideHBorder(XWPFBorderType.SINGLE, 4, 0, "FF0000");
         // get inside horizontal border components
         int s = table.getInsideHBorderSize();
         assertEquals(4, s);
@@ -194,26 +193,26 @@ public class TestXWPFTable extends TestC
         assertEquals("FF0000", clr);
         XWPFBorderType bt = table.getInsideHBorderType();
         assertEquals(XWPFBorderType.SINGLE, bt);
-    }
-
-    public void testSetGetVBorders() {
-    	// create a table
-        XWPFDocument doc = new XWPFDocument();
-        CTTbl ctTable = CTTbl.Factory.newInstance();
-        XWPFTable table = new XWPFTable(ctTable, doc);
+    }
+
+    public void testSetGetVBorders() {
+        // create a table
+        XWPFDocument doc = new XWPFDocument();
+        CTTbl ctTable = CTTbl.Factory.newInstance();
+        XWPFTable table = new XWPFTable(ctTable, doc);
         // set inside vertical border
         table.setInsideVBorder(XWPFBorderType.DOUBLE, 4, 0, "00FF00");
         // get inside vertical border components
         XWPFBorderType bt = table.getInsideVBorderType();
         assertEquals(XWPFBorderType.DOUBLE, bt);
         int sz = table.getInsideVBorderSize();
-        assertEquals(4, sz);
-        int sp = table.getInsideVBorderSpace();
-        assertEquals(0, sp);
-        String clr =  table.getInsideVBorderColor();
-        assertEquals("00FF00", clr);
-    }
-
+        assertEquals(4, sz);
+        int sp = table.getInsideVBorderSpace();
+        assertEquals(0, sp);
+        String clr = table.getInsideVBorderColor();
+        assertEquals("00FF00", clr);
+    }
+
     public void testSetGetRowBandSize() {
         XWPFDocument doc = new XWPFDocument();
         CTTbl ctTable = CTTbl.Factory.newInstance();
@@ -230,32 +229,30 @@ public class TestXWPFTable extends TestC
         table.setColBandSize(16);
         int sz = table.getColBandSize();
         assertEquals(16, sz);
-    }
-
-    public void testCreateTable() throws Exception {
-       // open an empty document
-       XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("sample.docx");
-
-       // create a table with 5 rows and 7 columns
-       int noRows = 5; 
-       int noCols = 7;
-       XWPFTable table = doc.createTable(noRows,noCols);
-
-       // assert the table is empty
-       List<XWPFTableRow> rows = table.getRows();
-       assertEquals("Table has less rows than requested.", noRows, rows.size());
-       for (XWPFTableRow xwpfRow : rows)
-       {
-          assertNotNull(xwpfRow);
-          for (int i = 0 ; i < 7 ; i++)
-          {
-             XWPFTableCell xwpfCell = xwpfRow.getCell(i);
-             assertNotNull(xwpfCell);
-             assertEquals("Empty cells should not have one paragraph.",1,xwpfCell.getParagraphs().size());
-             xwpfCell = xwpfRow.getCell(i);
-             assertEquals("Calling 'getCell' must not modify cells content.",1,xwpfCell.getParagraphs().size());
-          }
-       }
-       doc.getPackage().revert();
-    }
+    }
+
+    public void testCreateTable() throws Exception {
+        // open an empty document
+        XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("sample.docx");
+
+        // create a table with 5 rows and 7 columns
+        int noRows = 5;
+        int noCols = 7;
+        XWPFTable table = doc.createTable(noRows, noCols);
+
+        // assert the table is empty
+        List<XWPFTableRow> rows = table.getRows();
+        assertEquals("Table has less rows than requested.", noRows, rows.size());
+        for (XWPFTableRow xwpfRow : rows) {
+            assertNotNull(xwpfRow);
+            for (int i = 0; i < 7; i++) {
+                XWPFTableCell xwpfCell = xwpfRow.getCell(i);
+                assertNotNull(xwpfCell);
+                assertEquals("Empty cells should not have one paragraph.", 1, xwpfCell.getParagraphs().size());
+                xwpfCell = xwpfRow.getCell(i);
+                assertEquals("Calling 'getCell' must not modify cells content.", 1, xwpfCell.getParagraphs().size());
+            }
+        }
+        doc.getPackage().revert();
+    }
 }
\ No newline at end of file

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java?rev=1682473&r1=1682472&r2=1682473&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java Fri May 29 14:01:31 2015
@@ -17,71 +17,80 @@
  * ====================================================================
  */
 
-package org.apache.poi.xwpf.usermodel;
-
-import junit.framework.TestCase;
-
-import org.apache.poi.xwpf.usermodel.XWPFTableCell.XWPFVertAlign;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
-
-public class TestXWPFTableCell extends TestCase {
-
-	@Override
-	protected void setUp() throws Exception {
-		super.setUp();
-	}
-
-	public void testSetGetVertAlignment() throws Exception {
-    	// instantiate the following classes so they'll get picked up by
-    	// the XmlBean process and added to the jar file. they are required
-    	// for the following XWPFTableCell methods.
-		CTShd ctShd = CTShd.Factory.newInstance();
-		assertNotNull(ctShd);
-		CTVerticalJc ctVjc = CTVerticalJc.Factory.newInstance();
-		assertNotNull(ctVjc);
-		STShd stShd = STShd.Factory.newInstance();
-		assertNotNull(stShd);
-		STVerticalJc stVjc = STVerticalJc.Factory.newInstance();
-		assertNotNull(stVjc);
-
-    	// create a table
-        XWPFDocument doc = new XWPFDocument();
-    	CTTbl ctTable = CTTbl.Factory.newInstance();
-        XWPFTable table = new XWPFTable(ctTable, doc);
-        // table has a single row by default; grab it
-        XWPFTableRow tr = table.getRow(0);
+package org.apache.poi.xwpf.usermodel;
+
+import junit.framework.TestCase;
+import org.apache.poi.xwpf.usermodel.XWPFTableCell.XWPFVertAlign;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHMerge;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTShd;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcBorders;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTVMerge;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTVerticalJc;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.STMerge;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.STShd;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.STVerticalJc;
+
+public class TestXWPFTableCell extends TestCase {
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    public void testSetGetVertAlignment() throws Exception {
+        // instantiate the following classes so they'll get picked up by
+        // the XmlBean process and added to the jar file. they are required
+        // for the following XWPFTableCell methods.
+        CTShd ctShd = CTShd.Factory.newInstance();
+        assertNotNull(ctShd);
+        CTVerticalJc ctVjc = CTVerticalJc.Factory.newInstance();
+        assertNotNull(ctVjc);
+        STShd stShd = STShd.Factory.newInstance();
+        assertNotNull(stShd);
+        STVerticalJc stVjc = STVerticalJc.Factory.newInstance();
+        assertNotNull(stVjc);
+
+        // create a table
+        XWPFDocument doc = new XWPFDocument();
+        CTTbl ctTable = CTTbl.Factory.newInstance();
+        XWPFTable table = new XWPFTable(ctTable, doc);
+        // table has a single row by default; grab it
+        XWPFTableRow tr = table.getRow(0);
         assertNotNull(tr);
         // row has a single cell by default; grab it
         XWPFTableCell cell = tr.getCell(0);
 
-        cell.setVerticalAlignment(XWPFVertAlign.BOTH);
-        XWPFVertAlign al = cell.getVerticalAlignment();
-        assertEquals(XWPFVertAlign.BOTH, al);
-	}
-
-	public void testSetGetColor() throws Exception {
-    	// create a table
-        XWPFDocument doc = new XWPFDocument();
-    	CTTbl ctTable = CTTbl.Factory.newInstance();
-        XWPFTable table = new XWPFTable(ctTable, doc);
-        // table has a single row by default; grab it
-        XWPFTableRow tr = table.getRow(0);
+        cell.setVerticalAlignment(XWPFVertAlign.BOTH);
+        XWPFVertAlign al = cell.getVerticalAlignment();
+        assertEquals(XWPFVertAlign.BOTH, al);
+    }
+
+    public void testSetGetColor() throws Exception {
+        // create a table
+        XWPFDocument doc = new XWPFDocument();
+        CTTbl ctTable = CTTbl.Factory.newInstance();
+        XWPFTable table = new XWPFTable(ctTable, doc);
+        // table has a single row by default; grab it
+        XWPFTableRow tr = table.getRow(0);
         assertNotNull(tr);
         // row has a single cell by default; grab it
         XWPFTableCell cell = tr.getCell(0);
 
-        cell.setColor("F0000F");
-        String clr = cell.getColor();
-        assertEquals("F0000F", clr);
-	}
-
-    /**
-     * ensure that CTHMerge & CTTcBorders go in poi-ooxml.jar
-     */
-	public void test54099(){
-        XWPFDocument doc = new XWPFDocument();
-        CTTbl ctTable = CTTbl.Factory.newInstance();
-        XWPFTable table = new XWPFTable(ctTable, doc);
+        cell.setColor("F0000F");
+        String clr = cell.getColor();
+        assertEquals("F0000F", clr);
+    }
+
+    /**
+     * ensure that CTHMerge & CTTcBorders go in poi-ooxml.jar
+     */
+    public void test54099() {
+        XWPFDocument doc = new XWPFDocument();
+        CTTbl ctTable = CTTbl.Factory.newInstance();
+        XWPFTable table = new XWPFTable(ctTable, doc);
         XWPFTableRow tr = table.getRow(0);
         XWPFTableCell cell = tr.getCell(0);
 

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableRow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableRow.java?rev=1682473&r1=1682472&r2=1682473&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableRow.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableRow.java Fri May 29 14:01:31 2015
@@ -15,55 +15,54 @@
    limitations under the License.
 ==================================================================== */
 
-package org.apache.poi.xwpf.usermodel;
-
-import junit.framework.TestCase;
-
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRow;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl;
-
-public class TestXWPFTableRow extends TestCase {
-
-	@Override
-	protected void setUp() throws Exception {
-		super.setUp();
-	}
-
-	public void testCreateRow() throws Exception {
-		CTRow ctRow = CTRow.Factory.newInstance();
-		assertNotNull(ctRow);
-	}
-	
-	@Override
-	protected void tearDown() throws Exception {
-		super.tearDown();
-	}
-
-	public void testSetGetCantSplitRow() {
-            // create a table
-            XWPFDocument doc = new XWPFDocument();
-            CTTbl ctTable = CTTbl.Factory.newInstance();
-            XWPFTable table = new XWPFTable(ctTable, doc);
-            // table has a single row by default; grab it
-            XWPFTableRow tr = table.getRow(0);
-            assertNotNull(tr);
-
-            tr.setCantSplitRow(true);
-            boolean isCant = tr.isCantSplitRow();
-            assert(isCant);
-	}
-
-	public void testSetGetRepeatHeader() {
-        // create a table
-            XWPFDocument doc = new XWPFDocument();
-            CTTbl ctTable = CTTbl.Factory.newInstance();
-            XWPFTable table = new XWPFTable(ctTable, doc);
-            // table has a single row by default; grab it
-            XWPFTableRow tr = table.getRow(0);
-            assertNotNull(tr);
-
-            tr.setRepeatHeader(true);
-            boolean isRpt = tr.isRepeatHeader();
-            assert(isRpt);
-	}
-}
+package org.apache.poi.xwpf.usermodel;
+
+import junit.framework.TestCase;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRow;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl;
+
+public class TestXWPFTableRow extends TestCase {
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    public void testCreateRow() throws Exception {
+        CTRow ctRow = CTRow.Factory.newInstance();
+        assertNotNull(ctRow);
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    public void testSetGetCantSplitRow() {
+        // create a table
+        XWPFDocument doc = new XWPFDocument();
+        CTTbl ctTable = CTTbl.Factory.newInstance();
+        XWPFTable table = new XWPFTable(ctTable, doc);
+        // table has a single row by default; grab it
+        XWPFTableRow tr = table.getRow(0);
+        assertNotNull(tr);
+
+        tr.setCantSplitRow(true);
+        boolean isCant = tr.isCantSplitRow();
+        assert (isCant);
+    }
+
+    public void testSetGetRepeatHeader() {
+        // create a table
+        XWPFDocument doc = new XWPFDocument();
+        CTTbl ctTable = CTTbl.Factory.newInstance();
+        XWPFTable table = new XWPFTable(ctTable, doc);
+        // table has a single row by default; grab it
+        XWPFTableRow tr = table.getRow(0);
+        assertNotNull(tr);
+
+        tr.setRepeatHeader(true);
+        boolean isRpt = tr.isRepeatHeader();
+        assert (isRpt);
+    }
+}



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


Mime
View raw message