diff options
author | Dominik Stadler <centic@apache.org> | 2015-09-20 20:16:17 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2015-09-20 20:16:17 +0000 |
commit | eb6cc7eca19f55e07e4cac9bf8ebdea30573440e (patch) | |
tree | 9dc2cf57b6c8b7713381f416db3e6a2048f7ebe4 /src/testcases/org/apache | |
parent | 387b34f7a18a9ef5497dc52e882c1c3b132e48fc (diff) | |
download | poi-eb6cc7eca19f55e07e4cac9bf8ebdea30573440e.tar.gz poi-eb6cc7eca19f55e07e4cac9bf8ebdea30573440e.zip |
Bug 58333: Apply patch to verify behavior on row-index before and after the limits set by the specification
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1704186 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache')
-rw-r--r-- | src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java | 7 | ||||
-rw-r--r-- | src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java | 25 |
2 files changed, 31 insertions, 1 deletions
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java index f47a11efdc..4b7d8491be 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java @@ -57,6 +57,7 @@ import org.apache.poi.hssf.record.WSBoolRecord; import org.apache.poi.hssf.record.WindowTwoRecord; import org.apache.poi.hssf.record.aggregates.WorksheetProtectionBlock; import org.apache.poi.hssf.usermodel.RecordInspector.RecordCollector; +import org.apache.poi.ss.SpreadsheetVersion; import org.apache.poi.ss.formula.ptg.Area3DPtg; import org.apache.poi.ss.formula.ptg.Ptg; import org.apache.poi.ss.usermodel.AutoFilter; @@ -84,7 +85,11 @@ public final class TestHSSFSheet extends BaseTestSheet { public TestHSSFSheet() { super(HSSFITestDataProvider.instance); } - + + @Test + public void createRowAfterLastRow() { + createRowAfterLastRow(SpreadsheetVersion.EXCEL97); + } /** * Test for Bugzilla #29747. diff --git a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java index 55f9795e31..1608006852 100644 --- a/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java +++ b/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java @@ -87,6 +87,31 @@ public abstract class BaseTestSheet { assertSame(row2_ovrewritten, row2_ovrewritten_ref); assertEquals(100.0, row2_ovrewritten_ref.getCell(0).getNumericCellValue(), 0.0); } + + @Test + public void createRowBeforeFirstRow() { + final Workbook workbook = _testDataProvider.createWorkbook(); + final Sheet sh = workbook.createSheet(); + sh.createRow(0); + try { + sh.createRow(-1); + fail("Negative rows not allowed"); + } catch (final IllegalArgumentException e) { + // expected + } + } + + protected void createRowAfterLastRow(SpreadsheetVersion version) { + final Workbook workbook = _testDataProvider.createWorkbook(); + final Sheet sh = workbook.createSheet(); + sh.createRow(version.getLastRowIndex()); + try { + sh.createRow(version.getLastRowIndex() + 1); + fail("Row number must be between 0 and " + version.getLastColumnIndex()); + } catch (final IllegalArgumentException e) { + // expected + } + } @Test |