You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ce...@apache.org on 2015/09/03 22:45:56 UTC

svn commit: r1701131 - in /poi/trunk: src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java test-data/spreadsheet/48962.xlsx test-data/spreadsheet/50755_workday_formula_example.xlsx

Author: centic
Date: Thu Sep  3 20:45:55 2015
New Revision: 1701131

URL: http://svn.apache.org/r1701131
Log:
Add unit tests which verify that the issues from bug 48962 and 50755 do not occur any more on the latest version

Added:
    poi/trunk/test-data/spreadsheet/48962.xlsx
    poi/trunk/test-data/spreadsheet/50755_workday_formula_example.xlsx
Modified:
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java?rev=1701131&r1=1701130&r2=1701131&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java Thu Sep  3 20:45:55 2015
@@ -29,6 +29,7 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.Arrays;
@@ -2529,4 +2530,45 @@ public final class TestXSSFBugs extends
         FormulaEvaluator eval = wb.getCreationHelper().createFormulaEvaluator();
         assertEquals(expectedResultOrNull, eval.evaluate(intF).formatAsString());
     }
+
+    @Test
+    public void test48962() {
+        Workbook wb = XSSFTestDataSamples.openSampleWorkbook("48962.xlsx");
+        Sheet sh = wb.getSheetAt(0);
+        Row row = sh.getRow(1);
+        Cell cell = row.getCell(0);
+        
+        CellStyle style = cell.getCellStyle();
+        assertNotNull(style);
+        
+        // color index
+        assertEquals(64, style.getFillBackgroundColor());
+        XSSFColor color = ((XSSFCellStyle)style).getFillBackgroundXSSFColor();
+        assertNotNull(color);
+        
+        // indexed color
+        assertEquals(64, color.getIndexed());
+        assertEquals(64, color.getIndex());
+        
+        // not an RGB color
+        assertFalse(color.isRGB());
+        assertNull(color.getRGB());        
+    }
+    
+    @Test
+    public void test50755_workday_formula_example() {
+        Workbook wb = XSSFTestDataSamples.openSampleWorkbook("50755_workday_formula_example.xlsx");
+        Sheet sheet = wb.getSheet("Sheet1");
+        for(Row aRow : sheet) {
+            Cell cell = aRow.getCell(1);
+            if(cell.getCellType() == Cell.CELL_TYPE_FORMULA) {
+                String formula = cell.getCellFormula();
+                //System.out.println("formula: " + formula);
+                assertNotNull(formula);
+                assertTrue(formula.contains("WORKDAY"));
+            } else {
+                assertNotNull(cell.toString());
+            }
+        }
+    }
 }

Added: poi/trunk/test-data/spreadsheet/48962.xlsx
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/48962.xlsx?rev=1701131&view=auto
==============================================================================
Binary files poi/trunk/test-data/spreadsheet/48962.xlsx (added) and poi/trunk/test-data/spreadsheet/48962.xlsx Thu Sep  3 20:45:55 2015 differ

Added: poi/trunk/test-data/spreadsheet/50755_workday_formula_example.xlsx
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/50755_workday_formula_example.xlsx?rev=1701131&view=auto
==============================================================================
Binary files poi/trunk/test-data/spreadsheet/50755_workday_formula_example.xlsx (added) and poi/trunk/test-data/spreadsheet/50755_workday_formula_example.xlsx Thu Sep  3 20:45:55 2015 differ



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org