aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2020-12-30 21:40:12 +0000
committerDominik Stadler <centic@apache.org>2020-12-30 21:40:12 +0000
commitb231366fb699414386fc14b59a8194b1ad1f20d3 (patch)
treee484998efbfd21ca17841dea8b95da2a129f87ec /src/ooxml
parent99dc9ea7f305fb05c868af8e1ae366ff5c7c6802 (diff)
downloadpoi-b231366fb699414386fc14b59a8194b1ad1f20d3.tar.gz
poi-b231366fb699414386fc14b59a8194b1ad1f20d3.zip
Bug 64986: Support missing or blank match_type for function Match
Excel and LibreOffice use the default value in this case git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1884959 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml')
-rw-r--r--src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
index f19190e852..5476e28688 100644
--- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
+++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
@@ -119,7 +119,6 @@ import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;
-import org.junit.jupiter.params.provider.ValueSource;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCalcCell;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCols;
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDefinedName;
@@ -3638,4 +3637,28 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
}
}
}
+
+ @Test
+ public void test64986() throws IOException {
+ XSSFWorkbook w = new XSSFWorkbook();
+ XSSFSheet s = w.createSheet();
+ XSSFRow r = s.createRow(0);
+ XSSFCell c = r.createCell(0);
+ c.setCellFormula("MATCH(\"VAL\",B1:B11,)");
+
+ FormulaEvaluator evaluator = w.getCreationHelper().createFormulaEvaluator();
+ CellValue value = evaluator.evaluate(c);
+ assertEquals(CellType.ERROR, value.getCellType());
+ assertEquals(ErrorEval.NA.getErrorCode(), value.getErrorValue());
+
+ // put a value in place so the match should find something
+ Cell val = r.createCell(1);
+ val.setCellValue("VAL");
+
+ // clear and check that now we find a match
+ evaluator.clearAllCachedResultValues();
+ value = evaluator.evaluate(c);
+ assertEquals(CellType.NUMERIC, value.getCellType());
+ assertEquals(1, value.getNumberValue(), 0.01);
+ }
}