]> source.dussan.org Git - poi.git/commitdiff
Fix the themes test for the complex workbook
authorNick Burch <nick@apache.org>
Sun, 9 Aug 2015 12:36:57 +0000 (12:36 +0000)
committerNick Burch <nick@apache.org>
Sun, 9 Aug 2015 12:36:57 +0000 (12:36 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1694883 13f79535-47bb-0310-9956-ffa450edef68

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

index 2a2e78d2360ba0e306cea5209bb07f5a7dbd590a..fde748815a28c2d69155590e39d1555923085419 100644 (file)
@@ -58,7 +58,7 @@ public class TestThemesTable {
             "f79646", // Accent6\r
             "0000ff", // Hlink\r
             "800080"  // FolHlink\r
-        };\r
+    };\r
 \r
     @Test\r
     public void testThemesTableColors() throws Exception {\r
@@ -75,9 +75,8 @@ public class TestThemesTable {
         Map<String,XSSFWorkbook> workbooks = new LinkedHashMap<String, XSSFWorkbook>();\r
         workbooks.put(testFileSimple, simple);\r
         workbooks.put("Re-Saved_" + testFileSimple, simpleRS);\r
-        // TODO Fix these to work!\r
-//        workbooks.put(testFileComplex, complex);\r
-//        workbooks.put("Re-Saved_" + testFileComplex, complexRS);\r
+        workbooks.put(testFileComplex, complex);\r
+        workbooks.put("Re-Saved_" + testFileComplex, complexRS);\r
         \r
         // Sanity check\r
         assertEquals(rgbExpected.length, rgbExpected.length);\r
@@ -100,8 +99,9 @@ public class TestThemesTable {
                 XSSFCell cell = row.getCell(0);\r
                 assertNotNull(\r
                         "Missing cell " + ref + " in " + whatWorkbook, cell);\r
-                \r
-                ThemeElement themeElem = ThemeElement.byId(rn-startRN);\r
+\r
+                int expectedThemeIdx = rn-startRN;\r
+                ThemeElement themeElem = ThemeElement.byId(expectedThemeIdx);\r
                 assertEquals(\r
                         "Wrong theme at " + ref + " in " + whatWorkbook,\r
                         themeElem.name.toLowerCase(), cell.getStringCellValue());\r
@@ -120,9 +120,7 @@ public class TestThemesTable {
                 // Check the RGB part (no tint)\r
                 assertEquals(\r
                         "Wrong theme colour " + themeElem.name + " on " + whatWorkbook,\r
-                        rgbExpected[rn], Hex.encodeHexString(color.getRGB()));\r
-                // Check the Theme ID\r
-                int expectedThemeIdx = rn - startRN;\r
+                        rgbExpected[expectedThemeIdx], Hex.encodeHexString(color.getRGB()));\r
                 long themeIdx = font.getCTFont().getColorArray(0).getTheme();\r
                 assertEquals(\r
                         "Wrong theme index " + expectedThemeIdx + " on " + whatWorkbook,\r