IDEMPIERE-4881 CSS style anomaly - display logic (#786)
Fix regression (empty expression evaluation) introduce by previous patch. Pushing this through as the previous change set introduce a significant regression.
This commit is contained in:
parent
0ce2bde958
commit
2975ff6429
|
@ -138,6 +138,8 @@ public class EvaluationVisitor extends SimpleBooleanBaseVisitor<Object> {
|
|||
private Boolean isEqual(SimpleBooleanParser.ComparatorExpressionContext ctx) {
|
||||
Comparable left = asComparable(ctx.left);
|
||||
Comparable right = asComparable(ctx.right);
|
||||
if (left == null && right == null)
|
||||
return Boolean.TRUE;
|
||||
if (left == null || right == null)
|
||||
return Boolean.FALSE;
|
||||
if (left instanceof String && right instanceof String && !(ctx.right.getText().startsWith("'") && !(ctx.right.getText().startsWith("\"")))) {
|
||||
|
|
|
@ -543,6 +543,28 @@ public class LogicExpressionTest extends AbstractTestCase {
|
|||
assertTrue(LogicEvaluator.evaluateLogic(evaluatee, expr));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyStringExpression() {
|
||||
String expr = "@ColumnSQL@=''";
|
||||
Env.setContext(Env.getCtx(), "ColumnSQL", (String)null);
|
||||
assertTrue(LegacyLogicEvaluator.evaluateLogic(evaluatee, expr));
|
||||
|
||||
Env.setContext(Env.getCtx(), "ColumnSQL", (String)null);
|
||||
assertTrue(LogicEvaluator.evaluateLogic(evaluatee, expr));
|
||||
|
||||
expr = "@ColumnSQL@!''";
|
||||
|
||||
Env.setContext(Env.getCtx(), "ColumnSQL", (String)null);
|
||||
assertFalse(LegacyLogicEvaluator.evaluateLogic(evaluatee, expr));
|
||||
Env.setContext(Env.getCtx(), "ColumnSQL", "now()");
|
||||
assertTrue(LegacyLogicEvaluator.evaluateLogic(evaluatee, expr));
|
||||
|
||||
Env.setContext(Env.getCtx(), "ColumnSQL", (String)null);
|
||||
assertFalse(LogicEvaluator.evaluateLogic(evaluatee, expr));
|
||||
Env.setContext(Env.getCtx(), "ColumnSQL", "now()");
|
||||
assertTrue(LogicEvaluator.evaluateLogic(evaluatee, expr));
|
||||
}
|
||||
|
||||
private static class ContextEvaluatee implements Evaluatee {
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue