use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class RuleSetTest method testCheckinExample.
/**
* The example that was in the check in comment, make sure it actually
* does work ;)
*/
@Test
public void testCheckinExample() {
RuleSet rs = makeRuleSet("highway=motorway {set blue=true;}\n" + "blue=true [0x1 ]\n" + "highway=motorway [0x2]");
Way el = new Way(1);
el.addTag("highway", "motorway");
GType type = getFirstType(rs, el);
assertEquals("first match is on blue", 1, type.getType());
}
use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class RuleSetTest method testActionsMixedWithTypes.
@Test
public void testActionsMixedWithTypes() {
RuleSet rs = makeRuleSet("highway=primary {set marker=1}" + "marker=2 [0x1]" + "highway=primary {set marker=2}" + "marker=2 [0x2]");
Way el = new Way(1);
el.addTag("highway", "primary");
GType type = getFirstType(rs, el);
assertEquals("second marker rule", 2, type.getType());
}
use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class RuleSetTest method testOrderChain.
/**
* A chain of rules, some of which contain tags from the element and
* some that contain only tags that are set in previous rules.
*/
@Test
public void testOrderChain() {
RuleSet rs = makeRuleSet("z=1 {add fred=1;}" + "fred=1 {add abba=1}" + "z=1 & abba=1 {add destiny=1}" + "destiny=1 [0x1]" + "z=1 [0x2]");
Way el = new Way(1);
el.addTag("z", "1");
GType type = getFirstType(rs, el);
assertNotNull("chain of commands", type);
assertEquals("'destiny' should be selected", 1, type.getType());
}
use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class RuleSetTest method testContinueNoPropagate.
@Test
public void testContinueNoPropagate() {
RuleSet rs = makeRuleSet("highway=footway {set surface=good;} [0x1 continue no_propagate]" + "surface=good [0x20]" + "surface=bad [0x30]");
Way el = new Way(1);
el.addTag("highway", "footway");
el.addTag("surface", "bad");
List<GType> list = resolveList(rs, el);
assertEquals("number of lines returned", 2, list.size());
assertEquals("surface setting is not propagated", "bad", el.getTag("surface"));
assertEquals("result type", 0x30, list.get(1).getType());
}
use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class RuleSetTest method testContinueWithActions.
@Test
public void testContinueWithActions() {
RuleSet rs = makeRuleSet("highway=footway {set surface=good;} [0x1 continue with_actions]" + "surface=good [0x20]" + "surface=bad [0x30]");
Way el = new Way(1);
el.addTag("highway", "footway");
el.addTag("surface", "bad");
List<GType> list = resolveList(rs, el);
assertEquals("number of lines returned", 2, list.size());
assertEquals("surface setting is propagated", "good", el.getTag("surface"));
assertEquals("result type", 0x20, list.get(1).getType());
}
Aggregations