Search in sources :

Example 16 with WLabel

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

the class LessThan_Test method testToString.

@Test
public void testToString() {
    MyTrigger trigger = new MyTrigger();
    LessThan compare = new LessThan(trigger, "1");
    Assert.assertEquals("Incorrect toString for compare", "MyTrigger<\"1\"", compare.toString());
    WLabel label = new WLabel("test label", trigger);
    Assert.assertEquals("Incorrect toString for compare with a label", label.getText() + "<\"1\"", compare.toString());
}
Also used : WLabel(com.github.bordertech.wcomponents.WLabel) Test(org.junit.Test)

Example 17 with WLabel

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

the class Mandatory_Test method testToString.

@Test
public void testToString() {
    MyTarget target = new MyTarget();
    Mandatory action = new Mandatory(target);
    Assert.assertEquals("Incorrect toString for action", "set MyTarget mandatory", action.toString());
    WLabel label = new WLabel("test label", target);
    Assert.assertEquals("Incorrect toString for action with a label", "set " + label.getText() + " mandatory", action.toString());
}
Also used : WLabel(com.github.bordertech.wcomponents.WLabel) Test(org.junit.Test)

Example 18 with WLabel

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

the class Match_Test method testToString.

@Test
public void testToString() {
    MyTrigger trigger = new MyTrigger();
    Match compare = new Match(trigger, "1");
    Assert.assertEquals("Incorrect toString for compare", "MyTrigger matches \"1\"", compare.toString());
    WLabel label = new WLabel("test label", trigger);
    Assert.assertEquals("Incorrect toString for compare with a label", label.getText() + " matches \"1\"", compare.toString());
}
Also used : WLabel(com.github.bordertech.wcomponents.WLabel) Test(org.junit.Test)

Example 19 with WLabel

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

the class NotEqual_Test method testToString.

@Test
public void testToString() {
    MyTrigger trigger = new MyTrigger();
    NotEqual compare = new NotEqual(trigger, "1");
    Assert.assertEquals("Incorrect toString for compare", "MyTrigger!=\"1\"", compare.toString());
    WLabel label = new WLabel("test label", trigger);
    Assert.assertEquals("Incorrect toString for compare with a label", label.getText() + "!=\"1\"", compare.toString());
}
Also used : WLabel(com.github.bordertech.wcomponents.WLabel) Test(org.junit.Test)

Example 20 with WLabel

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

the class CompareExpression_Test method testToString.

@Test
public void testToString() {
    SubordinateTrigger trigger = new WTextField();
    String value = "test";
    // Equal
    CompareExpression expr = new CompareExpression(CompareType.EQUAL, trigger, value);
    Assert.assertEquals("Incorrect toString for equals compare", "WTextField=\"test\"", expr.toString());
    // NotEqual
    expr = new CompareExpression(CompareType.NOT_EQUAL, trigger, value);
    Assert.assertEquals("Incorrect toString for not equals compare", "WTextField!=\"test\"", expr.toString());
    // LessThan
    expr = new CompareExpression(CompareType.LESS_THAN, trigger, value);
    Assert.assertEquals("Incorrect toString for less than compare", "WTextField<\"test\"", expr.toString());
    // LessThanOrEqual
    expr = new CompareExpression(CompareType.LESS_THAN_OR_EQUAL, trigger, value);
    Assert.assertEquals("Incorrect toString for less than or equal compare", "WTextField<=\"test\"", expr.toString());
    // GreaterThan
    expr = new CompareExpression(CompareType.GREATER_THAN, trigger, value);
    Assert.assertEquals("Incorrect toString for greater than compare", "WTextField>\"test\"", expr.toString());
    // GreaterThanOrEqual
    expr = new CompareExpression(CompareType.GREATER_THAN_OR_EQUAL, trigger, value);
    Assert.assertEquals("Incorrect toString for greater thanor equal compare", "WTextField>=\"test\"", expr.toString());
    // Match
    expr = new CompareExpression(CompareType.MATCH, trigger, value);
    Assert.assertEquals("Incorrect toString for match compare", "WTextField matches \"test\"", expr.toString());
    // Test when a label is associated with the field
    expr = new CompareExpression(CompareType.EQUAL, trigger, value);
    new WLabel("My test field", trigger);
    Assert.assertEquals("Incorrect toString for equals compare with label", "My test field=\"test\"", expr.toString());
}
Also used : SubordinateTrigger(com.github.bordertech.wcomponents.SubordinateTrigger) WTextField(com.github.bordertech.wcomponents.WTextField) WLabel(com.github.bordertech.wcomponents.WLabel) Test(org.junit.Test)

Aggregations

WLabel (com.github.bordertech.wcomponents.WLabel)99 Test (org.junit.Test)57 WHeading (com.github.bordertech.wcomponents.WHeading)13 WTextField (com.github.bordertech.wcomponents.WTextField)10 WButton (com.github.bordertech.wcomponents.WButton)9 ExplanatoryText (com.github.bordertech.wcomponents.examples.common.ExplanatoryText)9 WComponent (com.github.bordertech.wcomponents.WComponent)8 WRadioButtonSelect (com.github.bordertech.wcomponents.WRadioButtonSelect)8 WPanel (com.github.bordertech.wcomponents.WPanel)7 UIContext (com.github.bordertech.wcomponents.UIContext)6 WCheckBoxSelect (com.github.bordertech.wcomponents.WCheckBoxSelect)6 SubordinateTarget (com.github.bordertech.wcomponents.SubordinateTarget)5 UIContextImpl (com.github.bordertech.wcomponents.UIContextImpl)5 WAjaxControl (com.github.bordertech.wcomponents.WAjaxControl)5 WComponentGroup (com.github.bordertech.wcomponents.WComponentGroup)5 WFieldLayout (com.github.bordertech.wcomponents.WFieldLayout)5 Action (com.github.bordertech.wcomponents.Action)4 ActionEvent (com.github.bordertech.wcomponents.ActionEvent)4 WApplication (com.github.bordertech.wcomponents.WApplication)4 WContainer (com.github.bordertech.wcomponents.WContainer)4