* Column C = Explicit Colour Foreground\r
* Column E = Explicit Colour Background, Black Foreground\r
* Column G = Conditional Formatting Backgrounds\r
- * (Row 4 = White by Lt2)\r
*/\r
@Test\r
public void themedAndNonThemedColours() {\r
XSSFSheet sheet = wb.getSheetAt(0);\r
XSSFCellStyle style;\r
XSSFColor color;\r
+ XSSFCell cell;\r
\r
- String[] names = {"Black","White","Grey","Blue","Red","Green"};\r
- int[] themes = {1,0,2,3,4,5};\r
- assertEquals(names.length, themes.length);\r
+ String[] names = {"White","Black","Grey","Dark Blue","Blue","Red","Green"};\r
+ assertEquals(7, names.length);\r
\r
// Check the non-CF colours in Columns A, B, C and E\r
- for (int rn=2; rn<8; rn++) {\r
- int idx = rn-2;\r
+ for (int rn=1; rn<8; rn++) {\r
+ int idx = rn-1;\r
XSSFRow row = sheet.getRow(rn);\r
assertNotNull("Missing row " + rn, row);\r
\r
- // Theme cells aren't quite in the same order...\r
+ // Theme cells come first\r
XSSFCell themeCell = row.getCell(0);\r
- if (idx == 1) themeCell = sheet.getRow(idx).getCell(0);\r
- if (idx >= 2) themeCell = sheet.getRow(idx+1).getCell(0);\r
+ ThemeElement themeElem = ThemeElement.byId(idx);\r
+ assertCellContents(themeElem.name, themeCell);\r
\r
// Sanity check names\r
- int themeIdx = themes[idx];\r
- ThemeElement themeElem = ThemeElement.byId(themeIdx);\r
- assertCellContents(themeElem.name, themeCell);\r
assertCellContents(names[idx], row.getCell(1));\r
assertCellContents(names[idx], row.getCell(2));\r
assertCellContents(names[idx], row.getCell(4));\r
style = themeCell.getCellStyle();\r
color = style.getFont().getXSSFColor();\r
assertEquals(true, color.isThemed());\r
- assertEquals(themeIdx, color.getTheme());\r
- assertEquals(rgbExpected[themeIdx], Hex.encodeHexString(color.getRGB()));\r
+ assertEquals(idx, color.getTheme());\r
+ assertEquals(rgbExpected[idx], Hex.encodeHexString(color.getRGB()));\r
// B: Theme Based, Foreground\r
- style = row.getCell(1).getCellStyle();\r
+ cell = row.getCell(1);\r
+ style = cell.getCellStyle();\r
color = style.getFont().getXSSFColor();\r
- // TODO Fix this!\r
- if (idx < 2) {\r
- assertEquals(true, color.isThemed());\r
- assertEquals(themeIdx, color.getTheme());\r
- assertEquals(rgbExpected[themeIdx], Hex.encodeHexString(color.getRGB()));\r
+ assertEquals(true, color.isThemed());\r
+ // TODO Fix the grey theme color in Column B\r
+ if (idx != 2) {\r
+ assertEquals(idx, color.getTheme());\r
+ assertEquals(rgbExpected[idx], Hex.encodeHexString(color.getRGB()));\r
}\r
}\r
\r