https://bz.apache.org/bugzilla/show_bug.cgi?id=65023

            Bug ID: 65023
           Summary: addNewCol is untested and does not work
           Product: POI
           Version: unspecified
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XWPF
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

In src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTable.java, the method
addNewCol() is unused and also untested in the Apache POI project. In the
course of writing a unit test for it, I discovered that the implementation does
not work as it creates new rows instead of using the existing ones.

I am writing a fix for it and will submit a PR via GitHub. I will add a comment
to this report once I have done so - I need to submit this report first in
order to get an issue number.

Test to reproduce the issue:

    @Test
    public void testAddNewCol() throws IOException {
        XWPFDocument doc = new XWPFDocument();
        XWPFTable table = doc.createTable(2, 4);
        table.addNewCol();
        XWPFTableRow lastRow = table.tableRows.get(table.tableRows.size() - 1);

        int expected = 5;
        int actual = lastRow.getTableCells().size();
        assertEquals(expected, actual);
        doc.close();
    }

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to