use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.
the class FieldConfigFontPreviewTest method testUndoAction.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.font.FieldConfigFontPreview#undoAction(com.sldeditor.common.undo.UndoInterface)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.font.FieldConfigFontPreview#redoAction(com.sldeditor.common.undo.UndoInterface)}.
*/
@Test
public void testUndoAction() {
FieldConfigFontPreview field = new FieldConfigFontPreview(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", false));
field.undoAction(null);
field.redoAction(null);
// Does nothing
}
use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.
the class FieldConfigFontTest method testSetEnabled.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.font.FieldConfigFont#internal_setEnabled(boolean)}.
* Test method for {@link com.sldeditor.ui.detail.config.font.FieldConfigFont#isEnabled()}.
*/
@Test
public void testSetEnabled() {
// Value only, no attribute/expression dropdown
boolean valueOnly = true;
FieldConfigFont field = new FieldConfigFont(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();
field.createUI();
assertEquals(expectedValue, field.isEnabled());
expectedValue = false;
field.internal_setEnabled(expectedValue);
assertEquals(expectedValue, field.isEnabled());
// Has attribute/expression dropdown
valueOnly = false;
FieldConfigFont field2 = new FieldConfigFont(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly));
// Text field will not have been created
expectedValue = true;
field.internal_setEnabled(expectedValue);
assertFalse(field2.isEnabled());
// Create text field
field2.createUI();
assertEquals(expectedValue, field2.isEnabled());
expectedValue = false;
field.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.FieldConfigCommonData in project sldeditor by robward-scisys.
the class FieldConfigFontTest method testRevertToDefaultValue.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.font.FieldConfigFont#revertToDefaultValue()}. Test
* method for
* {@link com.sldeditor.ui.detail.config.font.FieldConfigFont#setDefaultValue(java.lang.String)}.
*/
@Test
public void testRevertToDefaultValue() {
boolean valueOnly = true;
FieldConfigFont field = new FieldConfigFont(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly));
field.revertToDefaultValue();
String actualValue = field.getStringValue();
assertNull(actualValue);
field.createUI();
String expectedDefaultValue = fontFamilies[2];
field.setDefaultValue(expectedDefaultValue);
field.revertToDefaultValue();
actualValue = field.getStringValue();
assertTrue(expectedDefaultValue.compareTo(actualValue) == 0);
}
use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.
the class FieldConfigInlineFeatureTest method testUndoAction.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.inlinefeature.FieldConfigInlineFeature#undoAction(com.sldeditor.common.undo.UndoInterface)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.inlinefeature.FieldConfigInlineFeature#redoAction(com.sldeditor.common.undo.UndoInterface)}.
*/
@Test
public void testUndoAction() {
FieldConfigInlineFeature field = new FieldConfigInlineFeature(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, null, true));
field.undoAction(null);
field.redoAction(null);
field.createUI();
DummyInlineSLDFile testData1 = new DummyInlineSLDFile();
UserLayer userLayer1 = (UserLayer) testData1.getSLD().layers().get(0);
field.populateField(userLayer1);
String expectedValue1 = InlineFeatureUtils.getInlineFeaturesText(userLayer1);
String actualValue = field.getStringValue();
assertTrue(actualValue.compareTo(expectedValue1) == 0);
DummyInlineSLDFile2 testData2 = new DummyInlineSLDFile2();
UserLayer userLayer2 = (UserLayer) testData2.getSLD().layers().get(0);
field.populateField(userLayer2);
String expectedValue2 = InlineFeatureUtils.getInlineFeaturesText(userLayer2);
actualValue = field.getStringValue();
assertTrue(actualValue.compareTo(expectedValue2) == 0);
UndoManager.getInstance().undo();
actualValue = field.getStringValue();
assertTrue(actualValue.compareTo(expectedValue1) == 0);
UndoManager.getInstance().redo();
actualValue = field.getStringValue();
assertTrue(actualValue.compareTo(expectedValue2) == 0);
// Increase the code coverage
field.undoAction(null);
field.undoAction(new UndoEvent(null, FieldIdEnum.NAME, Double.valueOf(42.0), Integer.valueOf(11)));
field.redoAction(null);
field.redoAction(new UndoEvent(null, FieldIdEnum.NAME, Double.valueOf(454.0), Integer.valueOf(69)));
}
use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.
the class FieldConfigInlineFeatureTest method testSetVisible.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.inlinefeature.FieldConfigInlineFeature#setVisible(boolean)}.
*/
@Test
public void testSetVisible() {
FieldConfigInlineFeature field = new FieldConfigInlineFeature(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, null, true));
boolean expectedValue = true;
field.setVisible(expectedValue);
field.createUI();
field.setVisible(expectedValue);
expectedValue = false;
field.setVisible(expectedValue);
}
Aggregations