Add test which verifies that bug 61652 is not appearing any more on latest trunk

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1819769 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2018-01-01 14:39:08 +00:00
parent d4e89724c7
commit bc4eb140c5
2 changed files with 22 additions and 0 deletions

View File

@ -65,11 +65,14 @@ import org.apache.poi.openxml4j.util.ZipSecureFile;
import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.SpreadsheetVersion;
import org.apache.poi.ss.formula.ConditionalFormattingEvaluator;
import org.apache.poi.ss.formula.EvaluationConditionalFormatRule;
import org.apache.poi.ss.formula.FormulaParser;
import org.apache.poi.ss.formula.FormulaRenderer;
import org.apache.poi.ss.formula.FormulaShifter;
import org.apache.poi.ss.formula.FormulaType;
import org.apache.poi.ss.formula.WorkbookEvaluator;
import org.apache.poi.ss.formula.WorkbookEvaluatorProvider;
import org.apache.poi.ss.formula.eval.ErrorEval;
import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.functions.Function;
@ -3209,4 +3212,23 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
assertEquals(1, cellValue.getNumberValue(), 0.0001);
}
}
@Test
public void test61652() throws IOException {
try (Workbook wb = XSSFTestDataSamples.openSampleWorkbook("61652.xlsx")) {
Sheet sheet = wb.getSheet("IRPPCalc");
Row row = sheet.getRow(11);
Cell cell = row.getCell(18);
WorkbookEvaluatorProvider fe = (WorkbookEvaluatorProvider) wb.getCreationHelper().createFormulaEvaluator();
ConditionalFormattingEvaluator condfmt = new ConditionalFormattingEvaluator(wb, fe);
assertEquals("Conditional formatting is not triggered for this cell",
"[]", condfmt.getConditionalFormattingForCell(cell).toString());
// but we can read the conditional formatting itself
List<EvaluationConditionalFormatRule> rules = condfmt.getFormatRulesForSheet(sheet);
assertEquals(1, rules.size());
assertEquals("AND($A1>=EDATE($D$6,3),$B1>0)", rules.get(0).getFormula1());
}
}
}

Binary file not shown.