Improved tests to show that bugs #45062 and #44292 are fixed

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@697595 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2008-09-21 19:31:34 +00:00
parent fdc39d48a7
commit 20392c85a8

View File

@ -74,7 +74,8 @@ public class TestProblems extends TestCase {
} }
/** /**
* Test for TableCell not skipping the last paragraph * Test for TableCell not skipping the last paragraph.
* Bugs #45062 and #44292
*/ */
public void testTableCellLastParagraph() throws Exception { public void testTableCellLastParagraph() throws Exception {
HWPFDocument doc = new HWPFDocument(new FileInputStream( HWPFDocument doc = new HWPFDocument(new FileInputStream(
@ -93,22 +94,27 @@ public class TestProblems extends TestCase {
Table t = r.getTable(p); Table t = r.getTable(p);
//get the only row //get the only row
assertEquals(1, t.numRows());
TableRow row = t.getRow(0); TableRow row = t.getRow(0);
//get the first cell //get the first cell
TableCell cell = row.getCell(0); TableCell cell = row.getCell(0);
// First cell should have one paragraph // First cell should have one paragraph
assertEquals(1, cell.numParagraphs()); assertEquals(1, cell.numParagraphs());
assertEquals("One paragraph is ok\7", cell.getParagraph(0).text());
//get the second //get the second
cell = row.getCell(1); cell = row.getCell(1);
// Second cell should be detected as having two paragraphs // Second cell should be detected as having two paragraphs
assertEquals(2, cell.numParagraphs()); assertEquals(2, cell.numParagraphs());
assertEquals("First para is ok\r", cell.getParagraph(0).text());
assertEquals("Second paragraph is skipped\7", cell.getParagraph(1).text());
//get the last cell //get the last cell
cell = row.getCell(2); cell = row.getCell(2);
// Last cell should have one paragraph // Last cell should have one paragraph
assertEquals(1, cell.numParagraphs()); assertEquals(1, cell.numParagraphs());
assertEquals("One paragraph is ok\7", cell.getParagraph(0).text());
} }
public void testRangeDelete() throws Exception { public void testRangeDelete() throws Exception {