use of com.sldeditor.ui.detail.config.symboltype.externalgraphic.ExternalGraphicDetails in project sldeditor by robward-scisys.
the class ExternalGraphicDetailsTest method testPopulateExpression.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.externalgraphic.ExternalGraphicDetails#populateExpression(java.lang.String)}.
*/
@Test
public void testPopulateExpression() {
DummyExternalGraphicUpdate callback = new DummyExternalGraphicUpdate();
ExternalGraphicDetails panel = new ExternalGraphicDetails(callback);
panel.populateExpression(null);
String expectedString = "test.png";
assertFalse(callback.isCalled());
panel.populateExpression(expectedString);
assertEquals(expectedString, panel.getExpression().toString());
assertTrue(callback.isCalled());
}
use of com.sldeditor.ui.detail.config.symboltype.externalgraphic.ExternalGraphicDetails in project sldeditor by robward-scisys.
the class ExternalGraphicDetailsTest method testSetValueExternalGraphicImpl.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.externalgraphic.ExternalGraphicDetails#setValue(org.geotools.styling.ExternalGraphicImpl)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.externalgraphic.ExternalGraphicDetails#getSymbol()}.
*/
@Test
public void testSetValueExternalGraphicImpl() {
StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory();
ExternalGraphicImpl externalGraphic = null;
DummyExternalGraphicUpdate callback = new DummyExternalGraphicUpdate();
ExternalGraphicDetails panel = new ExternalGraphicDetails(callback);
assertNull(panel.getSymbol());
panel.setValue(externalGraphic);
String expectedString = "a/b/c/test.png";
URL expectedURL = null;
try {
expectedURL = new File(expectedString).toURI().toURL();
externalGraphic = (ExternalGraphicImpl) styleFactory.createExternalGraphic(expectedURL, "image/png");
} catch (MalformedURLException e) {
e.printStackTrace();
fail();
}
assertFalse(callback.isCalled());
panel.setValue(externalGraphic);
ExternalGraphicImpl actual = (ExternalGraphicImpl) panel.getSymbol();
try {
assertEquals(expectedURL.toExternalForm(), actual.getLocation().toExternalForm());
} catch (MalformedURLException e) {
e.printStackTrace();
fail();
}
assertTrue(callback.isCalled());
expectedString = "http://example.com/test.png";
externalGraphic = (ExternalGraphicImpl) styleFactory.createExternalGraphic(expectedString, "image/png");
assertFalse(callback.isCalled());
panel.setValue(externalGraphic);
actual = (ExternalGraphicImpl) panel.getSymbol();
assertTrue(callback.isCalled());
try {
assertEquals(externalGraphic.getLocation().toExternalForm(), actual.getLocation().toExternalForm());
} catch (MalformedURLException e) {
e.printStackTrace();
fail();
}
}
use of com.sldeditor.ui.detail.config.symboltype.externalgraphic.ExternalGraphicDetails in project sldeditor by robward-scisys.
the class ExternalGraphicDetailsTest method testPopulate.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.externalgraphic.ExternalGraphicDetails#populate(com.sldeditor.common.data.SelectedSymbol)}.
*/
@Test
public void testPopulate() {
ExternalGraphicDetails panel = new ExternalGraphicDetails(null);
panel.populate(null);
}
use of com.sldeditor.ui.detail.config.symboltype.externalgraphic.ExternalGraphicDetails in project sldeditor by robward-scisys.
the class ExternalGraphicDetailsTest method testSetValueString.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.externalgraphic.ExternalGraphicDetails#setValue(java.lang.String)}.
*/
@Test
public void testSetValueString() {
DummyExternalGraphicUpdate callback = new DummyExternalGraphicUpdate();
ExternalGraphicDetails panel = new ExternalGraphicDetails(callback);
String expectedString = null;
panel.setValue(expectedString);
expectedString = "a/b/c/test.png";
assertFalse(callback.isCalled());
panel.setValue(expectedString);
assertTrue(callback.isCalled());
expectedString = "http://example.com/test.png";
assertFalse(callback.isCalled());
panel.setValue(expectedString);
assertTrue(callback.isCalled());
}
Aggregations