use of com.sldeditor.ui.detail.config.transform.FieldConfigTransformation in project sldeditor by robward-scisys.
the class FieldConfigTransformationTest method testAttributeSelection.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.transform.FieldConfigTransformation#attributeSelection(java.lang.String)}.
*/
@Test
public void testAttributeSelection() {
boolean valueOnly = true;
FieldConfigTransformation field = new FieldConfigTransformation(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), "edit", "clear");
field.attributeSelection("field");
// Does nothing
}
use of com.sldeditor.ui.detail.config.transform.FieldConfigTransformation in project sldeditor by robward-scisys.
the class FieldConfigTransformationTest method testSetEnabled.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.transform.FieldConfigTransformation#internal_setEnabled(boolean)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.transform.FieldConfigTransformation#isEnabled()}. Test
* method for
* {@link com.sldeditor.ui.detail.config.transform.FieldConfigTransformation#createUI()}.
*/
@Test
public void testSetEnabled() {
// Value only, no attribute/expression dropdown
boolean valueOnly = true;
FieldConfigTransformation field = new FieldConfigTransformation(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), "edit", "clear");
// 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;
FieldConfigTransformation field2 = new FieldConfigTransformation(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), "edit", "clear");
// Text field will not have been created
expectedValue = true;
field2.internal_setEnabled(expectedValue);
assertFalse(field2.isEnabled());
// Create text field
field2.createUI();
field2.createUI();
assertEquals(expectedValue, field2.isEnabled());
expectedValue = false;
field2.internal_setEnabled(expectedValue);
// Actual value is coming from the attribute panel, not the text field
assertEquals(expectedValue, field2.isEnabled());
}
use of com.sldeditor.ui.detail.config.transform.FieldConfigTransformation in project sldeditor by robward-scisys.
the class FieldConfigTransformationTest method testRevertToDefaultValue.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.transform.FieldConfigTransformation#revertToDefaultValue()}.
* Test method for
* {@link com.sldeditor.ui.detail.config.transform.FieldConfigTransformation#setDefaultValue(java.lang.String)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.transform.FieldConfigTransformation#getStringValue()}.
*/
@Test
public void testRevertToDefaultValue() {
boolean valueOnly = true;
FieldConfigTransformation field = new FieldConfigTransformation(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), "edit", "clear");
String expectedDefaultValue = "default value";
field.setDefaultValue(expectedDefaultValue);
field.revertToDefaultValue();
assertNull(field.getStringValue());
field.createUI();
field.revertToDefaultValue();
assertTrue(expectedDefaultValue.compareTo(field.getStringValue()) == 0);
}
use of com.sldeditor.ui.detail.config.transform.FieldConfigTransformation in project sldeditor by robward-scisys.
the class FieldConfigTransformationTest method testUndoAction.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.transform.FieldConfigTransformation#undoAction(com.sldeditor.common.undo.UndoInterface)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.transform.FieldConfigTransformation#redoAction(com.sldeditor.common.undo.UndoInterface)}.
*/
@Test
public void testUndoAction() {
boolean valueOnly = true;
FieldConfigTransformation field = new FieldConfigTransformation(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), "edit", "clear");
field.undoAction(null);
field.redoAction(null);
field.createUI();
field.undoAction(null);
field.redoAction(null);
String expectedTestValue = "test value";
field.setTestValue(FieldIdEnum.UNKNOWN, expectedTestValue);
assertTrue(expectedTestValue.compareTo(field.getStringValue()) == 0);
String expectedUndoTestValue = "undo value";
String expectedRedoTestValue = "redo value";
UndoEvent undoEvent = new UndoEvent(null, FieldIdEnum.UNKNOWN, expectedUndoTestValue, expectedRedoTestValue);
field.undoAction(undoEvent);
assertTrue(expectedUndoTestValue.compareTo(field.getStringValue()) == 0);
field.redoAction(undoEvent);
assertTrue(expectedRedoTestValue.compareTo(field.getStringValue()) == 0);
// Increase code coverage status
undoEvent = new UndoEvent(null, FieldIdEnum.UNKNOWN, Integer.valueOf(0), Double.valueOf(10.0));
field.undoAction(undoEvent);
field.redoAction(undoEvent);
}
Aggregations