use of com.sldeditor.ui.detail.config.sortby.FieldConfigSortBy in project sldeditor by robward-scisys.
the class FieldConfigSortByTest method testGenerateExpression.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigSortBy#generateExpression()}. Test method
* for
* {@link com.sldeditor.ui.detail.config.FieldConfigSortBy#populateExpression(java.lang.Object, org.opengis.filter.expression.Expression)}.
*/
@Test
public void testGenerateExpression() {
boolean valueOnly = true;
class TestFieldConfigSortBy extends FieldConfigSortBy {
public TestFieldConfigSortBy(FieldConfigCommonData commonData) {
super(commonData);
}
public Expression callGenerateExpression() {
return generateExpression();
}
}
TestFieldConfigSortBy field = new TestFieldConfigSortBy(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly));
Expression actualExpression = field.callGenerateExpression();
assertNull(actualExpression);
field.createUI();
String expectedValue = "test A, test2 D";
field.setTestValue(null, expectedValue);
actualExpression = field.callGenerateExpression();
assertTrue(expectedValue.compareTo(actualExpression.toString()) == 0);
expectedValue = "test A, test3 A";
field.populateExpression("test, test3 A");
actualExpression = field.callGenerateExpression();
assertTrue(expectedValue.compareTo(actualExpression.toString()) == 0);
expectedValue = "test A, test2 D, test3 D";
field.populateField(expectedValue);
field.sortByUpdated(expectedValue);
actualExpression = field.callGenerateExpression();
assertTrue(expectedValue.compareTo(actualExpression.toString()) == 0);
}
use of com.sldeditor.ui.detail.config.sortby.FieldConfigSortBy in project sldeditor by robward-scisys.
the class FieldConfigSortByTest method testAttributeSelection.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigSortBy#attributeSelection(java.lang.String)}.
*/
@Test
public void testAttributeSelection() {
boolean valueOnly = true;
FieldConfigSortBy field = new FieldConfigSortBy(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly));
field.attributeSelection("field");
// Does nothing
}
use of com.sldeditor.ui.detail.config.sortby.FieldConfigSortBy in project sldeditor by robward-scisys.
the class FieldConfigSortByTest method testSetEnabled.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigSortBy#internal_setEnabled(boolean)}. Test
* method for {@link com.sldeditor.ui.detail.config.FieldConfigSortBy#isEnabled()}. Test method
* for {@link com.sldeditor.ui.detail.config.FieldConfigSortBy#createUI(javax.swing.Box)}.
*/
@Test
public void testSetEnabled() {
// Value only, no attribute/expression dropdown
boolean valueOnly = true;
FieldConfigSortBy field = new FieldConfigSortBy(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly));
// Text field will not have been created
boolean expectedValue = true;
field.internal_setEnabled(expectedValue);
assertFalse(field.isEnabled());
// Create text field
field.createUI();
assertEquals(expectedValue, field.isEnabled());
expectedValue = false;
field.internal_setEnabled(expectedValue);
assertEquals(expectedValue, field.isEnabled());
// Has attribute/expression dropdown
valueOnly = false;
FieldConfigSortBy field2 = new FieldConfigSortBy(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly));
// Text field will not have been created
expectedValue = true;
field2.internal_setEnabled(expectedValue);
assertFalse(field2.isEnabled());
// Create text field
field2.createUI();
assertEquals(expectedValue, field2.isEnabled());
expectedValue = true;
field2.internal_setEnabled(expectedValue);
// Actual value is coming from the attribute panel, not the text field
assertEquals(expectedValue, field2.isEnabled());
}
Aggregations