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
This commit is contained in:
parent
f2cd7ed8f5
commit
d61ea07e26
@ -24,6 +24,7 @@ import static org.junit.Assert.fail;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.apache.poi.ss.SpreadsheetVersion;
|
||||||
import org.apache.poi.ss.usermodel.BaseTestSheet;
|
import org.apache.poi.ss.usermodel.BaseTestSheet;
|
||||||
import org.apache.poi.ss.usermodel.Sheet;
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
@ -146,6 +147,10 @@ public class TestSXSSFSheet extends BaseTestSheet {
|
|||||||
} finally {
|
} finally {
|
||||||
wb.close();
|
wb.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void createRowAfterLastRow() {
|
||||||
|
createRowAfterLastRow(SpreadsheetVersion.EXCEL2007);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ import org.apache.poi.POIXMLException;
|
|||||||
import org.apache.poi.hssf.HSSFTestDataSamples;
|
import org.apache.poi.hssf.HSSFTestDataSamples;
|
||||||
import org.apache.poi.poifs.crypt.CryptoFunctions;
|
import org.apache.poi.poifs.crypt.CryptoFunctions;
|
||||||
import org.apache.poi.poifs.crypt.HashAlgorithm;
|
import org.apache.poi.poifs.crypt.HashAlgorithm;
|
||||||
|
import org.apache.poi.ss.SpreadsheetVersion;
|
||||||
import org.apache.poi.ss.usermodel.AutoFilter;
|
import org.apache.poi.ss.usermodel.AutoFilter;
|
||||||
import org.apache.poi.ss.usermodel.BaseTestSheet;
|
import org.apache.poi.ss.usermodel.BaseTestSheet;
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
@ -995,6 +996,11 @@ public final class TestXSSFSheet extends BaseTestSheet {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void createRowAfterLastRow() {
|
||||||
|
createRowAfterLastRow(SpreadsheetVersion.EXCEL2007);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void setAutoFilter() {
|
public void setAutoFilter() {
|
||||||
XSSFWorkbook wb = new XSSFWorkbook();
|
XSSFWorkbook wb = new XSSFWorkbook();
|
||||||
|
@ -57,6 +57,7 @@ import org.apache.poi.hssf.record.WSBoolRecord;
|
|||||||
import org.apache.poi.hssf.record.WindowTwoRecord;
|
import org.apache.poi.hssf.record.WindowTwoRecord;
|
||||||
import org.apache.poi.hssf.record.aggregates.WorksheetProtectionBlock;
|
import org.apache.poi.hssf.record.aggregates.WorksheetProtectionBlock;
|
||||||
import org.apache.poi.hssf.usermodel.RecordInspector.RecordCollector;
|
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.Area3DPtg;
|
||||||
import org.apache.poi.ss.formula.ptg.Ptg;
|
import org.apache.poi.ss.formula.ptg.Ptg;
|
||||||
import org.apache.poi.ss.usermodel.AutoFilter;
|
import org.apache.poi.ss.usermodel.AutoFilter;
|
||||||
@ -85,6 +86,10 @@ public final class TestHSSFSheet extends BaseTestSheet {
|
|||||||
super(HSSFITestDataProvider.instance);
|
super(HSSFITestDataProvider.instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void createRowAfterLastRow() {
|
||||||
|
createRowAfterLastRow(SpreadsheetVersion.EXCEL97);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for Bugzilla #29747.
|
* Test for Bugzilla #29747.
|
||||||
|
@ -88,6 +88,31 @@ public abstract class BaseTestSheet {
|
|||||||
assertEquals(100.0, row2_ovrewritten_ref.getCell(0).getNumericCellValue(), 0.0);
|
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
|
@Test
|
||||||
public void removeRow() {
|
public void removeRow() {
|
||||||
|
Loading…
Reference in New Issue
Block a user