Search in sources :

Example 1 with NameLayerTreeItem

use of com.sldeditor.ui.tree.item.NameLayerTreeItem in project sldeditor by robward-scisys.

the class NameLayerTreeItemTest method testItemSelected.

/**
 * Test method for
 * {@link com.sldeditor.ui.tree.item.NameLayerTreeItem#itemSelected(javax.swing.tree.DefaultMutableTreeNode, java.lang.Object)}.
 */
@Test
public void testItemSelected() {
    NameLayerTreeItem item = new NameLayerTreeItem();
    item.itemSelected(null, null);
}
Also used : NameLayerTreeItem(com.sldeditor.ui.tree.item.NameLayerTreeItem) Test(org.junit.Test)

Example 2 with NameLayerTreeItem

use of com.sldeditor.ui.tree.item.NameLayerTreeItem in project sldeditor by robward-scisys.

the class NameLayerTreeItemTest method testGetTreeString.

/**
 * Test method for
 * {@link com.sldeditor.ui.tree.item.NameLayerTreeItem#getTreeString(java.lang.Object)}.
 */
@Test
public void testGetTreeString() {
    NameLayerTreeItem item = new NameLayerTreeItem();
    String actualValue = item.getTreeString(null, null);
    String expectedValue = String.format("%s : %s", Localisation.getString(SLDTreeTools.class, "TreeItem.namedlayer"), "");
    assertTrue(actualValue.compareTo(expectedValue) == 0);
    NamedLayer namedLayer = DefaultSymbols.createNewNamedLayer();
    actualValue = item.getTreeString(null, namedLayer);
    assertTrue(actualValue.compareTo(expectedValue) == 0);
    String expectedName = "test name";
    namedLayer.setName(expectedName);
    actualValue = item.getTreeString(null, namedLayer);
    expectedValue = String.format("%s : %s", Localisation.getString(SLDTreeTools.class, "TreeItem.namedlayer"), expectedName);
    assertTrue(actualValue.compareTo(expectedValue) == 0);
}
Also used : NamedLayer(org.geotools.styling.NamedLayer) NameLayerTreeItem(com.sldeditor.ui.tree.item.NameLayerTreeItem) SLDTreeTools(com.sldeditor.ui.tree.SLDTreeTools) Test(org.junit.Test)

Aggregations

NameLayerTreeItem (com.sldeditor.ui.tree.item.NameLayerTreeItem)2 Test (org.junit.Test)2 SLDTreeTools (com.sldeditor.ui.tree.SLDTreeTools)1 NamedLayer (org.geotools.styling.NamedLayer)1