]> source.dussan.org Git - poi.git/commitdiff
Add second verification of bug 56325 to ensure it is really fixed
authorDominik Stadler <centic@apache.org>
Sat, 14 Mar 2015 17:50:55 +0000 (17:50 +0000)
committerDominik Stadler <centic@apache.org>
Sat, 14 Mar 2015 17:50:55 +0000 (17:50 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1666718 13f79535-47bb-0310-9956-ffa450edef68

src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
test-data/spreadsheet/56325a.xls [new file with mode: 0644]

index 873647805c6575e67946c4d9f76748b53a82df3e..73256b6897a1140738899441313f4858b061fd91 100644 (file)
@@ -32,6 +32,7 @@ import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Calendar;
@@ -71,6 +72,7 @@ import org.apache.poi.ss.usermodel.Name;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.util.TempFile;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -2526,6 +2528,33 @@ public final class TestBugs extends BaseTestBugzillaIssues {
         wb = HSSFTestDataSamples.writeOutAndReadBack(wb);
         assertEquals(0, wb.getNumberOfSheets());
     }
+
+    @Test
+    public void bug56325a() throws IOException {
+        HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("56325a.xls");
+        
+        HSSFSheet sheet = wb.cloneSheet(2);
+        wb.setSheetName(3, "Clone 1");
+        sheet.setRepeatingRows(CellRangeAddress.valueOf("2:3"));
+        wb.setPrintArea(3, "$A$4:$C$10");
+        
+        sheet = wb.cloneSheet(2);
+        wb.setSheetName(4, "Clone 2");
+        sheet.setRepeatingRows(CellRangeAddress.valueOf("2:3"));
+        wb.setPrintArea(4, "$A$4:$C$10");
+        
+        wb.removeSheetAt(2);
+
+        Workbook wbBack = HSSFTestDataSamples.writeOutAndReadBack(wb);
+        assertEquals(4, wbBack.getNumberOfSheets());
+        
+//        OutputStream fOut = new FileOutputStream("/tmp/56325a.xls");
+//        try {
+//             wb.write(fOut);
+//        } finally {
+//             fOut.close();
+//        }
+    }
     
     /**
      * Formulas which reference named ranges, either in other
diff --git a/test-data/spreadsheet/56325a.xls b/test-data/spreadsheet/56325a.xls
new file mode 100644 (file)
index 0000000..a1e52cb
Binary files /dev/null and b/test-data/spreadsheet/56325a.xls differ