From a7bb2f21d5d576cd8f2713b0ffc8114f1f06a729 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Sun, 9 Aug 2015 13:30:35 +0000 Subject: [PATCH] Get theme and non-theme rows consistent in the test file git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1694889 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/xssf/model/TestThemesTable.java | 37 ++++++++---------- test-data/spreadsheet/Themes2.xls | Bin 24064 -> 23552 bytes test-data/spreadsheet/Themes2.xlsx | Bin 9775 -> 9719 bytes 3 files changed, 17 insertions(+), 20 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 d572aa623e..e322f098f2 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/model/TestThemesTable.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/model/TestThemesTable.java @@ -150,7 +150,6 @@ public class TestThemesTable { * Column C = Explicit Colour Foreground * Column E = Explicit Colour Background, Black Foreground * Column G = Conditional Formatting Backgrounds - * (Row 4 = White by Lt2) */ @Test public void themedAndNonThemedColours() { @@ -158,26 +157,23 @@ public class TestThemesTable { XSSFSheet sheet = wb.getSheetAt(0); XSSFCellStyle style; XSSFColor color; + XSSFCell cell; - String[] names = {"Black","White","Grey","Blue","Red","Green"}; - int[] themes = {1,0,2,3,4,5}; - assertEquals(names.length, themes.length); + String[] names = {"White","Black","Grey","Dark Blue","Blue","Red","Green"}; + assertEquals(7, names.length); // Check the non-CF colours in Columns A, B, C and E - for (int rn=2; rn<8; rn++) { - int idx = rn-2; + for (int rn=1; rn<8; rn++) { + int idx = rn-1; XSSFRow row = sheet.getRow(rn); assertNotNull("Missing row " + rn, row); - // Theme cells aren't quite in the same order... + // Theme cells come first XSSFCell themeCell = row.getCell(0); - if (idx == 1) themeCell = sheet.getRow(idx).getCell(0); - if (idx >= 2) themeCell = sheet.getRow(idx+1).getCell(0); + ThemeElement themeElem = ThemeElement.byId(idx); + assertCellContents(themeElem.name, themeCell); // Sanity check names - int themeIdx = themes[idx]; - ThemeElement themeElem = ThemeElement.byId(themeIdx); - assertCellContents(themeElem.name, themeCell); assertCellContents(names[idx], row.getCell(1)); assertCellContents(names[idx], row.getCell(2)); assertCellContents(names[idx], row.getCell(4)); @@ -187,16 +183,17 @@ public class TestThemesTable { style = themeCell.getCellStyle(); color = style.getFont().getXSSFColor(); assertEquals(true, color.isThemed()); - assertEquals(themeIdx, color.getTheme()); - assertEquals(rgbExpected[themeIdx], Hex.encodeHexString(color.getRGB())); + assertEquals(idx, color.getTheme()); + assertEquals(rgbExpected[idx], Hex.encodeHexString(color.getRGB())); // B: Theme Based, Foreground - style = row.getCell(1).getCellStyle(); + cell = row.getCell(1); + style = cell.getCellStyle(); color = style.getFont().getXSSFColor(); - // TODO Fix this! - if (idx < 2) { - assertEquals(true, color.isThemed()); - assertEquals(themeIdx, color.getTheme()); - assertEquals(rgbExpected[themeIdx], Hex.encodeHexString(color.getRGB())); + 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())); } } diff --git a/test-data/spreadsheet/Themes2.xls b/test-data/spreadsheet/Themes2.xls index 7d36cab56065b3aba7f3a335875bfce32ddb2ca0..ce7606b407602e8e90644f4f8347dca1867eb470 100755 GIT binary patch delta 1894 zcma)7O>7%g5T3WYj=lb=z5ZLl}7eOwx2r7Ca zt&BJo8b~^Dp{)?8;(!v-vPGaOqTI@%LI@#oAtWGiB9L$Zp^DbbTko#z5+UBoZ|2Q> z^UeF-{0VUjJBrL)pe8D1-|eDKZJEQ=?k zSA|m}`b}wv!0y9>v+ZAV49`1dBO1fcZEwx;+3EE{pmr+uO9gI+xm9wk+4mqFxbPuq@d9tv0Dv*5);jm13BTMxY8uC?Z2xgMsjxbF5CCmzLZ9`baT z_irH{CzXFxHGnJR@FBgctw9*#nDnb#W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