diff options
author | Alain Béarez <abearez@apache.org> | 2019-11-27 04:54:34 +0000 |
---|---|---|
committer | Alain Béarez <abearez@apache.org> | 2019-11-27 04:54:34 +0000 |
commit | 557b67cb247c07988ea3a9418d41380242d7777d (patch) | |
tree | 9a904473ab3d5bedbbd44e28a69460d5cd9de8cb /src/ooxml/testcases/org/apache/poi | |
parent | ede9369bbc09e12387d71c2c2849bc4d779901cc (diff) | |
download | poi-557b67cb247c07988ea3a9418d41380242d7777d.tar.gz poi-557b67cb247c07988ea3a9418d41380242d7777d.zip |
Add, insert and remove columns on XSLFTable
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1870486 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/testcases/org/apache/poi')
-rw-r--r-- | src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java index 632027a8a0..d993b70b90 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java @@ -68,6 +68,14 @@ public class TestXSLFTable { tab.setColumnWidth(1, 60); tab.setColumnWidth(2, 60); + tab.insertColumn(0); + assertEquals(tab.getColumnWidth(1), tab.getColumnWidth(0), 0.00001); + tab.addColumn(); + assertEquals(tab.getColumnWidth(tab.getNumberOfColumns() - 2), tab.getColumnWidth(tab.getNumberOfColumns() - 1), 0.00001); + tab.removeColumn(0); + tab.removeColumn(tab.getNumberOfColumns() - 1); + assertEquals(data[0].length, tab.getNumberOfColumns()); + int startRow = rowIdx-1; XSLFTableRow row = tab.getRows().get(0); @@ -176,7 +184,7 @@ public class TestXSLFTable { assertEquals("A1", cells1.get(0).getText()); assertEquals("B1", cells1.get(1).getText()); assertEquals("C1", cells1.get(2).getText()); - + ppt.close(); } @@ -244,7 +252,7 @@ public class TestXSLFTable { assertEquals(VerticalAlignment.MIDDLE, cell1.getVerticalAlignment()); cell1.setVerticalAlignment(null); assertEquals(VerticalAlignment.TOP, cell1.getVerticalAlignment()); - + XMLSlideShow ppt2 = XSLFTestDataSamples.writeOutAndReadBack(ppt1); ppt1.close(); @@ -254,25 +262,25 @@ public class TestXSLFTable { assertEquals(1, tbl.getNumberOfRows()); assertEquals("POI", tbl.getCell(0, 0).getText()); assertEquals("Apache", tbl.getCell(0, 1).getText()); - + ppt2.close(); } - + @Test public void removeTable() throws IOException { XMLSlideShow ss = XSLFTestDataSamples.openSampleDocument("shapes.pptx"); XSLFSlide sl = ss.getSlides().get(0); XSLFTable tab = (XSLFTable)sl.getShapes().get(4); sl.removeShape(tab); - + XMLSlideShow ss2 = XSLFTestDataSamples.writeOutAndReadBack(ss); ss.close(); - + sl = ss2.getSlides().get(0); for (XSLFShape s : sl.getShapes()) { assertFalse(s instanceof XSLFTable); } - + ss2.close(); } @@ -292,7 +300,7 @@ public class TestXSLFTable { // so we use something more reliable assertTrue(tc0.getTextHeight() > 50); assertEquals(0, tc0.getLineWidth(), 0); - + ppt.close(); } |