Search in sources :

Example 1 with StrokeTreeItem

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

the class StrokeTreeItemTest method testGetTreeString.

/**
 * Test method for {@link com.sldeditor.ui.tree.item.StrokeTreeItem#getTreeString(java.lang.Object)}.
 */
@Test
public void testGetTreeString() {
    StrokeTreeItem item = new StrokeTreeItem();
    String actualValue = item.getTreeString(null, null);
    String expectedValue = Localisation.getString(SLDTreeTools.class, "TreeItem.stroke");
    assertTrue(actualValue.compareTo(expectedValue) == 0);
    Stroke stroke = DefaultSymbols.createDefaultStroke();
    actualValue = item.getTreeString(null, stroke);
    assertTrue(actualValue.compareTo(expectedValue) == 0);
    actualValue = item.getTreeString(null, stroke);
    assertTrue(actualValue.compareTo(expectedValue) == 0);
}
Also used : Stroke(org.geotools.styling.Stroke) StrokeTreeItem(com.sldeditor.ui.tree.item.StrokeTreeItem) Test(org.junit.Test)

Example 2 with StrokeTreeItem

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

the class StrokeTreeItemTest method testItemSelected.

/**
 * Test method for {@link com.sldeditor.ui.tree.item.StrokeTreeItem#itemSelected(javax.swing.tree.DefaultMutableTreeNode, java.lang.Object)}.
 */
@Test
public void testItemSelected() {
    StrokeTreeItem item = new StrokeTreeItem();
    item.itemSelected(null, null);
    Symbolizer symbolizer = DefaultSymbols.createDefaultLineSymbolizer();
    DefaultMutableTreeNode parentNode = new DefaultMutableTreeNode();
    parentNode.setUserObject(symbolizer);
    DefaultMutableTreeNode node = new DefaultMutableTreeNode();
    parentNode.add(node);
    item.itemSelected(node, symbolizer);
    // Get the code coverage stats up
    item.itemSelected(parentNode, symbolizer);
    parentNode.setUserObject(item);
    item.itemSelected(node, null);
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) StrokeTreeItem(com.sldeditor.ui.tree.item.StrokeTreeItem) Symbolizer(org.geotools.styling.Symbolizer) Test(org.junit.Test)

Aggregations

StrokeTreeItem (com.sldeditor.ui.tree.item.StrokeTreeItem)2 Test (org.junit.Test)2 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1 Stroke (org.geotools.styling.Stroke)1 Symbolizer (org.geotools.styling.Symbolizer)1