]> source.dussan.org Git - poi.git/commitdiff
Bug 57165: also verify that createSheet() had the same problem and is also fixed now
authorDominik Stadler <centic@apache.org>
Sun, 1 Mar 2015 20:01:43 +0000 (20:01 +0000)
committerDominik Stadler <centic@apache.org>
Sun, 1 Mar 2015 20:01:43 +0000 (20:01 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1663154 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java

index 1ebb56178a453a2fd1c1938058fc79f1e19cf9d6..6eaa3f14d1cbe70197a23ee4029f798a39994d4b 100644 (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();