git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@738188 13f79535-47bb-0310-9956-ffa450edef68tags/REL_3_5_BETA5
<!-- Don't forget to update status.xml too! --> | <!-- Don't forget to update status.xml too! --> | ||||
<release version="3.5-beta5" date="2008-??-??"> | <release version="3.5-beta5" date="2008-??-??"> | ||||
<action dev="POI-DEVELOPERS" type="fix">46613 - Fixed evaluator to perform case insensitive string comparisons</action> | |||||
<action dev="POI-DEVELOPERS" type="add">46544 - command line interface for hssf ExcelExtractor</action> | <action dev="POI-DEVELOPERS" type="add">46544 - command line interface for hssf ExcelExtractor</action> | ||||
<action dev="POI-DEVELOPERS" type="fix">46547 - Allow addition of conditional formatting after data validation</action> | <action dev="POI-DEVELOPERS" type="fix">46547 - Allow addition of conditional formatting after data validation</action> | ||||
<action dev="POI-DEVELOPERS" type="fix">46548 - Page Settings Block fixes - continued PLS records and PSB in sheet sub-streams</action> | <action dev="POI-DEVELOPERS" type="fix">46548 - Page Settings Block fixes - continued PLS records and PSB in sheet sub-streams</action> |
<!-- Don't forget to update changes.xml too! --> | <!-- Don't forget to update changes.xml too! --> | ||||
<changes> | <changes> | ||||
<release version="3.5-beta5" date="2008-??-??"> | <release version="3.5-beta5" date="2008-??-??"> | ||||
<action dev="POI-DEVELOPERS" type="fix">46613 - Fixed evaluator to perform case insensitive string comparisons</action> | |||||
<action dev="POI-DEVELOPERS" type="add">46544 - command line interface for hssf ExcelExtractor</action> | <action dev="POI-DEVELOPERS" type="add">46544 - command line interface for hssf ExcelExtractor</action> | ||||
<action dev="POI-DEVELOPERS" type="fix">46547 - Allow addition of conditional formatting after data validation</action> | <action dev="POI-DEVELOPERS" type="fix">46547 - Allow addition of conditional formatting after data validation</action> | ||||
<action dev="POI-DEVELOPERS" type="fix">46548 - Page Settings Block fixes - continued PLS records and PSB in sheet sub-streams</action> | <action dev="POI-DEVELOPERS" type="fix">46548 - Page Settings Block fixes - continued PLS records and PSB in sheet sub-streams</action> |
if (vb instanceof StringEval) { | if (vb instanceof StringEval) { | ||||
StringEval sA = (StringEval) va; | StringEval sA = (StringEval) va; | ||||
StringEval sB = (StringEval) vb; | StringEval sB = (StringEval) vb; | ||||
return sA.getStringValue().compareTo(sB.getStringValue()); | |||||
return sA.getStringValue().compareToIgnoreCase(sB.getStringValue()); | |||||
} | } | ||||
return 1; | return 1; | ||||
} | } |
import org.apache.poi.hssf.record.formula.functions.EvalFactory; | import org.apache.poi.hssf.record.formula.functions.EvalFactory; | ||||
/** | /** | ||||
* Test for unary plus operator evaluator. | |||||
* Test for {@link EqualEval} | |||||
* | * | ||||
* @author Josh Micich | * @author Josh Micich | ||||
*/ | */ | ||||
} | } | ||||
assertTrue(be.getBooleanValue()); | assertTrue(be.getBooleanValue()); | ||||
} | } | ||||
/** | |||||
* Test for bug 46613 (observable at svn r737248) | |||||
*/ | |||||
public void testStringInsensitive_bug46613() { | |||||
if (!evalStringCmp("abc", "aBc", EqualEval.instance)) { | |||||
throw new AssertionFailedError("Identified bug 46613"); | |||||
} | |||||
assertTrue(evalStringCmp("abc", "aBc", EqualEval.instance)); | |||||
assertTrue(evalStringCmp("ABC", "azz", LessThanEval.instance)); | |||||
assertTrue(evalStringCmp("abc", "AZZ", LessThanEval.instance)); | |||||
assertTrue(evalStringCmp("ABC", "aaa", GreaterThanEval.instance)); | |||||
assertTrue(evalStringCmp("abc", "AAA", GreaterThanEval.instance)); | |||||
} | |||||
private static boolean evalStringCmp(String a, String b, OperationEval cmpOp) { | |||||
Eval[] args = { | |||||
new StringEval(a), | |||||
new StringEval(b), | |||||
}; | |||||
Eval result = cmpOp.evaluate(args, 10, (short)20); | |||||
assertEquals(BoolEval.class, result.getClass()); | |||||
BoolEval be = (BoolEval) result; | |||||
return be.getBooleanValue(); | |||||
} | |||||
} | } |