Bug 57165: also verify that createSheet() had the same problem and is also fixed now

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1663154 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2015-03-01 20:01:43 +00:00
parent 81ae481815
commit c7f6c705be
1 changed files with 20 additions and 0 deletions

View File

@ -2156,6 +2156,26 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
}
}
@Test
public void test57165_create() throws IOException {
XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("57171_57163_57165.xlsx");
try {
removeAllSheetsBut(3, wb);
wb.createSheet("newsheet"); // Throws exception here
wb.setSheetName(1, "New Sheet");
//saveWorkbook(wb, fileName);
XSSFWorkbook wbBack = XSSFTestDataSamples.writeOutAndReadBack(wb);
try {
} finally {
wbBack.close();
}
} finally {
wb.close();
}
}
private static void removeAllSheetsBut(int sheetIndex, Workbook wb)
{
int sheetNb = wb.getNumberOfSheets();