]> source.dussan.org Git - poi.git/commitdiff
Add disabled, failing unit test for bug #49940
authorNick Burch <nick@apache.org>
Thu, 16 Sep 2010 13:46:17 +0000 (13:46 +0000)
committerNick Burch <nick@apache.org>
Thu, 16 Sep 2010 13:46:17 +0000 (13:46 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@997752 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java

index e9daa37bfdf2f8823f1e2aec53c0ea9b79926f19..9c451034c463a172f3179353ccbe7ec5b6147ca8 100644 (file)
@@ -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());
+       }
+    }
 
 }