Search in sources :

Example 1 with RuleTreeItem

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

the class RuleTreeItemTest method testItemSelected.

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

Example 2 with RuleTreeItem

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

the class RuleTreeItemTest method testGetTreeString.

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

Aggregations

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