use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class RuleSetTest method testContinueDefault.
@Test
public void testContinueDefault() {
RuleSet rs = makeRuleSet("highway=footway {set surface=good;} [0x1 continue]" + "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 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 StyledConverterTest method testOverlay.
/**
* Test the overlay feature, when one line is duplicated with different
* types.
*/
@Test
public void testOverlay() throws FileNotFoundException {
Way way = makeWay();
way.addTag("highway", "overlay");
converter = makeConverter("simple");
converter.convertWay(way);
converter.end();
assertEquals("lines produced", 3, lines.size());
assertEquals("first line is 1", 1, lines.get(0).getType());
assertEquals("second line is 2", 2, lines.get(1).getType());
assertEquals("third line is 3", 3, lines.get(2).getType());
}
use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class StyledConverterTest method convertTag.
private Way convertTag(String key, String value) throws FileNotFoundException {
lines.clear();
Way way = makeWay();
way.addTag(key, value);
converter = makeConverter("d");
converter.convertWay(way);
converter.end();
return way;
}
use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class StyledConverterTest method testConvertWay.
@Test
public void testConvertWay() throws FileNotFoundException {
converter = makeConverter("simple");
Way way = makeWay();
way.addTag("highway", "primary");
way.addTag("x", "y");
converter.convertWay(way);
converter.end();
assertEquals("line converted", 1, lines.size());
assertEquals("line from highway", 0x2, lines.get(0).getType());
}
use of uk.me.parabola.mkgmap.reader.osm.Way in project mkgmap by openstreetmap.
the class StyledConverterTest method testFinalizer.
@Test
public void testFinalizer() throws FileNotFoundException {
// test three ways
// the first two ways should get the name "OK" by the finalize part
// the third way should not be handled by the finalize part
String[][] tests = new String[][] { { "residential", "OK" }, { "track", "OK" }, { "secondary", null } };
for (String[] test : tests) {
// clear the lines list for each test
lines.clear();
converter = makeConverter("finalize");
Way w = makeWay();
w.addTag("highway", test[0]);
converter.convertWay(w);
converter.end();
assertEquals("lines converted", 1, lines.size());
assertEquals("wrong name set by the finalize block", test[1], lines.get(0).getName());
}
// check if continue works
lines.clear();
converter = makeConverter("finalize");
Way w = makeWay();
w.addTag("highway", "trunk");
converter.convertWay(w);
converter.end();
assertEquals("lines converted", 2, lines.size());
assertEquals("wrong name set by the finalize block", "OK", lines.get(0).getName());
assertEquals("wrong name set by the finalize block", null, lines.get(1).getName());
}
Aggregations