Search in sources :

Example 91 with WTextField

use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.

the class ExpressionBuilder_Test method testBuildEquals.

@Test
public void testBuildEquals() {
    builder.equals(new WTextField(), "1");
    Assert.assertEquals("Incorrect condition", "WTextField=\"1\"", builder.build().toString());
}
Also used : WTextField(com.github.bordertech.wcomponents.WTextField) Test(org.junit.Test)

Example 92 with WTextField

use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.

the class ExpressionBuilder_Test method testTwoArgOrCondition.

@Test
public void testTwoArgOrCondition() {
    builder.equals(new WTextField(), "1").or().equals(new WTextArea(), "2");
    Assert.assertEquals("Incorrect condition", "(WTextField=\"1\" or WTextArea=\"2\")", builder.build().toString());
}
Also used : WTextArea(com.github.bordertech.wcomponents.WTextArea) WTextField(com.github.bordertech.wcomponents.WTextField) Test(org.junit.Test)

Example 93 with WTextField

use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.

the class ExpressionBuilder_Test method testTwoArgAndCondition.

@Test
public void testTwoArgAndCondition() {
    builder.equals(new WTextField(), "1").and().equals(new WTextArea(), "2");
    Assert.assertEquals("Incorrect condition", "(WTextField=\"1\" and WTextArea=\"2\")", builder.build().toString());
}
Also used : WTextArea(com.github.bordertech.wcomponents.WTextArea) WTextField(com.github.bordertech.wcomponents.WTextField) Test(org.junit.Test)

Example 94 with WTextField

use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.

the class ExpressionBuilder_Test method testOrOperatorPrecedenceBoth.

/**
 * Tests for correct operator precedence when there are ANDs on both sides of the OR: a || b
 * {@literal &}{@literal &} c || d.
 */
@Test
public void testOrOperatorPrecedenceBoth() {
    builder.equals(new WTextField(), "1").or().equals(new WTextArea(), "2").and().equals(new WDropdown(), "3").or().equals(new WMultiSelect(), "4");
    Assert.assertEquals("Incorrect condition", "(WTextField=\"1\" or ((WTextArea=\"2\" and WDropdown=\"3\") or WMultiSelect=\"4\"))", builder.build().toString());
}
Also used : WTextArea(com.github.bordertech.wcomponents.WTextArea) WDropdown(com.github.bordertech.wcomponents.WDropdown) WTextField(com.github.bordertech.wcomponents.WTextField) WMultiSelect(com.github.bordertech.wcomponents.WMultiSelect) Test(org.junit.Test)

Example 95 with WTextField

use of com.github.bordertech.wcomponents.WTextField in project wcomponents by BorderTech.

the class GroupExpression_Test method testBuildOr.

@Test
public void testBuildOr() {
    GroupExpression expr = new GroupExpression(GroupExpression.Type.OR);
    BooleanExpression operand1 = new CompareExpression(CompareType.EQUAL, new WTextField(), "1");
    BooleanExpression operand2 = new CompareExpression(CompareType.EQUAL, new WTextField(), "2");
    BooleanExpression operand3 = new CompareExpression(CompareType.EQUAL, new WTextField(), "3");
    expr.add(operand1);
    expr.add(operand2);
    expr.add(operand3);
    Or condition = (Or) expr.build();
    Assert.assertEquals("Incorrect 1st operand for OR", operand1.build().toString(), condition.getConditions().get(0).toString());
    Assert.assertEquals("Incorrect 2nd operand for OR", operand2.build().toString(), condition.getConditions().get(1).toString());
    Assert.assertEquals("Incorrect 3rd operand for OR", operand3.build().toString(), condition.getConditions().get(2).toString());
}
Also used : Or(com.github.bordertech.wcomponents.subordinate.Or) WTextField(com.github.bordertech.wcomponents.WTextField) Test(org.junit.Test)

Aggregations

WTextField (com.github.bordertech.wcomponents.WTextField)117 Test (org.junit.Test)90 SubordinateTarget (com.github.bordertech.wcomponents.SubordinateTarget)21 WCheckBox (com.github.bordertech.wcomponents.WCheckBox)21 WContainer (com.github.bordertech.wcomponents.WContainer)21 Equal (com.github.bordertech.wcomponents.subordinate.Equal)16 GreaterThanOrEqual (com.github.bordertech.wcomponents.subordinate.GreaterThanOrEqual)15 LessThanOrEqual (com.github.bordertech.wcomponents.subordinate.LessThanOrEqual)15 NotEqual (com.github.bordertech.wcomponents.subordinate.NotEqual)15 Rule (com.github.bordertech.wcomponents.subordinate.Rule)15 WSubordinateControl (com.github.bordertech.wcomponents.subordinate.WSubordinateControl)15 SubordinateTrigger (com.github.bordertech.wcomponents.SubordinateTrigger)14 WTextArea (com.github.bordertech.wcomponents.WTextArea)14 WComponentGroup (com.github.bordertech.wcomponents.WComponentGroup)12 WDropdown (com.github.bordertech.wcomponents.WDropdown)12 WButton (com.github.bordertech.wcomponents.WButton)11 WFieldLayout (com.github.bordertech.wcomponents.WFieldLayout)11 WHeading (com.github.bordertech.wcomponents.WHeading)10 WLabel (com.github.bordertech.wcomponents.WLabel)10 Hide (com.github.bordertech.wcomponents.subordinate.Hide)10