TestXSSFCellStyle fixed after StylesTable initialization stuff

git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@645257 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Paolo Mottadelli 2008-04-06 16:17:45 +00:00
parent 2a1ee1eee3
commit 0ef4251247
2 changed files with 11 additions and 6 deletions

View File

@ -25,6 +25,9 @@ public class XSSFColor {
public XSSFColor(CTColor color) { public XSSFColor(CTColor color) {
this.color = color; this.color = color;
if (this.color == null) {
this.color = CTColor.Factory.newInstance();
}
} }
public boolean isAuto() { public boolean isAuto() {

View File

@ -59,26 +59,28 @@ public class TestXSSFCellStyle extends TestCase {
ctBorderA = CTBorder.Factory.newInstance(); ctBorderA = CTBorder.Factory.newInstance();
XSSFCellBorder borderA = new XSSFCellBorder(ctBorderA); XSSFCellBorder borderA = new XSSFCellBorder(ctBorderA);
long borderId = stylesTable.putBorder(borderA); long borderId = stylesTable.putBorder(borderA);
assertEquals(0, borderId); assertEquals(1, borderId);
XSSFCellBorder borderB = new XSSFCellBorder(); XSSFCellBorder borderB = new XSSFCellBorder();
assertEquals(1, stylesTable.putBorder(borderB)); assertEquals(2, stylesTable.putBorder(borderB));
ctFill = CTFill.Factory.newInstance(); ctFill = CTFill.Factory.newInstance();
XSSFCellFill fill = new XSSFCellFill(ctFill); XSSFCellFill fill = new XSSFCellFill(ctFill);
long fillId = stylesTable.putFill(fill); long fillId = stylesTable.putFill(fill);
assertEquals(0, fillId); assertEquals(1, fillId);
ctFont = CTFont.Factory.newInstance(); ctFont = CTFont.Factory.newInstance();
XSSFFont font = new XSSFFont(ctFont); XSSFFont font = new XSSFFont(ctFont);
long fontId = stylesTable.putFont(font); long fontId = stylesTable.putFont(font);
assertEquals(0, fontId); assertEquals(1, fontId);
cellStyleXf = ctStylesheet.addNewCellStyleXfs().addNewXf(); cellStyleXf = ctStylesheet.addNewCellStyleXfs().addNewXf();
cellStyleXf.setBorderId(0); cellStyleXf.setBorderId(1);
cellStyleXf.setFillId(1);
cellStyleXf.setFontId(1);
cellXfs = ctStylesheet.addNewCellXfs(); cellXfs = ctStylesheet.addNewCellXfs();
cellXf = cellXfs.addNewXf(); cellXf = cellXfs.addNewXf();
cellXf.setXfId(0); cellXf.setXfId(1);
cellStyle = new XSSFCellStyle(cellXf, cellStyleXf, stylesTable); cellStyle = new XSSFCellStyle(cellXf, cellStyleXf, stylesTable);
} }