Changeset 7170 in josm for trunk/test/unit/org/openstreetmap


Ignore:
Timestamp:
2014-05-22T20:55:57+02:00 (10 years ago)
Author:
simon04
Message:

fix #10063 - MapCSS: make min() and max() work on a list as well

For instance, max(split(";", tag(widths))) splits the tag widths on semicolons and determines the largest numeric value

File:
1 edited

Legend:

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

    r7167 r7170  
    353353                "min_value: min(tag(x), tag(y), tag(z)); " +
    354354                "max_value: max(tag(x), tag(y), tag(z)); " +
     355                "max_split: max(split(\";\", tag(widths))); " +
    355356                "}")
    356357        sheet.loadStyleSource()
     
    361362        assert mc.getCascade(Environment.DEFAULT_LAYER).get("max_value", Float.NaN, Float.class) == 8.0f
    362363
    363         sheet.apply(mc, TestUtils.createPrimitive("way x=4 y=6"), 20, null, false)
    364         assert mc.getCascade(Environment.DEFAULT_LAYER).get("min_value", -777f, Float.class) == -777f
    365         assert mc.getCascade(Environment.DEFAULT_LAYER).get("max_value", -777f, Float.class) == -777f
     364        sheet.apply(mc, TestUtils.createPrimitive("way x=4 y=6 widths=1;2;8;56;3;a"), 20, null, false)
     365        assert mc.getCascade(Environment.DEFAULT_LAYER).get("min_value", -777f, Float.class) == 4
     366        assert mc.getCascade(Environment.DEFAULT_LAYER).get("max_value", -777f, Float.class) == 6
     367        assert mc.getCascade(Environment.DEFAULT_LAYER).get("max_split", -777f, Float.class) == 56
    366368    }
    367369}
Note: See TracChangeset for help on using the changeset viewer.