From 38827e7b29a4cb8ca1b743aa845589586bb8d896 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Tue, 29 Sep 2015 13:09:47 +0000 Subject: [PATCH] Verify that bug 51998 is actually fixed since some time already. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1705855 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/xssf/usermodel/TestXSSFBugs.java | 57 +++++++++++------- test-data/spreadsheet/51998.xlsx | Bin 0 -> 11302 bytes 2 files changed, 34 insertions(+), 23 deletions(-) create mode 100644 test-data/spreadsheet/51998.xlsx diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java index 326f8b1870..2643654f8d 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java @@ -35,6 +35,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import java.util.Calendar; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -61,29 +62,7 @@ import org.apache.poi.ss.formula.eval.ErrorEval; import org.apache.poi.ss.formula.eval.NumberEval; import org.apache.poi.ss.formula.eval.ValueEval; import org.apache.poi.ss.formula.functions.Function; -import org.apache.poi.ss.usermodel.BaseTestBugzillaIssues; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.CellStyle; -import org.apache.poi.ss.usermodel.CellValue; -import org.apache.poi.ss.usermodel.ClientAnchor; -import org.apache.poi.ss.usermodel.Comment; -import org.apache.poi.ss.usermodel.CreationHelper; -import org.apache.poi.ss.usermodel.DataFormat; -import org.apache.poi.ss.usermodel.DataFormatter; -import org.apache.poi.ss.usermodel.DateUtil; -import org.apache.poi.ss.usermodel.Drawing; -import org.apache.poi.ss.usermodel.Font; -import org.apache.poi.ss.usermodel.FormulaError; -import org.apache.poi.ss.usermodel.FormulaEvaluator; -import org.apache.poi.ss.usermodel.Hyperlink; -import org.apache.poi.ss.usermodel.IndexedColors; -import org.apache.poi.ss.usermodel.Name; -import org.apache.poi.ss.usermodel.PrintSetup; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.SheetConditionalFormatting; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.ss.usermodel.WorkbookFactory; +import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.util.AreaReference; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.CellReference; @@ -2812,4 +2791,36 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues { wb.close(); } + + @Test + public void test51998() throws IOException { + Workbook wb = XSSFTestDataSamples.openSampleWorkbook("51998.xlsx"); + + Set sheetNames = new HashSet(); + + for (int sheetNum = 0; sheetNum < wb.getNumberOfSheets(); sheetNum++) + { + sheetNames.add(wb.getSheetName(sheetNum)); + } + + for (String sheetName : sheetNames) + { + int sheetIndex = wb.getSheetIndex(sheetName); + + wb.removeSheetAt(sheetIndex); + + Sheet newSheet = wb.createSheet(); + //Sheet newSheet = wb.createSheet(sheetName); + int newSheetIndex = wb.getSheetIndex(newSheet); + //System.out.println(newSheetIndex); + wb.setSheetName(newSheetIndex, sheetName); + wb.setSheetOrder(sheetName, sheetIndex); + } + + Workbook wbBack = XSSFTestDataSamples.writeOutAndReadBack(wb); + wb.close(); + + assertNotNull(wbBack); + wbBack.close(); + } } diff --git a/test-data/spreadsheet/51998.xlsx b/test-data/spreadsheet/51998.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..835ba631c3bf6944a7b050d69acfe1657406a881 GIT binary patch literal 11302 zcmeHtbyQUQ_x21R2t$LElt_o9fRuzNF++FP03zM3gfIvwAe}OFN=Qf#Qc8n_Af3|P z$ZzC+zpwYA_g(jo_pjf3&st~Bf_3&YbM~|M`Ru))kCHqp8ZiJJa2)^u+yWT&W8caF z0su;w000qS5~w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