From dbaf5aba32f5cb609c6b17f1221eccd6214c136a Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Thu, 16 Sep 2010 13:46:17 +0000 Subject: [PATCH] Add disabled, failing unit test for bug #49940 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@997752 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/xssf/usermodel/TestXSSFBugs.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) 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 e9daa37bfd..9c451034c4 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java @@ -17,6 +17,8 @@ package org.apache.poi.xssf.usermodel; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.util.List; import org.apache.poi.POIXMLDocumentPart; @@ -428,5 +430,31 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues { assertEquals(Cell.CELL_TYPE_ERROR, evaluator.evaluateInCell(cell).getCellType()); assertEquals("#REF!", FormulaError.forInt(cell.getErrorCellValue()).getString()); } + + /** + * Repeatedly writing the same file which has styles + * TODO Currently failing + */ + public void DISABLEDtest49940() throws Exception { + XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("styles.xlsx"); + assertEquals(3, wb.getNumberOfSheets()); + assertEquals(10, wb.getStylesSource().getNumCellStyles()); + + ByteArrayOutputStream b1 = new ByteArrayOutputStream(); + ByteArrayOutputStream b2 = new ByteArrayOutputStream(); + ByteArrayOutputStream b3 = new ByteArrayOutputStream(); + wb.write(b1); + wb.write(b2); + wb.write(b3); + + for(byte[] data : new byte[][] { + b1.toByteArray(), b2.toByteArray(), b3.toByteArray() + }) { + ByteArrayInputStream bais = new ByteArrayInputStream(data); + wb = new XSSFWorkbook(bais); + assertEquals(3, wb.getNumberOfSheets()); + assertEquals(10, wb.getStylesSource().getNumCellStyles()); + } + } } -- 2.39.5