diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java index 9b6b20e71..0297cf5f8 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestUnfixedBugs.java @@ -29,6 +29,8 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.nio.charset.Charset; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; import java.util.Calendar; import java.util.Date; import java.util.Iterator; @@ -177,36 +179,6 @@ public final class TestUnfixedBugs { assertEquals(DateUtil.getJavaDate(value1, false), DateUtil.getJavaDate(value2, false)); } - @Test - public void test57236() throws Exception { - // Having very small numbers leads to different formatting, Excel uses the scientific notation, but POI leads to "0" - - /* - DecimalFormat format = new DecimalFormat("#.##########", new DecimalFormatSymbols(Locale.getDefault())); - double d = 3.0E-104; - assertEquals("3.0E-104", format.format(d)); - */ - - DataFormatter formatter = new DataFormatter(true); - - XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("57236.xlsx"); - for(int sheetNum = 0;sheetNum < wb.getNumberOfSheets();sheetNum++) { - Sheet sheet = wb.getSheetAt(sheetNum); - for(int rowNum = sheet.getFirstRowNum();rowNum < sheet.getLastRowNum();rowNum++) { - Row row = sheet.getRow(rowNum); - for(int cellNum = row.getFirstCellNum();cellNum < row.getLastCellNum();cellNum++) { - Cell cell = row.getCell(cellNum); - String fmtCellValue = formatter.formatCellValue(cell); - - System.out.println("Cell: " + fmtCellValue); - assertNotNull(fmtCellValue); - assertFalse(fmtCellValue.equals("0")); - } - } - } - wb.close(); - } - // When this is fixed, the test case should go to BaseTestXCell with // adjustments to use _testDataProvider to also verify this for XSSF @Test 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 d150abaf9..56eff4457 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java @@ -2875,4 +2875,35 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues { assertEquals(1, wb.getNumberOfSheets()); assertEquals("Sheet1", wb.getSheetName(0)); } + + @Test + public void test57236() throws Exception { + // Having very small numbers leads to different formatting, Excel uses the scientific notation, but POI leads to "0" + + /* + DecimalFormat format = new DecimalFormat("#.##########", new DecimalFormatSymbols(Locale.getDefault())); + double d = 3.0E-104; + assertEquals("3.0E-104", format.format(d)); + */ + + DataFormatter formatter = new DataFormatter(true); + + XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("57236.xlsx"); + for(int sheetNum = 0;sheetNum < wb.getNumberOfSheets();sheetNum++) { + Sheet sheet = wb.getSheetAt(sheetNum); + for(int rowNum = sheet.getFirstRowNum();rowNum < sheet.getLastRowNum();rowNum++) { + Row row = sheet.getRow(rowNum); + for(int cellNum = row.getFirstCellNum();cellNum < row.getLastCellNum();cellNum++) { + Cell cell = row.getCell(cellNum); + String fmtCellValue = formatter.formatCellValue(cell); + + System.out.println("Cell: " + fmtCellValue); + assertNotNull(fmtCellValue); + assertFalse(fmtCellValue.equals("0")); + } + } + } + + wb.close(); + } }