use of com.sldeditor.common.vendoroption.VersionData in project sldeditor by robward-scisys.
the class PrefManagerTest method testFinish.
/**
* Test method for {@link com.sldeditor.common.preferences.PrefManager#finish()}.
*/
@Test
public void testFinish() {
PrefManager.initialise(null);
PrefManager.getInstance().finish();
DummyPropertyManager propertyManager = new DummyPropertyManager();
PrefManager.initialise(propertyManager);
// Set up data as if it had been read in
PrefData prefData = new PrefData();
prefData.setUseAntiAlias(true);
Color backgroundColour = Color.GRAY;
prefData.setBackgroundColour(backgroundColour);
List<VersionData> vendorOptionList = new ArrayList<VersionData>();
vendorOptionList.add(VendorOptionManager.getInstance().getDefaultVendorOptionVersionData());
vendorOptionList.add(VersionData.getEarliestVersion(GeoServerVendorOption.class));
prefData.setVendorOptionVersionList(vendorOptionList);
String uiLayoutClass = "perfect curve";
prefData.setUiLayoutClass(uiLayoutClass);
String lastFolderViewed = "secret";
prefData.setLastFolderViewed(lastFolderViewed);
prefData.setLastViewedKey(PrefDataLastViewedEnum.FOLDER);
prefData.setSaveLastFolderView(true);
PrefManager.getInstance().setPrefData(prefData);
PrefManager.getInstance().finish();
// Try GeoServer as last item viewed
prefData.setLastViewedKey(PrefDataLastViewedEnum.GEOSERVER);
PrefManager.getInstance().setPrefData(prefData);
PrefManager.getInstance().finish();
}
use of com.sldeditor.common.vendoroption.VersionData in project sldeditor by robward-scisys.
the class SLDDataTest method testVendorOptionList.
/**
* Test vendor option list.
*/
@Test
public void testVendorOptionList() {
List<VersionData> vendorOptionList = new ArrayList<VersionData>();
vendorOptionList.add(VersionData.getLatestVersion(this.getClass()));
SLDData data = new SLDData(null, null);
data.setVendorOptionList(vendorOptionList);
assertEquals(vendorOptionList, data.getVendorOptionList());
}
use of com.sldeditor.common.vendoroption.VersionData in project sldeditor by robward-scisys.
the class PrefManagerTest method testUndoAction.
/**
* Test method for {@link com.sldeditor.common.preferences.PrefManager#undoAction(com.sldeditor.common.undo.UndoInterface)}. Test method for
* {@link com.sldeditor.common.preferences.PrefManager#redoAction(com.sldeditor.common.undo.UndoInterface)}.
*/
@Test
public void testUndoAction() {
PrefManager.initialise(null);
PrefManager.getInstance().finish();
DummyPropertyManager propertyManager = new DummyPropertyManager();
PrefManager.initialise(propertyManager);
// Set up data as if it had been read in
PrefData prefData = new PrefData();
prefData.setUseAntiAlias(true);
Color backgroundColour = Color.GRAY;
prefData.setBackgroundColour(backgroundColour);
List<VersionData> vendorOptionList = new ArrayList<VersionData>();
vendorOptionList.add(VendorOptionManager.getInstance().getDefaultVendorOptionVersionData());
vendorOptionList.add(VersionData.getEarliestVersion(GeoServerVendorOption.class));
prefData.setVendorOptionVersionList(vendorOptionList);
String uiLayoutClass = "perfect curve";
prefData.setUiLayoutClass(uiLayoutClass);
String lastFolderViewed = "secret";
prefData.setLastFolderViewed(lastFolderViewed);
prefData.setLastViewedKey(PrefDataLastViewedEnum.FOLDER);
prefData.setSaveLastFolderView(true);
PrefManager.getInstance().setPrefData(prefData);
PrefData copy = prefData.clone();
copy.setLastViewedKey(PrefDataLastViewedEnum.GEOSERVER);
PrefManager.getInstance().setPrefData(copy);
PrefData actual = PrefManager.getInstance().getPrefData();
assertEquals(PrefDataLastViewedEnum.GEOSERVER, actual.getLastViewedKey());
UndoManager.getInstance().undo();
actual = PrefManager.getInstance().getPrefData();
assertEquals(PrefDataLastViewedEnum.FOLDER, actual.getLastViewedKey());
UndoManager.getInstance().redo();
actual = PrefManager.getInstance().getPrefData();
assertEquals(PrefDataLastViewedEnum.GEOSERVER, actual.getLastViewedKey());
// Increase the code coverage
PrefManager.getInstance().undoAction(null);
PrefManager.getInstance().undoAction(new UndoEvent(null, FieldIdEnum.NAME, "", "new"));
PrefManager.getInstance().redoAction(null);
PrefManager.getInstance().redoAction(new UndoEvent(null, FieldIdEnum.NAME, "", "new"));
}
use of com.sldeditor.common.vendoroption.VersionData in project sldeditor by robward-scisys.
the class PrefManagerTest method testPrefData.
/**
* Test method for {@link com.sldeditor.common.preferences.PrefManager#useAntiAlias()}.
*/
@Test
public void testPrefData() {
PrefData prefData = new PrefData();
prefData.setUseAntiAlias(true);
Color backgroundColour = Color.GRAY;
prefData.setBackgroundColour(backgroundColour);
List<VersionData> vendorOptionList = new ArrayList<VersionData>();
vendorOptionList.add(VendorOptionManager.getInstance().getDefaultVendorOptionVersionData());
prefData.setVendorOptionVersionList(vendorOptionList);
String uiLayoutClass = "perfect curve";
prefData.setUiLayoutClass(uiLayoutClass);
PrefManager.getInstance().setPrefData(prefData);
assertEquals(backgroundColour, PrefManager.getInstance().getPrefData().getBackgroundColour());
assertEquals(uiLayoutClass, PrefManager.getInstance().getPrefData().getUiLayoutClass());
assertEquals(true, PrefManager.getInstance().getPrefData().isUseAntiAlias());
}
use of com.sldeditor.common.vendoroption.VersionData in project sldeditor by robward-scisys.
the class VendorOptionTableModelTest method testSetValueAtObjectIntInt.
/**
* Test method for
* {@link com.sldeditor.common.vendoroption.selection.VendorOptionTableModel#setValueAt(java.lang.Object, int, int)}.
* Test method for
* {@link com.sldeditor.common.vendoroption.selection.VendorOptionTableModel#setSelectedVersion(com.sldeditor.common.vendoroption.VersionData, int)}.
*/
@Test
public void testSetValueAtObjectIntInt() {
Map<VendorOptionTypeInterface, String> options = new LinkedHashMap<VendorOptionTypeInterface, String>();
VendorOptionTypeInterface vendorOption = VendorOptionManager.getInstance().getClass(GeoServerVendorOption.class);
options.put(vendorOption, vendorOption.getName());
VendorOptionTableModel model = new VendorOptionTableModel(options, null);
assertEquals(1, model.getRowCount());
VersionData latest = VersionData.getLatestVersion(GeoServerVendorOption.class);
VersionData earliest = VersionData.getEarliestVersion(GeoServerVendorOption.class);
// Invalid column
model.setValueAt(earliest, 0, 0);
VersionData actual = (VersionData) model.getValueAt(0, 1);
assertEquals(latest.getVersionString(), actual.getVersionString());
// Invalid row
model.setValueAt(earliest, -1, 1);
actual = (VersionData) model.getValueAt(0, 1);
assertEquals(latest.getVersionString(), actual.getVersionString());
model.setValueAt(earliest, 1, 1);
actual = (VersionData) model.getValueAt(0, 1);
assertEquals(latest.getVersionString(), actual.getVersionString());
// Valid row
model.setValueAt(earliest, 0, 1);
actual = (VersionData) model.getValueAt(0, 1);
assertEquals(earliest.getVersionString(), actual.getVersionString());
// Try setSelectedVersion
model.setSelectedVersion(latest, 0);
actual = (VersionData) model.getValueAt(0, 1);
assertEquals(latest.getVersionString(), actual.getVersionString());
}
Aggregations