https://bz.apache.org/bugzilla/show_bug.cgi?id=69366

--- Comment #3 from fjyoyd89f...@mail.ru ---
I got some results. New tests
    @Test
    public void testBug69366ColorSameCell() throws IOException {
        try (Workbook workbook = new XSSFWorkbook()) {
            final Sheet sheet = workbook.createSheet("Sheet");
            final Row row = sheet.createRow(0);
            final Cell cell = row.createCell(0);
            Map<CellPropertyType, Object> properties = new LinkedHashMap<>();
            properties.put(CellPropertyType.FILL_FOREGROUND_COLOR, null);
            CellUtil.setCellStylePropertiesEnum(cell, properties);

            int numStyles = workbook.getNumCellStyles();
            CellUtil.setCellStylePropertiesEnum(cell, properties);

            assertEquals(numStyles, workbook.getNumCellStyles());
        }
    }

    @Test
    public void testBug69366ColorDiffCell() throws IOException {
        try (Workbook workbook = new XSSFWorkbook()) {
            final Sheet sheet = workbook.createSheet("Sheet");
            final Row row = sheet.createRow(0);
            final Cell cell1 = row.createCell(0);
            final Cell cell2 = row.createCell(1);
            Map<CellPropertyType, Object> properties = new LinkedHashMap<>();
            properties.put(CellPropertyType.FILL_FOREGROUND_COLOR, null);
            CellUtil.setCellStylePropertiesEnum(cell1, properties);

            int numStyles = workbook.getNumCellStyles();
            CellUtil.setCellStylePropertiesEnum(cell2, properties);

            assertEquals(numStyles, workbook.getNumCellStyles());
        }
    }

    @Test
    public void testBug69366ColorColorSameCell() 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("FFAAAA"));
            Map<CellPropertyType, Object> properties = new LinkedHashMap<>();
            properties.put(CellPropertyType.FILL_FOREGROUND_COLOR_COLOR,
color);
            CellUtil.setCellStylePropertiesEnum(cell, properties);

            int numStyles = workbook.getNumCellStyles();
            CellUtil.setCellStylePropertiesEnum(cell, properties);

            assertEquals(numStyles, workbook.getNumCellStyles());
        }
    }

    @Test
    public void testBug69366ColorColorDiffCell() throws IOException,
DecoderException {
        try (Workbook workbook = new XSSFWorkbook()) {
            final Sheet sheet = workbook.createSheet("Sheet");
            final Row row = sheet.createRow(0);
            final Cell cell1 = row.createCell(0);
            final Cell cell2 = row.createCell(1);
            final XSSFColor color = new XSSFColor(Hex.decodeHex("FFAAAA"));
            Map<CellPropertyType, Object> properties = new LinkedHashMap<>();
            properties.put(CellPropertyType.FILL_FOREGROUND_COLOR_COLOR,
color);
            CellUtil.setCellStylePropertiesEnum(cell1, properties);

            int numStyles = workbook.getNumCellStyles();
            CellUtil.setCellStylePropertiesEnum(cell2, properties);

            assertEquals(numStyles, workbook.getNumCellStyles());
        }
    }

The first and the second both don't pass test. The third pass and the fourth
fail. Obviously this all applies to background color too.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to