]> source.dussan.org Git - poi.git/commitdiff
Add reproducer for bug 57074
authorDominik Stadler <centic@apache.org>
Wed, 7 Jan 2015 14:13:34 +0000 (14:13 +0000)
committerDominik Stadler <centic@apache.org>
Wed, 7 Jan 2015 14:13:34 +0000 (14:13 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1650059 13f79535-47bb-0310-9956-ffa450edef68

src/testcases/org/apache/poi/hssf/usermodel/TestUnfixedBugs.java
test-data/spreadsheet/57074.xls [new file with mode: 0644]

index b6a535347a2c6b910eb32e0e26c0b4e54b51f712..26155456600fb72e62fabf8cdddde1dd250c630b 100644 (file)
@@ -17,6 +17,8 @@
 
 package org.apache.poi.hssf.usermodel;
 
+import static org.junit.Assert.assertEquals;
+
 import java.io.IOException;
 
 import junit.framework.AssertionFailedError;
@@ -24,10 +26,12 @@ import junit.framework.TestCase;
 
 import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.record.RecordFormatException;
+import org.apache.poi.hssf.util.HSSFColor;
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
+import org.junit.Test;
 
 /**
  * @author aviks
@@ -122,4 +126,22 @@ public final class TestUnfixedBugs extends TestCase {
             }
         }
     }
+
+    @Test
+    public void testBug57074() {
+        Workbook wb = HSSFTestDataSamples.openSampleWorkbook("57074.xls");
+        Sheet sheet = wb.getSheet("Sheet1");
+        Row row = sheet.getRow(0);
+        Cell cell = row.getCell(0);
+        
+        HSSFColor bgColor = (HSSFColor) cell.getCellStyle().getFillBackgroundColorColor();
+        String bgColorStr = bgColor.getTriplet()[0]+", "+bgColor.getTriplet()[1]+", "+bgColor.getTriplet()[2];
+        //System.out.println(bgColorStr);
+        assertEquals("215, 228, 188", bgColorStr);
+
+        HSSFColor fontColor = (HSSFColor) cell.getCellStyle().getFillForegroundColorColor();
+        String fontColorStr = fontColor.getTriplet()[0]+", "+fontColor.getTriplet()[1]+", "+fontColor.getTriplet()[2];
+        //System.out.println(fontColorStr);
+        assertEquals("0, 128, 128", fontColorStr);
+    }
 }
diff --git a/test-data/spreadsheet/57074.xls b/test-data/spreadsheet/57074.xls
new file mode 100644 (file)
index 0000000..c29485a
Binary files /dev/null and b/test-data/spreadsheet/57074.xls differ