use of com.sldeditor.test.unit.datasource.impl.DummyInlineSLDFile2 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)));
}
Aggregations