]> source.dussan.org Git - poi.git/commitdiff
Complete theme colour tests
authorNick Burch <nick@apache.org>
Sun, 9 Aug 2015 14:15:00 +0000 (14:15 +0000)
committerNick Burch <nick@apache.org>
Sun, 9 Aug 2015 14:15:00 +0000 (14:15 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1694892 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/xssf/model/TestThemesTable.java

index e322f098f218e94e472fab67d63ad6a495b31397..fb430d17d45bde331eccc9567737f3f1dde26e26 100644 (file)
@@ -150,6 +150,8 @@ public class TestThemesTable {
      * Column C = Explicit Colour Foreground\r
      * Column E = Explicit Colour Background, Black Foreground\r
      * Column G = Conditional Formatting Backgrounds\r
+     * \r
+     * Note - Grey Row has an odd way of doing the styling... \r
      */\r
     @Test\r
     public void themedAndNonThemedColours() {\r
@@ -160,6 +162,10 @@ public class TestThemesTable {
         XSSFCell cell;\r
         \r
         String[] names = {"White","Black","Grey","Dark Blue","Blue","Red","Green"};\r
+        String[] explicitFHexes = { "FFFFFFFF", "FF000000", "FFC0C0C0", "FF002060",\r
+                                    "FF0070C0", "FFFF0000", "FF00B050" };\r
+        String[] explicitBHexes = { "FFFFFFFF", "FF000000", "FFC0C0C0", "FF002060",\r
+                                    "FF0000FF", "FFFF0000", "FF00FF00" };\r
         assertEquals(7, names.length);\r
         \r
         // Check the non-CF colours in Columns A, B, C and E\r
@@ -178,23 +184,50 @@ public class TestThemesTable {
             assertCellContents(names[idx], row.getCell(2));\r
             assertCellContents(names[idx], row.getCell(4));\r
             \r
+            \r
             // Check the colours\r
+            \r
             //  A: Theme Based, Foreground\r
             style = themeCell.getCellStyle();\r
             color = style.getFont().getXSSFColor();\r
             assertEquals(true, color.isThemed());\r
             assertEquals(idx, color.getTheme());\r
             assertEquals(rgbExpected[idx], Hex.encodeHexString(color.getRGB()));\r
+            \r
             //  B: Theme Based, Foreground\r
             cell = row.getCell(1);\r
             style = cell.getCellStyle();\r
             color = style.getFont().getXSSFColor();\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
+            } else {\r
+                assertEquals(1, color.getTheme());\r
+                assertEquals(0.50, color.getTint(), 0.001);\r
             }\r
+            \r
+            //  C: Explicit, Foreground\r
+            cell = row.getCell(2);\r
+            style = cell.getCellStyle();\r
+            color = style.getFont().getXSSFColor();\r
+            assertEquals(false, color.isThemed());\r
+            assertEquals(explicitFHexes[idx], color.getARGBHex());\r
+            \r
+            // E: Explicit Background, Foreground all Black\r
+            cell = row.getCell(4);\r
+            style = cell.getCellStyle();\r
+            \r
+            color = style.getFont().getXSSFColor();\r
+            assertEquals(true, color.isThemed());\r
+            assertEquals("FF000000", color.getARGBHex());\r
+            \r
+            color = style.getFillForegroundXSSFColor();\r
+            assertEquals(false, color.isThemed());\r
+            assertEquals(explicitBHexes[idx], color.getARGBHex());\r
+            color = style.getFillBackgroundColorColor();\r
+            assertEquals(false, color.isThemed());\r
+            assertEquals(null, color.getARGBHex());\r
         }\r
         \r
         // Check the CF colours\r