pjfanning commented on code in PR #682: URL: https://github.com/apache/poi/pull/682#discussion_r1733154710
########## poi-ooxml/src/test/java/org/apache/poi/ss/tests/util/TestXSSFCellUtil.java: ########## @@ -90,6 +127,42 @@ public void testSetForegroundColorCellStylePropertyToNull() throws IOException, } @Test + public void testSetForegroundColorCellStylePropertiesToNullByEnum() throws IOException, DecoderException { + + try (Workbook workbook = new XSSFWorkbook()) { + + final Sheet sheet = workbook.createSheet("Sheet"); + final Row row = sheet.createRow(0); + final Cell cell = row.createCell(0); + final XSSFColor color = new XSSFColor(Hex.decodeHex("FF0000")); + + { + final Map<CellPropertyType, Object> properties = new LinkedHashMap<>(); + + properties.put(CellPropertyType.FILL_FOREGROUND_COLOR_COLOR, color); + properties.put(CellPropertyType.FILL_PATTERN, FillPatternType.SOLID_FOREGROUND); + + CellUtil.setCellStylePropertiesEnum(cell, properties); + } + assertEquals(color, cell.getCellStyle().getFillForegroundColorColor()); + assertEquals(FillPatternType.SOLID_FOREGROUND, cell.getCellStyle().getFillPattern()); + + { + final Map<CellPropertyType, Object> properties = new LinkedHashMap<>(); + + properties.put(CellPropertyType.FILL_FOREGROUND_COLOR_COLOR, null); + properties.put(CellPropertyType.FILL_PATTERN, FillPatternType.NO_FILL); + + CellUtil.setCellStylePropertiesEnum(cell, properties); + } + assertNull(cell.getCellStyle().getFillForegroundColorColor()); + assertEquals(IndexedColors.AUTOMATIC.getIndex(), cell.getCellStyle().getFillForegroundColor()); + assertEquals(FillPatternType.NO_FILL, cell.getCellStyle().getFillPattern()); + } + } + + @Test + @Deprecated Review Comment: don't deprecate tests - deprecate src/main methods - but not 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