]> source.dussan.org Git - poi.git/commitdiff
Tried to reproduce Bug 47090, but seems to be fixed now.
authorDominik Stadler <centic@apache.org>
Fri, 23 Aug 2013 18:56:32 +0000 (18:56 +0000)
committerDominik Stadler <centic@apache.org>
Fri, 23 Aug 2013 18:56:32 +0000 (18:56 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1516982 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java
test-data/spreadsheet/47090.xlsx [new file with mode: 0644]

index ec6ab237450fd6b33c111a83d28814a480380b8f..0ea3f55811381b99e95d5f91679dc4d214d72762 100644 (file)
@@ -528,4 +528,50 @@ public final class TestXSSFWorkbook extends BaseTestWorkbook {
                }
                System.out.println("Done");
        }
+       
+       public void testBug47090a() {
+           Workbook workbook = XSSFTestDataSamples.openSampleWorkbook("47090.xlsx");
+               assertSheetOrder(workbook, "Sheet1", "Sheet2");
+           workbook.removeSheetAt(0);
+               assertSheetOrder(workbook, "Sheet2");
+           workbook.createSheet();
+               assertSheetOrder(workbook, "Sheet2", "Sheet1");
+           Workbook read = XSSFTestDataSamples.writeOutAndReadBack(workbook);
+               assertSheetOrder(read, "Sheet2", "Sheet1");
+       }
+       
+       public void testBug47090b() {
+           Workbook workbook = XSSFTestDataSamples.openSampleWorkbook("47090.xlsx");
+           assertSheetOrder(workbook, "Sheet1", "Sheet2");
+           workbook.removeSheetAt(1);
+               assertSheetOrder(workbook, "Sheet1");
+           workbook.createSheet();
+               assertSheetOrder(workbook, "Sheet1", "Sheet0");         // Sheet0 because it uses "Sheet" + sheets.size() as starting point!
+           Workbook read = XSSFTestDataSamples.writeOutAndReadBack(workbook);
+               assertSheetOrder(read, "Sheet1", "Sheet0");
+       }
+
+       public void testBug47090c() {
+           Workbook workbook = XSSFTestDataSamples.openSampleWorkbook("47090.xlsx");
+           assertSheetOrder(workbook, "Sheet1", "Sheet2");
+           workbook.removeSheetAt(0);
+               assertSheetOrder(workbook, "Sheet2");
+           workbook.cloneSheet(0);     
+               assertSheetOrder(workbook, "Sheet2", "Sheet2 (2)");
+           Workbook read = XSSFTestDataSamples.writeOutAndReadBack(workbook);
+               assertSheetOrder(read, "Sheet2", "Sheet2 (2)");
+       }
+       
+       public void testBug47090d() {
+           Workbook workbook = XSSFTestDataSamples.openSampleWorkbook("47090.xlsx");
+           assertSheetOrder(workbook, "Sheet1", "Sheet2");
+           workbook.createSheet();
+               assertSheetOrder(workbook, "Sheet1", "Sheet2", "Sheet0");
+           workbook.removeSheetAt(0);
+               assertSheetOrder(workbook, "Sheet2", "Sheet0");
+           workbook.createSheet();     
+               assertSheetOrder(workbook, "Sheet2", "Sheet0", "Sheet1");
+           Workbook read = XSSFTestDataSamples.writeOutAndReadBack(workbook);
+               assertSheetOrder(read, "Sheet2", "Sheet0", "Sheet1");
+       }
 }
diff --git a/test-data/spreadsheet/47090.xlsx b/test-data/spreadsheet/47090.xlsx
new file mode 100644 (file)
index 0000000..c52ed66
Binary files /dev/null and b/test-data/spreadsheet/47090.xlsx differ