View | Details | Raw Unified | Return to bug 60898
Collapse All | Expand All

(-)TestXSSFColor.java (+20 lines)
Lines 22-28 Link Here
22
import java.io.IOException;
22
import java.io.IOException;
23
23
24
import org.apache.poi.xssf.XSSFTestDataSamples;
24
import org.apache.poi.xssf.XSSFTestDataSamples;
25
import org.apache.poi.xssf.model.StylesTable;
25
import org.junit.Test;
26
import org.junit.Test;
27
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColors;
28
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRgbColor;
26
29
27
public final class TestXSSFColor {
30
public final class TestXSSFColor {
28
    
31
    
Lines 180-183 Link Here
180
      
183
      
181
      wb.close();
184
      wb.close();
182
   }
185
   }
186
   
187
   @Test
188
   public void testCustomIndexedColour() throws Exception {
189
		XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("wrong_color.xlsx");
190
		XSSFCell cell = wb.getSheetAt(1).getRow(0).getCell(0);
191
		XSSFColor color = cell.getCellStyle().getFillForegroundColorColor();
192
		CTColors ctColors = wb.getStylesSource().getCTStylesheet().getColors();
193
194
		CTRgbColor ctRgbColor = ctColors.getIndexedColors()
195
				.getRgbColorList()
196
				.get(color.getIndex());
197
198
		String hexRgb = ctRgbColor.getDomNode().getAttributes().getNamedItem("rgb").getNodeValue();
199
200
		assertEquals(hexRgb, color.getARGBHex());
201
	   
202
   }
183
}
203
}

Return to bug 60898