diff options
author | Dominik Stadler <centic@apache.org> | 2015-09-29 13:09:47 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2015-09-29 13:09:47 +0000 |
commit | 38827e7b29a4cb8ca1b743aa845589586bb8d896 (patch) | |
tree | ca87c07ba05d683174536c2e329f2074b4d56454 /src/ooxml/testcases/org | |
parent | 23164fc28f4cfc203d5b5b00c4630714783d3a05 (diff) | |
download | poi-38827e7b29a4cb8ca1b743aa845589586bb8d896.tar.gz poi-38827e7b29a4cb8ca1b743aa845589586bb8d896.zip |
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
Diffstat (limited to 'src/ooxml/testcases/org')
-rw-r--r-- | src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java | 57 |
1 files changed, 34 insertions, 23 deletions
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<String> sheetNames = new HashSet<String>(); + + 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(); + } } |