]> source.dussan.org Git - poi.git/commitdiff
#65282 - addRun method only adds to run collection, missing iRun collection
authorSayi <sayi@apache.org>
Thu, 6 May 2021 06:29:31 +0000 (06:29 +0000)
committerSayi <sayi@apache.org>
Thu, 6 May 2021 06:29:31 +0000 (06:29 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1889551 13f79535-47bb-0310-9956-ffa450edef68

poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java
poi-ooxml/src/test/java/org/apache/poi/xwpf/usermodel/TestXWPFParagraph.java

index c2228ce143c412eae4475345d6bb2dbbe2f08f7c..cd0ee99b64d097950dd0b2653730b7b91f5f0f93 100644 (file)
@@ -1852,6 +1852,7 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
     public void addRun(XWPFRun r) {
         if (!runs.contains(r)) {
             runs.add(r);
+            iruns.add(r);
         }
     }
 
index 73eb333e652eba98fbbc1fd0c6afa5c36abcb68c..da6c6c7e08a204fed46af9ad76c4e2554258da05 100644 (file)
@@ -330,15 +330,23 @@ public final class TestXWPFParagraph {
 
             XWPFParagraph p = doc.getParagraphs().get(0);
             assertEquals(2, p.getRuns().size());
+            assertEquals(2, p.getIRuns().size());
 
             XWPFRun r = p.createRun();
             assertEquals(3, p.getRuns().size());
             assertEquals(2, p.getRuns().indexOf(r));
 
+            assertEquals(3, p.getIRuns().size());
+            assertEquals(2, p.getIRuns().indexOf(r));
+
             XWPFRun r2 = p.insertNewRun(1);
             assertEquals(4, p.getRuns().size());
             assertEquals(1, p.getRuns().indexOf(r2));
             assertEquals(3, p.getRuns().indexOf(r));
+
+            assertEquals(4, p.getIRuns().size());
+            assertEquals(1, p.getIRuns().indexOf(r2));
+            assertEquals(3, p.getIRuns().indexOf(r));
         }
     }