use of com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap in project sldeditor by robward-scisys.
the class FieldConfigColourMapTest method testSetEnabled.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#internal_setEnabled(boolean)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#isEnabled()}.
*/
@Test
public void testSetEnabled() {
FieldConfigColourMap field = new FieldConfigColourMap(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
// 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());
}
use of com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap in project sldeditor by robward-scisys.
the class FieldConfigColourMapTest method testGenerateExpression.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#generateExpression()}.
* Test method for
* {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#populateExpression(java.lang.Object, org.opengis.filter.expression.Expression)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#populateField(org.geotools.styling.ColorMap)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#setTestValue(com.sldeditor.ui.detail.config.FieldId, org.geotools.styling.ColorMap)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#getColourMap()}.
*/
@Test
public void testGenerateExpression() {
FieldConfigColourMap field = new FieldConfigColourMap(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
ColorMap testValue = null;
field.populate(null);
field.setTestValue(FieldIdEnum.UNKNOWN, testValue);
field.populateField(testValue);
field.createUI();
ColorMap expectedValue1 = new ColorMapImpl();
field.populateField(expectedValue1);
assertEquals(expectedValue1, field.getColourMap());
FilterFactory ff = CommonFactoryFinder.getFilterFactory();
ColorMap expectedValue2 = new ColorMapImpl();
ColorMapEntryImpl entry = new ColorMapEntryImpl();
entry.setColor(ff.literal("#001122"));
expectedValue2.addColorMapEntry(entry);
field.setTestValue(FieldIdEnum.UNKNOWN, expectedValue2);
assertEquals(expectedValue2.getColorMapEntries().length, field.getColourMap().getColorMapEntries().length);
field.populateExpression((String) null);
}
use of com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap in project sldeditor by robward-scisys.
the class FieldConfigColourMapTest method testRevertToDefaultValue.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#revertToDefaultValue()}.
*/
@Test
public void testRevertToDefaultValue() {
FieldConfigColourMap field = new FieldConfigColourMap(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
field.revertToDefaultValue();
assertNull(field.getColourMap());
field.createUI();
field.revertToDefaultValue();
assertNotNull(field.getColourMap());
assertTrue(field.getColourMap().getColorMapEntries().length == 0);
}
use of com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap in project sldeditor by robward-scisys.
the class FieldConfigColourMapTest method testGetStringValue.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#getStringValue()}.
*/
@Test
public void testGetStringValue() {
FilterFactory ff = CommonFactoryFinder.getFilterFactory();
ColorMapEntryImpl entry1 = new ColorMapEntryImpl();
entry1.setColor(ff.literal("#001122"));
entry1.setLabel("testlabel");
entry1.setOpacity(ff.literal(0.42));
entry1.setQuantity(ff.literal(42));
ColorMap expectedValue = new ColorMapImpl();
expectedValue.addColorMapEntry(entry1);
ColorMapEntryImpl entry2 = new ColorMapEntryImpl();
entry2.setColor(ff.literal("#551122"));
entry2.setLabel("testlabel2");
entry2.setOpacity(ff.literal(0.22));
entry2.setQuantity(ff.literal(12));
expectedValue.addColorMapEntry(entry2);
FieldConfigColourMap field = new FieldConfigColourMap(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
field.populateField(expectedValue);
assertTrue(field.getStringValue().compareTo(EncodeColourMap.encode(expectedValue)) == 0);
}
use of com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap in project sldeditor by robward-scisys.
the class FieldConfigColourMapTest method testAttributeSelection.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.colourmap.FieldConfigColourMap#attributeSelection(java.lang.String)}.
*/
@Test
public void testAttributeSelection() {
FieldConfigColourMap field = new FieldConfigColourMap(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", true));
field.attributeSelection(null);
// Does nothing
}
Aggregations