poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From one...@apache.org
Subject svn commit: r1742862 - /poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
Date Mon, 09 May 2016 01:27:31 GMT
Author: onealj
Date: Mon May  9 01:27:31 2016
New Revision: 1742862

URL: http://svn.apache.org/viewvc?rev=1742862&view=rev
Log:
add test case from Anders Ã…berg for bug 59442

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=1742862&r1=1742861&r2=1742862&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 Mon May
 9 01:27:31 2016
@@ -34,6 +34,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.Arrays;
 import java.util.Calendar;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -92,6 +93,7 @@ import org.apache.poi.ss.usermodel.Workb
 import org.apache.poi.ss.util.AreaReference;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.ss.util.CellReference;
+import org.apache.poi.ss.util.CellUtil;
 import org.apache.poi.util.LocaleUtil;
 import org.apache.poi.util.TempFile;
 import org.apache.poi.xssf.XLSBUnsupportedException;
@@ -3010,4 +3012,41 @@ public final class TestXSSFBugs extends
 
         workbook.close();
     }
+    
+    @Ignore("bug 59442")
+    @Test
+    public void testSetRGBBackgroundColor() throws IOException {
+
+        XSSFWorkbook workbook = new XSSFWorkbook();
+        XSSFCell cell = workbook.createSheet().createRow(0).createCell(0);
+
+        XSSFColor color = new XSSFColor(java.awt.Color.RED);
+        XSSFCellStyle style = workbook.createCellStyle();
+        style.setFillForegroundColor(color);
+        style.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND);
+        cell.setCellStyle(style);
+
+        // Everything is fine at this point, cell is red
+
+        Map<String, Object> properties = new HashMap<String, Object>();
+        properties.put(CellUtil.BORDER_BOTTOM, CellStyle.BORDER_THIN); //or BorderStyle.THIN
+        CellUtil.setCellStyleProperties(cell, properties);
+        
+        // Now the cell is all black
+        XSSFColor actual = cell.getCellStyle().getFillBackgroundColorColor();
+        assertNotNull(actual);
+        assertEquals(color.getARGBHex(), actual.getARGBHex());
+        
+        XSSFWorkbook nwb = XSSFTestDataSamples.writeOutAndReadBack(workbook);
+        workbook.close();
+        XSSFCell ncell = nwb.getSheetAt(0).getRow(0).getCell(0);
+        XSSFColor ncolor = new XSSFColor(java.awt.Color.RED);
+
+        // Now the cell is all black
+        XSSFColor nactual = ncell.getCellStyle().getFillBackgroundColorColor();
+        assertNotNull(nactual);
+        assertEquals(ncolor.getARGBHex(), nactual.getARGBHex());
+        
+        nwb.close();
+    }
 }



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


Mime
View raw message