aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2015-08-09 14:15:00 +0000
committerNick Burch <nick@apache.org>2015-08-09 14:15:00 +0000
commit19e8f76d906454cbbaca56417ee1ce324ad172dc (patch)
tree1c281ceffae860aa92d9b7ddcdfefe5de2c0fda9
parenta7bb2f21d5d576cd8f2713b0ffc8114f1f06a729 (diff)
downloadpoi-19e8f76d906454cbbaca56417ee1ce324ad172dc.tar.gz
poi-19e8f76d906454cbbaca56417ee1ce324ad172dc.zip
Complete theme colour tests
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1694892 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/ooxml/testcases/org/apache/poi/xssf/model/TestThemesTable.java35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/model/TestThemesTable.java b/src/ooxml/testcases/org/apache/poi/xssf/model/TestThemesTable.java
index e322f098f2..fb430d17d4 100644
--- a/src/ooxml/testcases/org/apache/poi/xssf/model/TestThemesTable.java
+++ b/src/ooxml/testcases/org/apache/poi/xssf/model/TestThemesTable.java
@@ -150,6 +150,8 @@ public class TestThemesTable {
* Column C = Explicit Colour Foreground
* Column E = Explicit Colour Background, Black Foreground
* Column G = Conditional Formatting Backgrounds
+ *
+ * Note - Grey Row has an odd way of doing the styling...
*/
@Test
public void themedAndNonThemedColours() {
@@ -160,6 +162,10 @@ public class TestThemesTable {
XSSFCell cell;
String[] names = {"White","Black","Grey","Dark Blue","Blue","Red","Green"};
+ String[] explicitFHexes = { "FFFFFFFF", "FF000000", "FFC0C0C0", "FF002060",
+ "FF0070C0", "FFFF0000", "FF00B050" };
+ String[] explicitBHexes = { "FFFFFFFF", "FF000000", "FFC0C0C0", "FF002060",
+ "FF0000FF", "FFFF0000", "FF00FF00" };
assertEquals(7, names.length);
// Check the non-CF colours in Columns A, B, C and E
@@ -178,23 +184,50 @@ public class TestThemesTable {
assertCellContents(names[idx], row.getCell(2));
assertCellContents(names[idx], row.getCell(4));
+
// Check the colours
+
// A: Theme Based, Foreground
style = themeCell.getCellStyle();
color = style.getFont().getXSSFColor();
assertEquals(true, color.isThemed());
assertEquals(idx, color.getTheme());
assertEquals(rgbExpected[idx], Hex.encodeHexString(color.getRGB()));
+
// B: Theme Based, Foreground
cell = row.getCell(1);
style = cell.getCellStyle();
color = style.getFont().getXSSFColor();
assertEquals(true, color.isThemed());
- // TODO Fix the grey theme color in Column B
if (idx != 2) {
assertEquals(idx, color.getTheme());
assertEquals(rgbExpected[idx], Hex.encodeHexString(color.getRGB()));
+ } else {
+ assertEquals(1, color.getTheme());
+ assertEquals(0.50, color.getTint(), 0.001);
}
+
+ // C: Explicit, Foreground
+ cell = row.getCell(2);
+ style = cell.getCellStyle();
+ color = style.getFont().getXSSFColor();
+ assertEquals(false, color.isThemed());
+ assertEquals(explicitFHexes[idx], color.getARGBHex());
+
+ // E: Explicit Background, Foreground all Black
+ cell = row.getCell(4);
+ style = cell.getCellStyle();
+
+ color = style.getFont().getXSSFColor();
+ assertEquals(true, color.isThemed());
+ assertEquals("FF000000", color.getARGBHex());
+
+ color = style.getFillForegroundXSSFColor();
+ assertEquals(false, color.isThemed());
+ assertEquals(explicitBHexes[idx], color.getARGBHex());
+ color = style.getFillBackgroundColorColor();
+ assertEquals(false, color.isThemed());
+ assertEquals(null, color.getARGBHex());
}
// Check the CF colours