use of com.sldeditor.test.unit.datasource.impl.DummyInternalSLDFile3 in project sldeditor by robward-scisys.
the class RenderPanelImplTest method testVectorData.
/**
* Test method for {@link com.sldeditor.render.RenderPanelImpl#RenderPanelImpl()}.
*/
@Test
void testVectorData() {
RenderPanelImpl render = new RenderPanelImpl(false);
render.setSize(200, 200);
RenderPanelImpl.setUnderTest(false);
DummyInternalSLDFile3 testSLD = new DummyInternalSLDFile3();
DataSourceInterface dataSource = DataSourceFactory.getDataSource();
dataSource.connect("test", SLDEditorFile.getInstance(), CheckAttributeFactory.getCheckList());
SelectedSymbol.getInstance().setSld(testSLD.getSLD());
render.renderSymbol();
render.dataSourceLoaded(GeometryTypeEnum.POINT, false);
render.dataSourceLoaded(GeometryTypeEnum.POINT, false);
render.useAntiAliasUpdated(true);
assertNotNull(render.getRuleRenderOptions());
render.backgroundColourUpdate(null);
render.backgroundColourUpdate(Color.BLUE);
RenderPanelImpl.setUnderTest(true);
DataSourceFactory.reset();
SelectedSymbol.destroyInstance();
}
use of com.sldeditor.test.unit.datasource.impl.DummyInternalSLDFile3 in project sldeditor by robward-scisys.
the class MissingSLDAttributesTest method testCheckAttributes.
/**
* Test method for {@link
* com.sldeditor.datasource.checks.MissingSLDAttributes#checkAttributes(com.sldeditor.datasource.SLDEditorFileInterface)}.
*/
@Test
void testCheckAttributes() {
MissingSLDAttributes obj = new MissingSLDAttributes();
obj.checkAttributes(null);
DummyInternalSLDFile3 testSLD = new DummyInternalSLDFile3();
SLDDataInterface sldData = testSLD.getSLDData();
SLDEditorFile.destroyInstance();
SelectedSymbol.destroyInstance();
SelectedSymbol.getInstance().setSld(testSLD.getSLD());
SLDEditorFile editorFile = SLDEditorFile.getInstance();
Map<String, Object> propertyMap = new HashMap<String, Object>();
propertyMap.put("field1", "value1");
propertyMap.put("field2", "value2");
propertyMap.put("field3", "value3");
DataSourceConnectorInterface dsc = new DataSourceConnector();
DataSourceProperties dsp = new DataSourceProperties(dsc);
dsp.setPropertyMap(propertyMap);
List<DataSourceAttributeData> fieldList = new ArrayList<DataSourceAttributeData>();
fieldList.add(new DataSourceAttributeData("Field 1", String.class, null));
fieldList.add(new DataSourceAttributeData("Field 2", Double.class, null));
fieldList.add(new DataSourceAttributeData("Field 3", Double.class, null));
// Try when no fields have been specified
obj.checkAttributes(editorFile);
editorFile.setSLDData(sldData);
obj.checkAttributes(editorFile);
// Specify the field list
sldData.setFieldList(fieldList);
sldData.setDataSourceProperties(dsp);
editorFile.setDataSource(dsp);
obj.checkAttributes(editorFile);
// Tidy up
SLDEditorFile.destroyInstance();
SelectedSymbol.destroyInstance();
}
use of com.sldeditor.test.unit.datasource.impl.DummyInternalSLDFile3 in project sldeditor by robward-scisys.
the class BatchUpdateFontPanelTest method testPopulateUpdateFontSize.
/**
* Test method for {@link
* com.sldeditor.tool.batchupdatefont.BatchUpdateFontPanel#populate(java.util.List)}.
*/
@Test
void testPopulateUpdateFontSize() {
TestSLDEditorInterface app = new TestSLDEditorInterface();
TestBatchUpdateFontPanel testObj = new TestBatchUpdateFontPanel(app);
List<SLDDataInterface> sldDataList = new ArrayList<SLDDataInterface>();
DummyInternalSLDFile3 dummy = new DummyInternalSLDFile3();
sldDataList.add(dummy.getSLDData());
Double originalFontSize = getFontSize(dummy.getSLDData());
testObj.populate(sldDataList);
testObj.testSaveData();
assertNull(app.savedParent);
Double expectedFontSizeIncrease = 24.0;
StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory();
FilterFactory ff = CommonFactoryFinder.getFilterFactory();
String originalFontname = "Serif";
String originalFontStyle = "normal";
String originalFontWeight = "normal";
Font expectedFont = styleFactory.createFont(ff.literal(originalFontname), ff.literal(originalFontStyle), ff.literal(originalFontWeight), ff.literal(expectedFontSizeIncrease));
testObj.setUpdateFontSize(expectedFont);
testObj.testApplyData();
testObj.testSaveData();
Double actualFontSize = getFontSize(app.savedSldData);
Double expectedFontSize = originalFontSize + expectedFontSizeIncrease;
assertEquals(actualFontSize.doubleValue(), expectedFontSize.doubleValue());
}
use of com.sldeditor.test.unit.datasource.impl.DummyInternalSLDFile3 in project sldeditor by robward-scisys.
the class BatchUpdateFontPanelTest method testPopulateUpdateFontData.
/**
* Test method for {@link
* com.sldeditor.tool.batchupdatefont.BatchUpdateFontPanel#populate(java.util.List)}.
*/
@Test
void testPopulateUpdateFontData() {
TestSLDEditorInterface app = new TestSLDEditorInterface();
TestBatchUpdateFontPanel testObj = new TestBatchUpdateFontPanel(app);
List<SLDDataInterface> sldDataList = new ArrayList<SLDDataInterface>();
DummyInternalSLDFile3 dummy = new DummyInternalSLDFile3();
sldDataList.add(dummy.getSLDData());
testObj.populate(sldDataList);
testObj.testSaveData();
assertNull(app.savedParent);
Double expectedFontSizeIncrease = 24.0;
StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory();
FilterFactory ff = CommonFactoryFinder.getFilterFactory();
String[] families = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
String originalFontname = families[0];
String originalFontStyle = "normal";
String originalFontWeight = "normal";
Font expectedFont = styleFactory.createFont(ff.literal(originalFontname), ff.literal(originalFontStyle), ff.literal(originalFontWeight), ff.literal(expectedFontSizeIncrease));
testObj.setUpdateFont(expectedFont);
testObj.testApplyData();
testObj.testSaveData();
assertEquals(originalFontname, getFontName(app.savedSldData));
}
Aggregations