pjfanning commented on code in PR #682: URL: https://github.com/apache/poi/pull/682#discussion_r1733273831
########## poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java: ########## @@ -2778,6 +2778,51 @@ void test59132() throws IOException { @Disabled("bug 59442") @Test + void testSetRGBBackgroundColorByEnum() throws IOException { + try (XSSFWorkbook workbook = new XSSFWorkbook()) { + XSSFCell cell = workbook.createSheet().createRow(0).createCell(0); + + XSSFColor color = new XSSFColor(java.awt.Color.RED, workbook.getStylesSource().getIndexedColors()); + XSSFCellStyle style = workbook.createCellStyle(); + style.setFillForegroundColor(color); + style.setFillPattern(FillPatternType.SOLID_FOREGROUND); + cell.setCellStyle(style); + + // Everything is fine at this point, cell is red + XSSFColor actual = cell.getCellStyle().getFillBackgroundColorColor(); + assertNull(actual); + actual = cell.getCellStyle().getFillForegroundColorColor(); + assertNotNull(actual); + assertEquals(color.getARGBHex(), actual.getARGBHex()); + + Map<CellPropertyType, Object> properties = new HashMap<>(); + properties.put(CellPropertyType.BORDER_BOTTOM, BorderStyle.THIN); + CellUtil.setCellStylePropertiesEnum(cell, properties); + + // Now the cell is all black + actual = cell.getCellStyle().getFillBackgroundColorColor(); + assertNotNull(actual); + assertNull(actual.getARGBHex()); + actual = cell.getCellStyle().getFillForegroundColorColor(); + assertNotNull(actual); + assertEquals(color.getARGBHex(), actual.getARGBHex()); + + try (XSSFWorkbook nwb = writeOutAndReadBack(workbook)) { + XSSFCell ncell = nwb.getSheetAt(0).getRow(0).getCell(0); + XSSFColor ncolor = new XSSFColor(java.awt.Color.RED, workbook.getStylesSource().getIndexedColors()); + + // Now the cell is all black + XSSFColor nactual = ncell.getCellStyle().getFillBackgroundColorColor(); + assertNotNull(nactual); + assertEquals(ncolor.getARGBHex(), nactual.getARGBHex()); + + } + } + } + + @Disabled("bug 59442") Review Comment: why are you disabling tests? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org