Ignore:
Timestamp:
2021-06-02T20:40:56+02:00 (4 years ago)
Author:
simon04
Message:

fix #20957, see #20744 - Fix MapCSS function round

File:
1 edited

Legend:

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

    r17832 r17916  
    615615                "null1: tag(x1) + tag(x2);" +
    616616                "null2: 3 + tag(does_not_exist) + 5;" +
     617                "rounding: concat(\"ele=\", round(tag(\"ele\")*100)/100);" +
    617618                "}");
    618619        source.loadStyleSource();
     
    628629        assertNull(mc.getCascade(null).get("null1"));
    629630        assertEquals(8.0, mc.getCascade(null).get("null2"));
     631        assertEquals(8.0, mc.getCascade(null).get("rounding"));
    630632    }
    631633
     
    738740        assertNull(mc.getCascade(null).get("name"));
    739741    }
     742
     743    /**
     744     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/20957">Bug #20957</a>.
     745     */
     746    @Test
     747    void testTicket20957() {
     748        MapCSSStyleSource source = new MapCSSStyleSource("node {fixAdd: concat(\"ele=\", round(tag(\"ele\")*100)/100)}");
     749        source.loadStyleSource();
     750        MultiCascade mc = new MultiCascade();
     751        source.apply(mc, OsmUtils.createPrimitive("node ele=12.123456"), 20, false);
     752        assertEquals("ele=12.12", mc.getCascade(null).get("fixAdd"));
     753    }
    740754}
Note: See TracChangeset for help on using the changeset viewer.