Changeset 7165 in josm for trunk/test


Ignore:
Timestamp:
2014-05-22T11:24:54+02:00 (10 years ago)
Author:
simon04
Message:

see #10063 - MapCSS: add min() and max() according to standard

File:
1 edited

Legend:

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

    r7124 r7165  
    318318        assert css.getErrors().iterator().next().toString().contains("Unknown MapCSS base selector invalid_base")
    319319    }
     320
     321    @Test
     322    public void testMinMaxFunctions() throws Exception {
     323        def sheet = new MapCSSStyleSource("* {" +
     324                "min_value: min(tag(x), tag(y), tag(z)); " +
     325                "max_value: max(tag(x), tag(y), tag(z)); " +
     326                "}")
     327        sheet.loadStyleSource()
     328        def mc = new MultiCascade()
     329
     330        sheet.apply(mc, TestUtils.createPrimitive("way x=4 y=6 z=8 u=100"), 20, null, false)
     331        assert mc.getCascade(Environment.DEFAULT_LAYER).get("min_value", Float.NaN, Float.class) == 4.0f
     332        assert mc.getCascade(Environment.DEFAULT_LAYER).get("max_value", Float.NaN, Float.class) == 8.0f
     333
     334        sheet.apply(mc, TestUtils.createPrimitive("way x=4 y=6"), 20, null, false)
     335        assert mc.getCascade(Environment.DEFAULT_LAYER).get("min_value", -777f, Float.class) == -777f
     336        assert mc.getCascade(Environment.DEFAULT_LAYER).get("max_value", -777f, Float.class) == -777f
     337    }
    320338}
Note: See TracChangeset for help on using the changeset viewer.