Search in sources :

Example 91 with Element

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

the class ValueBuilderTest method testVariable.

@Test
public void testVariable() {
    ValueBuilder vb = new ValueBuilder("${name} road");
    Element el = new Way(1);
    el.addTag("name", "abc abc");
    String s = vb.build(el, null);
    assertEquals("abc abc road", s);
}
Also used : Element(uk.me.parabola.mkgmap.reader.osm.Element) Way(uk.me.parabola.mkgmap.reader.osm.Way) Test(org.junit.Test)

Example 92 with Element

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

the class ValueBuilderTest method testSpacedArgsOldSyntax.

/**
 * Test that you can use a space before the pipe with the old unquoted syntax.
 */
@Test
public void testSpacedArgsOldSyntax() {
    ValueBuilder vb = new ValueBuilder("{ name '${rcnname | substring:1:14}' }");
    Element el = new Way(1);
    el.addTag("rcnname", "1234567890123456789");
    String s = vb.build(el, null);
    assertEquals("value is trimmed", "{ name '2345678901234' }", s);
}
Also used : Element(uk.me.parabola.mkgmap.reader.osm.Element) Way(uk.me.parabola.mkgmap.reader.osm.Way) Test(org.junit.Test)

Example 93 with Element

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

the class ValueBuilderTest method testQuotedSplitLines.

@Test
public void testQuotedSplitLines() {
    String value = "${cs:phone|subst:^00~>+|subst:[-\n" + "()]~>|subst:^0~>+353|subst:^+3530~>+353}";
    ValueBuilder vb = new ValueBuilder(value);
    Element el = new Way(1);
    el.addTag("mkgmap:country", "IRL");
    el.addTag("cs:phone", "00(22)5554-444");
    String s = vb.build(el, null);
    assertEquals("+225554444", s);
}
Also used : Element(uk.me.parabola.mkgmap.reader.osm.Element) Way(uk.me.parabola.mkgmap.reader.osm.Way) Test(org.junit.Test)

Example 94 with Element

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

the class ValueBuilderTest method testSimpleSubst.

@Test
public void testSimpleSubst() {
    ValueBuilder vb = new ValueBuilder("init ${name|subst:abc=>xyz} final");
    Element el = new Way(1);
    el.addTag("name", "abc road abc");
    String s = vb.build(el, null);
    assertEquals("init xyz road xyz final", 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