poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1881354 - in /poi/trunk/src/ooxml: java/org/apache/poi/xwpf/usermodel/XWPFTableRow.java testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableRow.java
Date Tue, 01 Sep 2020 11:56:13 GMT
Author: sayi
Date: Tue Sep  1 11:56:13 2020
New Revision: 1881354

URL: http://svn.apache.org/viewvc?rev=1881354&view=rev
Log:
CTRow removes tc when row removes cell

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableRow.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableRow.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableRow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableRow.java?rev=1881354&r1=1881353&r2=1881354&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableRow.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableRow.java Tue Sep  1 11:56:13
2020
@@ -74,6 +74,7 @@ public class XWPFTableRow {
     public void removeCell(int pos) {
         if (pos >= 0 && pos < ctRow.sizeOfTcArray()) {
             tableCells.remove(pos);
+            ctRow.removeTc(pos);
         }
     }
 

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=1881354&r1=1881353&r2=1881354&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 Tue
Sep  1 11:56:13 2020
@@ -17,6 +17,7 @@
 
 package org.apache.poi.xwpf.usermodel;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
@@ -142,6 +143,20 @@ public class TestXWPFTableRow {
     }
 
     @Test
+    public void testRemoveCell() throws IOException {
+        XWPFDocument doc = new XWPFDocument();
+        XWPFTableRow tr = doc.createTable(1, 1).createRow();
+
+        assertEquals(1, tr.getTableCells().size());
+        assertEquals(tr.getTableCells().size(), tr.getCtRow().sizeOfTcArray());
+
+        tr.removeCell(0);
+        assertEquals(0, tr.getTableCells().size());
+        assertEquals(tr.getTableCells().size(), tr.getCtRow().sizeOfTcArray());
+        doc.close();
+    }
+
+    @Test
     public void testBug62174() throws IOException {
         try (XWPFDocument doc = XWPFTestDataSamples
                 .openSampleDocument("Bug60337.docx")) {



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


Mime
View raw message