aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/testcases/org/apache/poi/xwpf
diff options
context:
space:
mode:
authorTim Allison <tallison@apache.org>2016-02-19 15:46:26 +0000
committerTim Allison <tallison@apache.org>2016-02-19 15:46:26 +0000
commit12ac00eafd677f6e6be10a143a8f2b6ef96a3d2e (patch)
tree60abb320311d886025aa9fe59218b5a2839c7489 /src/ooxml/testcases/org/apache/poi/xwpf
parent36ae29751d6109c781deedb0ede25e677db401c7 (diff)
downloadpoi-12ac00eafd677f6e6be10a143a8f2b6ef96a3d2e.tar.gz
poi-12ac00eafd677f6e6be10a143a8f2b6ef96a3d2e.zip
POI 59030 fix NPE in XWPFTableCell's getVerticalAlignment via Prasad Babu
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1731257 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/TestXWPFTableCell.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java b/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java
index f793742c3f..ab2fad84b3 100644
--- a/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java
+++ b/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java
@@ -19,8 +19,11 @@
package org.apache.poi.xwpf.usermodel;
+import java.util.List;
+
import junit.framework.TestCase;
+import org.apache.poi.xwpf.XWPFTestDataSamples;
import org.apache.poi.xwpf.usermodel.XWPFTableCell.XWPFVertAlign;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHMerge;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTShd;
@@ -103,4 +106,20 @@ public class TestXWPFTableCell extends TestCase {
CTTcBorders tblBorders = tcPr.addNewTcBorders();
CTVMerge vMerge = tcPr.addNewVMerge();
}
+
+ public void testCellVerticalAlign() throws Exception{
+ XWPFDocument docx = XWPFTestDataSamples.openSampleDocument("59030.docx");
+ List<XWPFTable> tables = docx.getTables();
+ assertEquals(1, tables.size());
+
+ XWPFTable table = tables.get(0);
+
+ List<XWPFTableRow> tableRows = table.getRows();
+ assertEquals(2, tableRows.size());
+
+ assertNull(tableRows.get(0).getCell(0).getVerticalAlignment());
+ assertEquals(XWPFVertAlign.BOTTOM, tableRows.get(0).getCell(1).getVerticalAlignment());
+ assertEquals(XWPFVertAlign.CENTER, tableRows.get(1).getCell(0).getVerticalAlignment());
+ assertNull(tableRows.get(1).getCell(1).getVerticalAlignment());
+ }
}