Search in sources :

Example 26 with Element

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

the class AddTagActionTest method testHighwaySymbol.

/**
 * Test for the highway symbol substitution.
 */
@Test
public void testHighwaySymbol() {
    Action act = new AddTagAction("a", "${ref|highway-symbol:hbox}", false);
    Element el = stdElement();
    act.perform(el);
    // There should be one of the magic garmin values at the beginning
    // of the string.
    assertEquals("subst ref", "\u0004" + REFVAL, el.getTag("a"));
}
Also used : Element(uk.me.parabola.mkgmap.reader.osm.Element) Test(org.junit.Test)

Example 27 with Element

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

the class AddTagActionTest method testNoSub.

/**
 * If there are no substitutions, then the exact same string is
 * used.
 */
@Test
public void testNoSub() {
    String value = "fred";
    Action act = new AddTagAction("a", value, false);
    Element el = stdElement();
    act.perform(el);
    assertSame("a not changed", value, el.getTag("a"));
}
Also used : Element(uk.me.parabola.mkgmap.reader.osm.Element) Test(org.junit.Test)

Example 28 with Element

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

the class AddTagActionTest method testSubstWithDefault.

@Test
public void testSubstWithDefault() {
    Action act = new AddTagAction("result", "${ref|def:default-ref}", true);
    Element el = stdElement();
    act.perform(el);
    assertEquals("ref not defaulted", REFVAL, el.getTag("result"));
    act = new AddTagAction("result", "${ref|def:default-ref}", true);
    el = stdElement();
    el.deleteTag("ref");
    act.perform(el);
    assertEquals("ref was defaulted", "default-ref", el.getTag("result"));
}
Also used : Element(uk.me.parabola.mkgmap.reader.osm.Element) Test(org.junit.Test)

Example 29 with Element

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

the class NotContainedFilterTest method test2ndArgNotContained.

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

Example 30 with Element

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

the class NotContainedFilterTest method stdElement.

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

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