use of com.sldeditor.ui.legend.option.LegendOptionData in project sldeditor by robward-scisys.
the class LegendManagerTest method testUpdateLegendOptionData.
@Test
public void testUpdateLegendOptionData() {
StyledLayerDescriptor sld = testSLD1();
String heading = "Test Heading";
LegendOptionData legendOption = new LegendOptionData();
legendOption.setBackgroundColour(Color.CYAN);
legendOption.setBorder(true);
legendOption.setBandInformation(true);
legendOption.setBorderColour(Color.GREEN);
legendOption.setImageHeight(100);
legendOption.setImageWidth(100);
legendOption.setImageHeight(100);
legendOption.setShowLabels(true);
legendOption.setShowTitle(true);
LegendManager.getInstance().SLDLoaded(legendOption);
boolean actualResult = compareLegendImage(sld, heading);
assertTrue(actualResult);
}
use of com.sldeditor.ui.legend.option.LegendOptionData in project sldeditor by robward-scisys.
the class LegendOptionDataTest method testImageHeight.
/**
* Test method for {@link com.sldeditor.ui.legend.option.LegendOptionData#getImageHeight()}.
* Test method for {@link com.sldeditor.ui.legend.option.LegendOptionData#setImageHeight(int)}.
*/
@Test
public void testImageHeight() {
LegendOptionData data = new LegendOptionData();
int imageHeight = 21;
data.setImageHeight(imageHeight);
assertEquals(imageHeight, data.getImageHeight());
}
use of com.sldeditor.ui.legend.option.LegendOptionData in project sldeditor by robward-scisys.
the class LegendOptionDataTest method testEncodeXML.
/**
* Test method for {@link com.sldeditor.ui.legend.option.LegendOptionData#encodeXML(org.w3c.dom.Document, org.w3c.dom.Element, java.lang.String)}.
*/
@Test
public void testEncodeXML() {
LegendOptionData data = new LegendOptionData();
data.encodeXML(null, null, null);
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder;
try {
documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document doc = documentBuilder.newDocument();
Element root = doc.createElement("root");
doc.appendChild(root);
data.setBackgroundColour(Color.GREEN);
data.setBorder(true);
data.setDpi(320);
String elementName = "legend";
data.encodeXML(doc, root, elementName);
LegendOptionData newData = LegendOptionData.decodeXML(doc, elementName);
assertEquals(newData.getBackgroundColour(), data.getBackgroundColour());
assertEquals(newData.getDpi(), data.getDpi());
assertEquals(newData.isBorder(), data.isBorder());
} catch (ParserConfigurationException e) {
e.printStackTrace();
}
}
use of com.sldeditor.ui.legend.option.LegendOptionData in project sldeditor by robward-scisys.
the class LegendOptionDataTest method testLabelFont.
/**
* Test method for {@link com.sldeditor.ui.legend.option.LegendOptionData#getLabelFont()}.
* Test method for {@link com.sldeditor.ui.legend.option.LegendOptionData#setLabelFont(java.awt.Font)}.
*/
@Test
public void testLabelFont() {
LegendOptionData data = new LegendOptionData();
Font expectedFont = new Font(new JLabel().getFont().getName(), Font.BOLD, 24);
data.setLabelFont(expectedFont);
assertEquals(expectedFont, data.getLabelFont());
}
use of com.sldeditor.ui.legend.option.LegendOptionData in project sldeditor by robward-scisys.
the class LegendOptionDataTest method testBorderColour.
/**
* Test method for {@link com.sldeditor.ui.legend.option.LegendOptionData#getBorderColour()}.
* Test method for {@link com.sldeditor.ui.legend.option.LegendOptionData#setBorderColour(java.awt.Color)}.
*/
@Test
public void testBorderColour() {
LegendOptionData data = new LegendOptionData();
Color expectedColor = Color.LIGHT_GRAY;
data.setBorderColour(expectedColor);
assertEquals(expectedColor, data.getBorderColour());
}
Aggregations