#58130 Fix the icon formatting read/write CF test

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1691788 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2015-07-19 02:35:04 +00:00
parent 520a6fdf68
commit 22c2e794d6
2 changed files with 14 additions and 4 deletions

View File

@ -73,6 +73,14 @@ public final class Threshold {
} }
public void setType(byte type) { public void setType(byte type) {
this.type = type; this.type = type;
// Ensure the value presense / absense is consistent for the new type
if (type == RangeType.MIN.id || type == RangeType.MAX.id ||
type == RangeType.FORMULA.id) {
this.value = null;
} else if (value == null) {
this.value = 0d;
}
} }
public void setType(int type) { public void setType(int type) {
this.type = (byte)type; this.type = (byte)type;
@ -86,6 +94,9 @@ public final class Threshold {
} }
public void setParsedExpression(Ptg[] ptgs) { public void setParsedExpression(Ptg[] ptgs) {
formula = Formula.create(ptgs); formula = Formula.create(ptgs);
if (ptgs.length > 0) {
this.value = null;
}
} }
public Double getValue() { public Double getValue() {

View File

@ -555,11 +555,11 @@ public abstract class BaseTestConditionalFormatting extends TestCase {
assertEquals("Values", s.getRow(0).getCell(0).toString()); assertEquals("Values", s.getRow(0).getCell(0).toString());
assertEquals("10.0", s.getRow(2).getCell(0).toString()); assertEquals("10.0", s.getRow(2).getCell(0).toString());
// Check we found all the conditional formattings rules we should have // Check we found all the conditional formatting rules we should have
SheetConditionalFormatting sheetCF = s.getSheetConditionalFormatting(); SheetConditionalFormatting sheetCF = s.getSheetConditionalFormatting();
int numCF = 3; int numCF = 3;
int numCF12 = 15; int numCF12 = 15;
int numCFEX = 0; // TODO This should be 1, but we don't support CFEX formattings yet int numCFEX = 0; // TODO This should be 2, but we don't support CFEX formattings yet
assertEquals(numCF+numCF12+numCFEX, sheetCF.getNumConditionalFormattings()); assertEquals(numCF+numCF12+numCFEX, sheetCF.getNumConditionalFormattings());
int fCF = 0, fCF12 = 0, fCFEX = 0; int fCF = 0, fCF12 = 0, fCFEX = 0;
@ -982,8 +982,7 @@ public abstract class BaseTestConditionalFormatting extends TestCase {
assertEquals(BorderFormatting.BORDER_HAIR, r1fp.getBorderRight()); assertEquals(BorderFormatting.BORDER_HAIR, r1fp.getBorderRight());
} }
// TODO Fix this test to work for HSSF public void testCreateIconFormatting() {
public void DISABLEDtestCreateIconFormatting() {
Workbook workbook = _testDataProvider.createWorkbook(); Workbook workbook = _testDataProvider.createWorkbook();
Sheet sheet = workbook.createSheet(); Sheet sheet = workbook.createSheet();