use of uk.me.parabola.mkgmap.reader.osm.Element in project mkgmap by openstreetmap.
the class AddAccessActionTest method testNoValue.
/**
* If a substitution tag has no value then the value of the tag is not
* changed by the action.
*/
@Test
public void testNoValue() {
Action act = new AddAccessAction("${noexist}", true);
Element el = stdElement();
String val = "before";
el.addTag("mkgmap:bicycle", val);
act.perform(el);
assertSame("no substitution", val, el.getTag("mkgmap:bicycle"));
}
use of uk.me.parabola.mkgmap.reader.osm.Element in project mkgmap by openstreetmap.
the class AddAccessActionTest method testOverwriteValue.
/**
* If modify is set to true all access tags should be set
* no matter if they are set before.
*/
@Test
public void testOverwriteValue() {
Action act = new AddAccessAction("${access}", true);
Element el = stdElement();
el.addTag("mkgmap:bicycle", "yes");
act.perform(el);
for (String accessTag : ACCESS_TAGS.keySet()) {
assertEquals("no overwrite", "no", el.getTag(accessTag));
}
}
use of uk.me.parabola.mkgmap.reader.osm.Element in project mkgmap by openstreetmap.
the class AddTagActionTest method testNoValue.
/**
* If a substitution tag has no value then the value of the tag is not
* changed by the action.
*/
@Test
public void testNoValue() {
Action act = new AddTagAction("a", "Road ${noexist}, name ${name:cy}", true);
Element el = stdElement();
String val = "before";
el.addTag("a", val);
act.perform(el);
assertSame("no substitution", val, el.getTag("a"));
}
use of uk.me.parabola.mkgmap.reader.osm.Element in project mkgmap by openstreetmap.
the class AddTagActionTest method testBareSubst.
/**
* Simple test, substituting the whole string.
*/
@Test
public void testBareSubst() {
Action act = new AddTagAction("a", "${ref}", false);
Element el = stdElement();
act.perform(el);
assertEquals("subst ref", REFVAL, el.getTag("a"));
}
use of uk.me.parabola.mkgmap.reader.osm.Element in project mkgmap by openstreetmap.
the class AddTagActionTest method testNumberWithUnit.
/**
* Test substitutions that get a conversion factor applied to them.
*/
@Test
public void testNumberWithUnit() {
Action act = new AddTagAction("result", "${ele|conv:m=>ft}", false);
Element el = stdElement();
el.addTag("ele", "100");
act.perform(el);
assertEquals("subst ref", "328", el.getTag("result"));
}
Aggregations