Browse Source

#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
tags/REL_3_13_FINAL
Nick Burch 9 years ago
parent
commit
c82aaba62c

+ 11
- 0
src/java/org/apache/poi/hssf/record/cf/Threshold.java View File

@@ -73,6 +73,14 @@ public final class Threshold {
}
public void setType(byte 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) {
this.type = (byte)type;
@@ -86,6 +94,9 @@ public final class Threshold {
}
public void setParsedExpression(Ptg[] ptgs) {
formula = Formula.create(ptgs);
if (ptgs.length > 0) {
this.value = null;
}
}

public Double getValue() {

+ 3
- 4
src/testcases/org/apache/poi/ss/usermodel/BaseTestConditionalFormatting.java View File

@@ -555,11 +555,11 @@ public abstract class BaseTestConditionalFormatting extends TestCase {
assertEquals("Values", s.getRow(0).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();
int numCF = 3;
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());
int fCF = 0, fCF12 = 0, fCFEX = 0;
@@ -982,8 +982,7 @@ public abstract class BaseTestConditionalFormatting extends TestCase {
assertEquals(BorderFormatting.BORDER_HAIR, r1fp.getBorderRight());
}
// TODO Fix this test to work for HSSF
public void DISABLEDtestCreateIconFormatting() {
public void testCreateIconFormatting() {
Workbook workbook = _testDataProvider.createWorkbook();
Sheet sheet = workbook.createSheet();

Loading…
Cancel
Save