Ignore:
Timestamp:
2014-01-19T18:06:39+01:00 (11 years ago)
Author:
simon04
Message:

fix #8071 - MapCSS: skip null values in concat(), provide join(separator, value1, ..., valueN)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.groovy

    r6736 r6737  
    199199        assert mc.getCascade(Environment.DEFAULT_LAYER).get("width") == 15
    200200    }
     201
     202    @Test
     203    public void testTicket80711() throws Exception {
     204        def sheet = new MapCSSStyleSource("")
     205        getParser("*[rcn_ref], *[name] {text: concat(tag(rcn_ref), \" \", tag(name)); }").sheet(sheet)
     206        def mc = new MultiCascade()
     207        sheet.apply(mc, TestUtils.createPrimitive("way name=Foo"), 20, null, false)
     208        assert mc.getCascade(Environment.DEFAULT_LAYER).get("text") == " Foo"
     209        sheet.apply(mc, TestUtils.createPrimitive("way rcn_ref=15"), 20, null, false)
     210        assert mc.getCascade(Environment.DEFAULT_LAYER).get("text") == "15 "
     211        sheet.apply(mc, TestUtils.createPrimitive("way rcn_ref=15 name=Foo"), 20, null, false)
     212        assert mc.getCascade(Environment.DEFAULT_LAYER).get("text") == "15 Foo"
     213
     214        sheet = new MapCSSStyleSource("")
     215        getParser("*[rcn_ref], *[name] {text: join(\" - \", tag(rcn_ref), tag(ref), tag(name)); }").sheet(sheet)
     216        sheet.apply(mc, TestUtils.createPrimitive("way rcn_ref=15 ref=1.5 name=Foo"), 20, null, false)
     217        assert mc.getCascade(Environment.DEFAULT_LAYER).get("text") == "15 - 1.5 - Foo"
     218    }
    201219}
Note: See TracChangeset for help on using the changeset viewer.