use of uk.me.parabola.mkgmap.reader.osm.Element in project mkgmap by openstreetmap.
the class AddAccessActionTest method testNoSub.
/**
* If there are no substitutions, then the exact same string is
* used.
*/
@Test
public void testNoSub() {
String value = "fred";
Action act = new AddAccessAction(value, false);
Element el = stdElement();
act.perform(el);
for (String accessTag : ACCESS_TAGS.keySet()) {
assertSame("a not changed", value, el.getTag(accessTag));
}
}
use of uk.me.parabola.mkgmap.reader.osm.Element in project mkgmap by openstreetmap.
the class AddAccessActionTest method testBareSubst.
/**
* Simple test, substituting the whole string.
*/
@Test
public void testBareSubst() {
Action act = new AddAccessAction("${access}", false);
Element el = stdElement();
act.perform(el);
for (String accessTag : ACCESS_TAGS.keySet()) {
assertEquals("subst access", ACCESSVAL, el.getTag(accessTag));
}
}
use of uk.me.parabola.mkgmap.reader.osm.Element in project mkgmap by openstreetmap.
the class AddAccessActionTest method testNoOverwriteValue.
/**
* If modify is set to false each single access tag should only be set
* if it is not already set.
*/
@Test
public void testNoOverwriteValue() {
Action act = new AddAccessAction("${access}", false);
Element el = stdElement();
el.addTag("mkgmap:bicycle", "yes");
act.perform(el);
for (String accessTag : ACCESS_TAGS.keySet()) {
if ("mkgmap:bicycle".equals(accessTag))
assertEquals("no overwrite", "yes", el.getTag(accessTag));
else
assertEquals("no overwrite", "no", el.getTag(accessTag));
}
}
use of uk.me.parabola.mkgmap.reader.osm.Element in project mkgmap by openstreetmap.
the class AddAccessActionTest method testSecondAlternativeMatches.
/**
* Several alternatives and the second one matches.
*/
@Test
public void testSecondAlternativeMatches() {
AddAccessAction act = new AddAccessAction("${hello}", false);
act.add("${access}");
act.add("${world}");
Element el = stdElement();
el.addTag("world", "world");
act.perform(el);
for (String accessTag : ACCESS_TAGS.keySet()) assertEquals(accessTag + " is set", ACCESSVAL, el.getTag(accessTag));
}
use of uk.me.parabola.mkgmap.reader.osm.Element in project mkgmap by openstreetmap.
the class AddTagActionTest method testManySubs.
/**
* Complex string with more than one substitution.
*/
@Test
public void testManySubs() {
Action act = new AddTagAction("a", "Road ${ref}, name ${name:cy}", false);
Element el = stdElement();
act.perform(el);
assertEquals("many substitutions", "Road " + REFVAL + ", name " + PLACENAME, el.getTag("a"));
}
Aggregations