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
This commit is contained in:
Nick Burch 2011-05-20 20:46:55 +00:00
parent 3392d09375
commit 668f479cf6
2 changed files with 41 additions and 0 deletions

View File

@ -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());
}
}

Binary file not shown.