Search in sources :

Example 31 with Element

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

the class NotContainedFilterTest method testNonDefaultDelimiterNotContained.

@Test
public void testNonDefaultDelimiterNotContained() {
    NotContainedFilter filter = new NotContainedFilter("#:ref");
    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)

Example 32 with Element

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

the class NotContainedFilterTest method testNonDefaultDelimiterContained.

@Test
public void testNonDefaultDelimiterContained() {
    NotContainedFilter filter = new NotContainedFilter("#:test");
    Element el = stdElement();
    el.addTag("test", "Aa#Bb#Cc#Dd");
    String s = filter.doFilter("Cc", el);
    assertNull(s);
}
Also used : Element(uk.me.parabola.mkgmap.reader.osm.Element) Test(org.junit.Test)

Example 33 with Element

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

the class NotContainedFilterTest method test2ndArgContained.

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

Example 34 with Element

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

the class ValueBuilderTest method testMultiSubst.

@Test
public void testMultiSubst() {
    ValueBuilder vb = new ValueBuilder("${name|subst:abc=>xyz|subst:def=>www|def:unset}");
    Element el = new Way(1);
    // No tags set, so default value will be applied.
    String s = vb.build(el, null);
    assertEquals("name not set, so default is applied", "unset", s);
    // Name tag is set, so substitutions are made
    el.addTag("name", "abc def");
    s = vb.build(el, null);
    assertEquals("substitutions in name", "xyz www", s);
}
Also used : Element(uk.me.parabola.mkgmap.reader.osm.Element) Way(uk.me.parabola.mkgmap.reader.osm.Way) Test(org.junit.Test)

Example 35 with Element

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

the class ValueBuilderTest method testEmptyArg.

@Test
public void testEmptyArg() {
    ValueBuilder vb = new ValueBuilder("${name|def:}");
    Element el = new Way(1);
    String s = vb.build(el, null);
    assertEquals("", s);
}
Also used : Element(uk.me.parabola.mkgmap.reader.osm.Element) Way(uk.me.parabola.mkgmap.reader.osm.Way) 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