From: Nick Burch Date: Fri, 20 May 2011 20:46:55 +0000 (+0000) Subject: Test that shows that bug #51222 is a themes colour problem X-Git-Tag: REL_3_8_BETA3~14 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=668f479cf61ebfcd74f88f3cc467e9c9ee41623a;p=poi.git Test that shows that bug #51222 is a themes colour problem git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1125559 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java index fca1643653..05365a8dba 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java @@ -1173,4 +1173,45 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues { // Complex file // TODO } + + /** + * Colours and styles when the list has gaps in it + */ + public void test51222() throws Exception { + XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("51222.xlsx"); + XSSFSheet s = wb.getSheetAt(0); + + XSSFCell cA4_EEECE1 = s.getRow(3).getCell(0); + XSSFCell cA5_1F497D = s.getRow(4).getCell(0); + + // Check the text + assertEquals("A4", cA4_EEECE1.getRichStringCellValue().getString()); + assertEquals("A5", cA5_1F497D.getRichStringCellValue().getString()); + + // Check the styles assigned to them + assertEquals(4, cA4_EEECE1.getCTCell().getS()); + assertEquals(5, cA5_1F497D.getCTCell().getS()); + + // Check we look up the correct style + assertEquals(4, cA4_EEECE1.getCellStyle().getIndex()); + assertEquals(5, cA5_1F497D.getCellStyle().getIndex()); + + // Check the fills on them at the low level + assertEquals(5, cA4_EEECE1.getCellStyle().getCoreXf().getFillId()); + assertEquals(6, cA5_1F497D.getCellStyle().getCoreXf().getFillId()); + + // These should reference themes 2 and 3 + assertEquals(2, wb.getStylesSource().getFillAt(5).getCTFill().getPatternFill().getFgColor().getTheme()); + assertEquals(3, wb.getStylesSource().getFillAt(6).getCTFill().getPatternFill().getFgColor().getTheme()); + + // Ensure we get the right colours for these themes + // TODO fix +// assertEquals("FFEEECE1", wb.getTheme().getThemeColor(2).getARGBHex()); +// assertEquals("FF1F497D", wb.getTheme().getThemeColor(3).getARGBHex()); + + // Finally check the colours on the styles + // TODO fix +// assertEquals("FFEEECE1", cA4_EEECE1.getCellStyle().getFillForegroundXSSFColor().getARGBHex()); +// assertEquals("FF1F497D", cA5_1F497D.getCellStyle().getFillForegroundXSSFColor().getARGBHex()); + } } diff --git a/test-data/spreadsheet/51222.xlsx b/test-data/spreadsheet/51222.xlsx new file mode 100644 index 0000000000..562154caf8 Binary files /dev/null and b/test-data/spreadsheet/51222.xlsx differ