aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/testcases/org/apache/poi/xwpf
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2016-03-12 11:45:34 +0000
committerDominik Stadler <centic@apache.org>2016-03-12 11:45:34 +0000
commit14e3827e8c206bd061a6286d0a49776fed4f58a6 (patch)
tree8f4a94dd3b558643294d4434ac264541c1672260 /src/ooxml/testcases/org/apache/poi/xwpf
parent71f5735238d9af3088682f3eb8321a35b9df2e32 (diff)
downloadpoi-14e3827e8c206bd061a6286d0a49776fed4f58a6.tar.gz
poi-14e3827e8c206bd061a6286d0a49776fed4f58a6.zip
Apply patch to fix bug 57495: getTableArray method can not get 0 pos table
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1734694 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/testcases/org/apache/poi/xwpf')
-rw-r--r--src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFBugs.java36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFBugs.java b/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFBugs.java
index 6d780e89ff..0e7b2c55b2 100644
--- a/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFBugs.java
+++ b/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFBugs.java
@@ -21,6 +21,7 @@ import static org.junit.Assert.assertNotNull;
import java.io.IOException;
+import org.apache.poi.util.Units;
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
import org.apache.poi.xwpf.XWPFTestDataSamples;
import org.apache.poi.xwpf.usermodel.XWPFRun.FontCharRange;
@@ -55,7 +56,6 @@ public class TestXWPFBugs {
doc.close();
}
-
@Test
public void bug57312_NullPointException() throws IOException {
XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("57312.docx");
@@ -82,6 +82,40 @@ public class TestXWPFBugs {
}
}
+ @Test
+ public void bug57495_getTableArrayInDoc() {
+ XWPFDocument doc =new XWPFDocument();
+ //let's create a few tables for the test
+ for(int i=0;i<3;i++) {
+ doc.createTable(2, 2);
+ }
+ XWPFTable table = doc.getTableArray(0);
+ assertNotNull(table);
+ //let's check also that returns the correct table
+ XWPFTable same = doc.getTables().get(0);
+ assertEquals(table, same);
+ }
+
+ @Test
+ public void bug57495_getParagraphArrayInTableCell() {
+ XWPFDocument doc =new XWPFDocument();
+ //let's create a table for the test
+ XWPFTable table = doc.createTable(2, 2);
+ assertNotNull(table);
+ XWPFParagraph p = table.getRow(0).getCell(0).getParagraphArray(0);
+ assertNotNull(p);
+ //let's check also that returns the correct paragraph
+ XWPFParagraph same = table.getRow(0).getCell(0).getParagraphs().get(0);
+ assertEquals(p, same);
+ }
+
+ @Test
+ public void bug57495_convertPixelsToEMUs() {
+ int pixels = 100;
+ int expectedEMU = 952500;
+ int result = Units.pixelToEMU(pixels);
+ assertEquals(expectedEMU, result);
+ }
@Test
public void test56392() throws IOException, OpenXML4JException {