Search in sources :

Example 86 with Element

use of uk.me.parabola.mkgmap.reader.osm.Element in project mkgmap by openstreetmap.

the class AddTagActionTest method testNoMatchingAlternatives.

/**
 * The add/set commands now support alternatives just like the name command
 * has always done.
 * Several alternatives, but none match.
 */
@Test
public void testNoMatchingAlternatives() {
    AddTagAction act = new AddTagAction("a", "${notset}", false);
    act.add("${hello}");
    act.add("${world}");
    Element el = stdElement();
    act.perform(el);
    assertNull("a not set", el.getTag("a"));
}
Also used : Element(uk.me.parabola.mkgmap.reader.osm.Element) Test(org.junit.Test)

Example 87 with Element

use of uk.me.parabola.mkgmap.reader.osm.Element in project mkgmap by openstreetmap.

the class AddTagActionTest method testFirstAlternativeMatches.

/**
 * Several alternatives and the first one matches.
 */
@Test
public void testFirstAlternativeMatches() {
    AddTagAction act = new AddTagAction("a", "${val}", false);
    act.add("${hello}");
    act.add("${world}");
    Element el = stdElement();
    el.addTag("val", "has value");
    el.addTag("hello", "hello");
    act.perform(el);
    assertEquals("a is set", "has value", el.getTag("a"));
}
Also used : Element(uk.me.parabola.mkgmap.reader.osm.Element) Test(org.junit.Test)

Example 88 with Element

use of uk.me.parabola.mkgmap.reader.osm.Element in project mkgmap by openstreetmap.

the class AddTagActionTest method stdElement.

private Element stdElement() {
    Element el1 = new Way(1);
    el1.addTag("ref", REFVAL);
    el1.addTag("name:cy", PLACENAME);
    return el1;
}
Also used : Element(uk.me.parabola.mkgmap.reader.osm.Element) Way(uk.me.parabola.mkgmap.reader.osm.Way)

Example 89 with Element

use of uk.me.parabola.mkgmap.reader.osm.Element in project mkgmap by openstreetmap.

the class AddTagActionTest method testSecondAlternativeMatches.

/**
 * Several alternatives and the second one matches.
 */
@Test
public void testSecondAlternativeMatches() {
    AddTagAction act = new AddTagAction("a", "${val}", false);
    act.add("${hello}");
    act.add("${world}");
    Element el = stdElement();
    el.addTag("hello", "hello");
    el.addTag("world", "world");
    act.perform(el);
    assertEquals("a is set", "hello", el.getTag("a"));
}
Also used : Element(uk.me.parabola.mkgmap.reader.osm.Element) Test(org.junit.Test)

Example 90 with Element

use of uk.me.parabola.mkgmap.reader.osm.Element in project mkgmap by openstreetmap.

the class NotContainedFilterTest method testMissingTag.

@Test
public void testMissingTag() {
    NotContainedFilter filter = new NotContainedFilter(":sometag");
    Element el = stdElement();
    String s = filter.doFilter("x", el);
    assertEquals(s, "x");
}
Also used : Element(uk.me.parabola.mkgmap.reader.osm.Element) Test(org.junit.Test)

Aggregations

Element (uk.me.parabola.mkgmap.reader.osm.Element)94 Test (org.junit.Test)75 Way (uk.me.parabola.mkgmap.reader.osm.Way)48 GType (uk.me.parabola.mkgmap.reader.osm.GType)25 TestUtils.makeRuleSet (func.lib.TestUtils.makeRuleSet)23 Action (uk.me.parabola.mkgmap.osmstyle.actions.Action)15 Rule (uk.me.parabola.mkgmap.reader.osm.Rule)8 ArrayList (java.util.ArrayList)7 Node (uk.me.parabola.mkgmap.reader.osm.Node)7 Relation (uk.me.parabola.mkgmap.reader.osm.Relation)7 Coord (uk.me.parabola.imgfmt.app.Coord)5 StringStyleFileLoader (func.lib.StringStyleFileLoader)4 Map (java.util.Map)4 GeneralRelation (uk.me.parabola.mkgmap.reader.osm.GeneralRelation)4 TypeResult (uk.me.parabola.mkgmap.reader.osm.TypeResult)4 HashMap (java.util.HashMap)3 IdentityHashMap (java.util.IdentityHashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2 Area (uk.me.parabola.imgfmt.app.Area)2