You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2021/08/07 10:45:18 UTC
svn commit: r1892065 -
/poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/atp/TestTextJoinFunction.java
Author: fanningpj
Date: Sat Aug 7 10:45:18 2021
New Revision: 1892065
URL: http://svn.apache.org/viewvc?rev=1892065&view=rev
Log:
fix TextJoin use case that was not handled
Modified:
poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/atp/TestTextJoinFunction.java
Modified: poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/atp/TestTextJoinFunction.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/atp/TestTextJoinFunction.java?rev=1892065&r1=1892064&r2=1892065&view=diff
==============================================================================
--- poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/atp/TestTextJoinFunction.java (original)
+++ poi/trunk/poi/src/test/java/org/apache/poi/ss/formula/atp/TestTextJoinFunction.java Sat Aug 7 10:45:18 2021
@@ -182,6 +182,18 @@ public class TestTextJoinFunction {
}
}
+ @Test
+ void testMicrosoftExample2() throws IOException {
+ try (HSSFWorkbook wb = initWorkbook2()) {
+ HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(wb);
+ HSSFCell cell = wb.getSheetAt(0).getRow(0).createCell(100);
+ confirmResult(fe, cell, "TEXTJOIN(\", \", TRUE, A2:B8)",
+ "a1, b1, a2, b2, a4, b4, a5, b5, a6, b6, a7, b7");
+ confirmResult(fe, cell, "TEXTJOIN(\", \", FALSE, A2:B8)",
+ "a1, b1, a2, b2, , , a4, b4, a5, b5, a6, b6, a7, b7");
+ }
+ }
+
private HSSFWorkbook initWorkbook1() {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet();
@@ -196,6 +208,18 @@ public class TestTextJoinFunction {
return wb;
}
+ private HSSFWorkbook initWorkbook2() {
+ HSSFWorkbook wb = new HSSFWorkbook();
+ HSSFSheet sheet = wb.createSheet();
+ addRow(sheet, 0, "Aâs", "Bâs");
+ for (int i = 1; i <= 7; i++) {
+ if (i != 3) {
+ addRow(sheet, i, "a" + i, "b" + i);
+ }
+ }
+ return wb;
+ }
+
private static void confirmResult(HSSFFormulaEvaluator fe, HSSFCell cell, String formulaText, String expectedResult) {
cell.setCellFormula(formulaText);
fe.notifyUpdateCell(cell);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org