]> source.dussan.org Git - poi.git/commitdiff
[bug-62215] add test case for sxssf formulas - issue was already fixed
authorPJ Fanning <fanningpj@apache.org>
Mon, 11 Oct 2021 10:45:59 +0000 (10:45 +0000)
committerPJ Fanning <fanningpj@apache.org>
Mon, 11 Oct 2021 10:45:59 +0000 (10:45 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894128 13f79535-47bb-0310-9956-ffa450edef68

poi-ooxml-full/src/main/java9/module-info.class
poi-ooxml-lite-agent/src/main/java9/module-info.class
poi-ooxml/src/main/java9/module-info.class
poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestSXSSFBugs.java
poi-ooxml/src/test/java9/module-info.class
poi-scratchpad/src/main/java9/module-info.class
poi-scratchpad/src/test/java9/module-info.class
poi/src/test/java9/module-info.class

index 34e3970b8849a70ef2bb080fe67086d83070cd94..e922419617ff81832e51789cbb1ab67a56579a15 100644 (file)
Binary files a/poi-ooxml-full/src/main/java9/module-info.class and b/poi-ooxml-full/src/main/java9/module-info.class differ
index 7839f4047c26fcef80aa978589ae660fcc1877b5..8b45606400bd5d7d78a18a2dbc0c02899cb405f7 100644 (file)
Binary files a/poi-ooxml-lite-agent/src/main/java9/module-info.class and b/poi-ooxml-lite-agent/src/main/java9/module-info.class differ
index fd29b43f37a2f11a6243e50773ba0f7279e184f8..f4db29c6148bb418b977c028df8257512d4751e3 100644 (file)
Binary files a/poi-ooxml/src/main/java9/module-info.class and b/poi-ooxml/src/main/java9/module-info.class differ
index 432444f0441cd164b28ed130daabd140285aac68..a9dbe077ec9a81ddf333eb6ec08ec35c313a8cb7 100644 (file)
@@ -274,4 +274,43 @@ public final class TestSXSSFBugs extends BaseTestBugzillaIssues {
             }
         }
     }
+
+    @Test
+    public void test62215() throws IOException {
+        String sheetName = "1";
+        int rowIndex = 0;
+        int colIndex = 0;
+        String formula = "1";
+        String value = "yes";
+        CellType valueType = CellType.STRING;
+
+        try (Workbook wb = new SXSSFWorkbook()) {
+            Sheet sheet = wb.createSheet(sheetName);
+            Row row = sheet.createRow(rowIndex);
+            Cell cell = row.createCell(colIndex);
+
+            // this order ensures that value will not be overwritten by setting the formula
+            cell.setCellFormula(formula);
+            cell.setCellValue(value);
+
+            assertEquals(CellType.FORMULA, cell.getCellType());
+            assertEquals(formula, cell.getCellFormula());
+            assertEquals(valueType, cell.getCachedFormulaResultType());
+            assertEquals(value, cell.getStringCellValue());
+            // so far so good
+
+            try (UnsynchronizedByteArrayOutputStream bos = new UnsynchronizedByteArrayOutputStream()){
+                wb.write(bos);
+
+                try (XSSFWorkbook testWb = new XSSFWorkbook(bos.toInputStream())) {
+                    Cell testCell = testWb.getSheet(sheetName).getRow(rowIndex).getCell(colIndex);
+                    assertEquals(CellType.FORMULA, testCell.getCellType());
+                    assertEquals(formula, testCell.getCellFormula());
+
+                    assertEquals(CellType.STRING, testCell.getCachedFormulaResultType());
+                    assertEquals(value, testCell.getStringCellValue());
+                }
+            }
+        }
+    }
 }
index 012028ad0bb1c8f981a0d6149130a5c73cf4124e..2cd55eb942abe5e2d34493e2f899c32212601558 100644 (file)
Binary files a/poi-ooxml/src/test/java9/module-info.class and b/poi-ooxml/src/test/java9/module-info.class differ
index 53efc695f7baf77bb61cfbc0809422ff9175a6a0..72189ac318dd5fdfbb0c5ec62efaff1fb5a610cb 100644 (file)
Binary files a/poi-scratchpad/src/main/java9/module-info.class and b/poi-scratchpad/src/main/java9/module-info.class differ
index e4d2abd3d2413cc9c0d9d8393eac8b85647f85d8..f5349bb241c60277f72502fdbfef92b958413333 100644 (file)
Binary files a/poi-scratchpad/src/test/java9/module-info.class and b/poi-scratchpad/src/test/java9/module-info.class differ
index b145aa3bb7e76afca6d00a28b2c554c70519ff27..028b943d0ae7577c19f08d4b20ce352134f4f685 100644 (file)
Binary files a/poi/src/test/java9/module-info.class and b/poi/src/test/java9/module-info.class differ